[PATCH v4 3/3] xfree86: Allow config directory to be specified on command line

Dan Nicholson dbn.lists at gmail.com
Mon Dec 21 19:27:24 PST 2009


On Mon, Dec 21, 2009 at 4:56 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> On Mon, Dec 21, 2009 at 12:35:09PM -0800, Dan Nicholson wrote:
>> Add a new command line parameter, -configdir, to specify the config
>> directory to be used. Rules are the same as -config for root vs. user
>> privileges.
>>
>> Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
>> ---
>
> something feels a bit odd here:
>
> root $> mkdir /etc/xorg.conf.d && cp synaptics.conf /etc/xorg.conf.d
> user $> Xorg
> → Using config directory: /etc/xorg.conf.d
>
> user $> Xorg -configdir xorg.conf.d
> root $> Xorg -configdir xorg.conf.d
> → Unable to locate/open config directory: "xorg.conf.d".
>
> root $> Xorg -configdir /etc/xorg.conf.d
> → Using config directory: /etc/xorg.conf.d
>
> but:
>
> root $> mkdir /etc/X11/xorgconfd && cp synaptics.conf /etc/X11/xorgconfd
> user $> Xorg -configdir xorgconfd
> user $> Xorg -configdir xorgconfd
> root $> Xorg -configdir /etc/X11/xorgconfd
> → Using config directory: /etc/X11/xorgconfd
>
> If I read this correctly, the substitution path triggered by this is %X,
> the /etc/X11 stuff works because it allows for %R. Reading the comments for
> %R and %X shows that %R is a relative path, %X matches against xorg.conf
> only. This seems a bit inconsistent, I'd have expected to be able to run the
> default setup as well.
>
> It looks like that the same thing doesn't work for xorg.conf either (Xorg
> -config xorg.conf doesn't seem to work if only /etc/xorg.conf is present) so
> consider this message simply an effort to save others the trouble of
> figuring out why this doesn't work.

I think what's happening (without looking at the code) is that
OpenConfigFile/OpenConfigDir + DoSubstitution in parser/scan.c are not
actually that smart. The first thing specified in the root config
search path is %A, an absolute command line path. Since the command
line parameter you're passing is not absolute, %A fails.
OpenConfig{Dir,File} will immediately bail out if you've passed a
command line argument and a command line template failed since it
wants to respect your wishes to use the command line argument. As you
saw, this also fails with -config.

Somehow, the code needs to know that there are still command line
templates left before bailing out. Probably you could just make
OpenConfig{Dir,File} keep iterating but only use the value from
DoSubstitution if cmdlineUsed is true. A later fix, to be sure...

Thanks for the review.

--
Dan


More information about the xorg-devel mailing list