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

Dan Nicholson dbn.lists at gmail.com
Mon Dec 21 20:48:54 PST 2009


On Mon, Dec 21, 2009 at 8:08 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> On Mon, Dec 21, 2009 at 07:27:24PM -0800, Dan Nicholson wrote:
>> 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.
>
> If you look at USER_CONFIGDIRPATH, the only match for /etc/ only (without
> X11) is "/etc/%X". %X only expands to xorg.conf (it should probably expand
> to xorg.conf.d for directories eventually), hence you don't get a match.

Not exactly. %X matches the last argument passed to DoSubstitution.
For xf86openConfigFile, it's xorg.conf (XCONFIGFILE), but for
xf86openConfigDirFiles, it's xorg.conf.d (XCONFIGDIR).

> The effect of that is that config directories outside of /etc/X11 won't be
> parsed for users. Not a great loss though.

It should work exactly as the config file matching does, except we
don't do environment variables for the config dir. Are there files in
the directory when you create /etc/xorg.conf.d? As I was explaining to
Julien, in order to be able to signal back to the caller whether there
are actually any config files or not, we have to test that the
directory exists and has readable .conf files. If not, we keep moving,
with the end result that it doesn't report a config directory. I
wanted to be able to report the directory even when there are no
files, but that would break the autoconfig behavior because the caller
would think there were config files.

--
Dan


More information about the xorg-devel mailing list