"gksudo -u <anything other than root>" always returns error code 1

Bug #470747 reported by Victor Engmark
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gksu (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: gksu

This is normal:
$ gksudo -u root echo $HOME
/home/foobar
$ echo $?
0

But why does this return error code 1?
$ gksudo -u foobar echo $HOME
/home/foobar
$ echo $?
1

I'm running all commands as user foobar, which is a sudoer.

Interestingly, no error is reported by sudo in the same situation
$ sudo -u foobar echo $HOME
/home/foobar
$ echo $?
0

Using GKsu version 2.0.2 on Karmic.

Revision history for this message
WeatherGod (ben-v-root) wrote :

I suspect that this might be a duplicate of a very old bug: #51633

That being said, there are also other webpages saying that the gksu programs are not parsing the command line properly and that you should use '--' to convert a sudo command into a gksudo command.

Revision history for this message
Victor Engmark (victor-engmark) wrote :

Thanks for the tip, but it doesn't seem like "--" works (at least the way I understand it):
$ gksudo -u foobar -- echo $HOME
/home/foobar
$ echo $?
1

Revision history for this message
Tuomas Heino (iheino+ub) wrote :

Tested with Maverick, symptoms are still the same.
And it indeed looks like a duplicate of LP: #51633

Revision history for this message
Victor Engmark (victor-engmark) wrote :

@Tuomas: This is not a duplicate of #51633 - That bug deals with the fact that gksu does *not* return the exit code of the command.

Revision history for this message
Victor Engmark (victor-engmark) wrote :

Still an issue in GKsu version 2.0.2. This makes it unnecessarily tricky to create reliable shell programs (set -o errexit).

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

Other bug subscribers

Remote bug watches

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