Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 82923 - x.org: startx arg handling is not whitespace-clean
Summary: x.org: startx arg handling is not whitespace-clean
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All All
: High minor (vote)
Assignee: Gentoo X packagers
URL: https://bugs.freedesktop.org/show_bug...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-22 02:05 UTC by Jason Bucata
Modified: 2005-02-22 13:13 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to startx (fixed_startx.patch,1.83 KB, patch)
2005-02-22 02:06 UTC, Jason Bucata
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 X.org, 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.

bugs.freedesktop.org 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: https://bugs.freedesktop.org/show_bug.cgi?id=2595
Comment 5 Adam Jackson 2005-02-22 13:13:20 UTC
watching this one upstream.