Doesn't return correct system exit code

Bug #51633 reported by Sebastian Heinlein
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gksu (Ubuntu)

Bug Description

Gksu doesn't return the exit code of the wrapped application:

Steps to reproduce:

1. open language support

2. run the following command in a terminal:
gksu synaptic && echo "spitze"

sudo works perfectly:
sudo synaptic && echo "spitze"

Revision history for this message
Jouni Mettala (jouni-mettala) wrote :

gksu and sudo are doing exactly same thing now. Closing. Feel free to reopen if this is still a problem.

Changed in gksu:
status: Unconfirmed → Fix Released
Revision history for this message
Sebastian Heinlein (glatzor) wrote :

This is not true. Please test the bug before you close it.

Changed in gksu:
status: Fix Released → Confirmed
Revision history for this message
Martin Pitt (pitti) wrote :

I just spent 20 minutes banging my head over my code before it occured to me that gksu was to blame. And indeed:

$ gksu false; echo $?

This is wrong.

Revision history for this message
Gustavo Noronha Silva (kov) wrote :

I agree... this is done like this to let applications calling gksu know if an error to the process of scaling privileges has happened. We could change that to a message printed to stderr instead, and make gksu return the error code returned by the application. What do you think, Michael?

Revision history for this message
wodz (wodz) wrote :

In my opinion gksu should return exit code of wrapped application. It is dumb to have graphical su/sudo behaving differently than console su/sudo:
wodz@skatol:~$ sudo false; echo $?
wodz@skatol:~$ gksu false; echo $?

Revision history for this message
Jens (sirion) wrote :

I have scripts that use something like

"$sudoCmd" "$0" "$@"

In the [...]-part there is code that decides whether a terminal is connected or not and then changes $sudoCmd if not.

Is there another way for me to query whether the programm called with gksu(do) succeeded?

Revision history for this message
udude (igal) wrote :

I'm also having issues w/this behavior. My scripts count on gksudo exit code to error when the executed command fails.
Does anyone know about any workarounds/gksudo replacements?
I don't even mind launching a new terminal running sudo or something in that direction...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.