gksudo should support passing arguments easier

Bug #16966 reported by Jerome Haltom
16
Affects Status Importance Assigned to Milestone
gksu (Ubuntu)
Fix Released
Wishlist
Michael Vogt

Bug Description

Right now gksudo requires the entire command to be executated to be contained in
a single argument. This isn't very convienent. It would be better if gksudo
could be launched sort of like this:

gksudo /bin/whatever -a -b -c

The logic for this would be fairly straightforward. Gksudo would parse it's
options from the beginning until it reached an option not prefixed with -, then
it would pass the rest of the options to the sub program.

This would make it easier to add options to .desktop files like:

Exec=gksudo /usr/bin/program -i %U

Which don't seem to currently be possible.

Revision history for this message
Jerome Haltom (wasabi) wrote :

This bug was filed along with bug #16965 and #10674 which are both related to
the same problem.

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

It should be possible to add something like:

Exec=gksudo "/usr/bin/program -i %U"

Do you think that satisfies your request? Does it work for you?

Revision history for this message
Jerome Haltom (wasabi) wrote :

I tried that. It doesn't seem to work at all.

I am assuming that the %U has to be at the end of the command in the current
.desktop file logic.

Additionally, it will break spaces and other escape characters.

Actually I thought about this a real lot and didn't come up with any other
option other than what I suggested in the opening of the bug report. Also, I
tend to think this is much cleaner. Like sudo itself. Like strace. Like a
billion other similar commands.

Sorry to rain on your parade. =)

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

It was actually already possible to use gksu/gksudo like that before, but it
would insist on interpreting the options it knew. Using the -- magic symbol did
not help because of the hack to allow it being used in the commands, so I added
another hack to make it work:

kov@alface:~/src/gksu$ ./gksu/gksu -- ls -lhk .svn/
total 40
-r--r--r-- 1 kov kov 0 2005-05-12 14:28 empty-file
-r--r--r-- 1 kov kov 9 2005-09-12 22:39 entries
-r--r--r-- 1 kov kov 1 2005-05-12 14:28 format
drwxr-xr-x 2 kov kov 4 2005-08-07 16:17 prop-base
drwxr-xr-x 2 kov kov 4 2005-08-07 16:17 props
-r--r--r-- 1 kov kov 1 2005-05-12 14:28 README.txt
drwxr-xr-x 2 kov kov 4 2005-08-05 16:38 text-base
drwxr-xr-x 6 kov kov 4 2005-09-12 22:39 tmp
drwxr-xr-x 2 kov kov 4 2005-05-12 14:28 wcprops

I noticed the sudo thing has problems interpreting the command my current code
generates, though, so I'm right now taking a look at adapting libgksu to work
correctly with sudo, too.

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

*** Bug 13549 has been marked as a duplicate of this bug. ***

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

Should work correctly with libgksu1.2 and gksu from upstream svn.

Revision history for this message
Michael Vogt (mvo) wrote :

we have the version that supports "--" in dapper now

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.