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

Peter Hutterer peter.hutterer at who-t.net
Mon Dec 21 20:08:52 PST 2009


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.

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

Cheers,
  Peter


More information about the xorg-devel mailing list