[Portland] xdg-su syntax

Whipple, Tom tom.whipple at intel.com
Wed Jul 26 12:07:42 PDT 2006


Let's not forget about the syntax like:
	xdg-su -c "command args >logfile" 
which we might hope would write to 'logfile' as root (This currently
does not work). Compared to 
	xdg-su -c "command args" >logfile 
which (at least on my system) captures xdg-su's stdout and writes it to
logfile as the non-privilaged user.


I have created xdg-utils/tests/include/listargs to help sort out the
issue.

Ideally, I would like to figure out the correct syntax so that something
like
	xdg-su -c "'listargs a b c' >logfile" 
would function so that listargs thinks that it has 3 arguments (a-c) and
logfile is created as root with the stdout of listargs.

I am not sure if I am not escaping properly or if there is a bug here,
but I cannot seem to make this case work. 

-tom

> -----Original Message-----
> From: portland-bounces at lists.freedesktop.org [mailto:portland-
> bounces at lists.freedesktop.org] On Behalf Of Bastian, Waldo
> Sent: Tuesday, July 11, 2006 1:44 PM
> To: Bryce Harrington
> Cc: portland at lists.freedesktop.org
> Subject: RE: [Portland] xdg-su syntax
> 
> >On Mon, Jul 10, 2006 at 10:11:07PM -0700, Bastian, Waldo wrote:
> >> >> Hi,
> >> >>
> >> >> It was suggested to me that it would be better for xdg-su to
> follow
> >> the
> >> >> "sudo"-syntax rather than the "su -c" syntax because it has less
> >> >> potential for getting the shell escaping wrong.
> >> >> For illustration, to run "rpm -i '/tmp/some file'" as root the
> >> current
> >> >> syntax is:
> >> >> 	xdg-su -c "rpm -i '/tmp/some file'"
> >> >>
> >> >> The new proposed syntax would be:
> >> >> 	xdg-su rpm -i "/tmp/some file"
> >> >>
> >> >> The drawback seems to be that if you want to do a shell command
> like
> >> >> "cd /tmp; rpm -i 'some file'" you will still end up with
> >> >> 	xdg-su sh -c "cd /tmp; rpm -i 'some file'"
> >> >>
> >> >> Opinions?
> >> >
> >> >Would this work as well?
> >> >
> >> >	xdg-su "cd /tmp && rpm -i 'some file'"
> >>
> >> That would need to be
> >> 	xdg-su sh -c "cd /tmp && rpm -i 'some file'"
> >
> >Hrm, seems a rather cumbersome syntax.
> 
> Well.. the alternative is
> 	xdg-su -c "cd /tmp && rpm -i 'some file'"
> which is not that much of a change. I guess we can also support both.
> 
> Cheers,
> Waldo
> _______________________________________________
> Portland mailing list
> Portland at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/portland


More information about the Portland mailing list