Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 82923

Summary: startx arg handling is not whitespace-clean
Product: Gentoo Linux Reporter: Jason Bucata <tech31842>
Component: [OLD] UnspecifiedAssignee: Gentoo X packagers <x11>
Severity: minor CC: radek
Priority: High    
Version: 2004.3   
Hardware: All   
OS: All   
Package list:
Runtime testing required: ---
Attachments: patch to startx

Description Jason Bucata 2005-02-22 02:05:34 UTC
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.

This is likely to get classified as an upstream bug, and I'll understand if you do, except that in the comments at the top of startx it says:
     # Site administrators are STRONGLY urged to write nicer versions.
As the distro is the intermediary between said site administrators and, it makes more sense for Gentoo to provide said nicer version than for each individual sysadmin.

Avoiding the temptation to use shell arrays (which are in POSIX but which need bashisms to be actually useful), I used a little sed command that I hope is adequate to quote for whatever shells Gentoo supports as /bin/sh.  Will upload patch.
Comment 1 Jason Bucata 2005-02-22 02:06:54 UTC
Created attachment 51867 [details, diff]
patch to startx
Comment 2 Adam Jackson 2005-02-22 09:04:21 UTC
/me puts on his upstream hat

no distro i know of customizes the startx script to any meaningful extent.  also it doesn't make sense for gentoo to maintain this patch forever when xorg would be interested to have it. would be the appropriate upstream place to report this.  good catch!
Comment 3 Jason Bucata 2005-02-22 12:20:53 UTC
I guess that means you want me to take this one upstream for you, too ;).  Will do shortly.
Comment 4 Jason Bucata 2005-02-22 12:55:33 UTC
Bug filed upstream:
Comment 5 Adam Jackson 2005-02-22 13:13:20 UTC
watching this one upstream.