Bug 2595

Summary: startx arg handling is not whitespace-clean
Product: xorg Reporter: Jason Bucata <jbucata>
Component: App/xinitAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED INVALID QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: high CC: mmokrejs
Version: 6.8.0Keywords: love
Hardware: All   
OS: Linux (All)   
URL: http://bugs.gentoo.org/show_bug.cgi?id=82923
Whiteboard: 2011BRB_Reviewed
i915 platform: i915 features:
Attachments:
Description Flags
patch to startx none

Description Jason Bucata 2005-02-22 12:49:34 UTC
Taking upstream at request of Gentoo devs.

According to the man page, startx is supposed to take the same command-line
syntax as xinit, and provide some extra services like setting up authorization
and such like.  However, xinit handles single-quoted command line args with
embedded spaces correctly, but startx does not.

The script assumes that each individual command-line parameter has no embedded
spaces, with constructs like:
     clientargs="$clientargs $1"
Thus, any special quoting or grouping on the startx command line won't get
propagated to xinit correctly.

I discovered this problem while trying to do some testing for another bug. 
Boiled down, this command works:
     xinit /bin/sh -vxc 'xsetroot -solid orange; sleep 5' -- :1
but this command, which per the docs should work, doesn't:
     startx /bin/sh -vxc 'xsetroot -solid orange; sleep 5' -- :1
The former starts the server, sets the background color and waits for 5 seconds,
like it should.  The latter starts the server and bails immediately since
xsetroot runs with no args and sleep isn't run at all.

I used a little sed command that I hope is adequate to quote for whatever shells
you intend to support as /bin/sh.  Will upload patch.
Comment 1 Jason Bucata 2005-02-22 12:53:22 UTC
Created attachment 1960 [details] [review]
patch to startx
Comment 2 Daniel Stone 2007-02-27 01:25:32 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 3 Martin Mokrejs 2009-01-30 12:14:56 UTC
Confirming the patch is still necessary and helpful on Gentoo linux with x11-apps/xinit-1.0.8-r3.
Comment 4 Adam Jackson 2018-06-12 19:06:32 UTC
Mass closure: This bug has been untouched for more than six years, and is not
obviously still valid. Please reopen this bug or file a new report if you continue to experience issues with current releases.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.