On Thu, Sep 26, 2024 at 05:26:59PM +0200, Patrice Dumas wrote:
> On Wed, Sep 25, 2024 at 06:54:12PM +0100, Gavin Smith wrote:
> > I understand the idea of files in datadir not being edited, although
> > I am still not really sure what the purpose of XDG_DATA_DIRS is (in
> > general, not just as it relates to Texinfo). According to the XDG
> > Specification, this is /usr/local/share:/usr/share by default, which is
> > where the files are installed by the package as an integral part of the
> > program. This corresponds to the ${datadir} of the GNU Coding Standards.
> > I do not understand why anyone would set XDG_DATA_DIRS.
> >
> > It seems that XDG_DATA_DIRS (and XDG_CONFIG_DIRS) are already set on
> > my system (Linux Mint 21.2 Xfce, which is an Ubuntu derivative) when I
> > log in. If this is frequent, then it causes problems for people installing
> > to non-standard ${datadir} (and ${sysconfdir}) where files in the wrong
> > locations would be used if these variables take priority over compiled-in
> > values.
>
> My understanding is that if you want to install on non-standard
> locations and want to have this non-standard location being searched for
> before other directories, then you should put first in XDG_DATA_DIRS (or
> XDG_CONFIG_DIRS). It should be possible to change
> XDG_DATA_DIRS/XDG_CONFIG_DIRS as a user or for the system, but it
> depends on the platform configuration. It seems to often be in
> /etc/profile.d/ for system-wide early change of environment variables
> for GNU/Linux.
I don't think we should require the user (or distribution maintainer) to
set XDG_DATA_DIRS/XDG_CONFIG_DIRS to install in non-default locations.
Users have been able to set datadir with configure scripts for a lot
longer than the XDG specification has existed. We should continue
to check in datadir in line with the long-standing practice of GNU
programs.
It may be fine to use the directories in XDG_DATA_DIRS as well as
$datadir.
It could depend on the type of file. A typical "data" file could be
a font file (under /usr/share/fonts) that could be used by any program,
not just those from a single package. In this view "data" is not
a fixed, necessary part of a single program but sommething that could
be used by multiple programs.
Info files under /usr/share/info are a similar case to fonts. These may
be accessed by programs from other packages (mainly Emacs but in theory
any other Info reader). Although we don't at present, using XDG_DATA_DIRS
to get directories to add to INFOPATH seems harmless.
Reading texi2any init files (I can't remember if we were saying these
were "data", "config" or both) is more problematic as these may be
coupled to a particular version of Texinfo.
${datadir}/htmlxref.cnf barely counts as a "data" file in my opinion
as it is installed in a directory along with other files that are
integral parts of the program (Perl modules and so on). It is
not like we encourage anyone to add to add their own files to
/usr/share/texinfo as they might to /usr/share/info.
I am not sure if there is a better place for the files under
/usr/share/texinfo although one suggestion is to do it the way perl
does and use a subdirectory like /usr/share/texinfo/7.2 for integral
package files (perl uses a directory like /usr/share/perl/5.34.0).
Then we could have a /usr/share/texinfo/htmlxref directory for users to
add htmlxref.cnf files.
> > Could we consider ignoring the XDG_DATA_DIRS and XDG_CONFIG_DIRS part
> > of the specification? (It seems that XDG_DATA_HOME and XDG_CONFIG_HOME
> > are the part that people really care about.)
>
> It seems to me that being able to set the search paths are a good thing.
> They should be adustable if they are set by the distribution.
I guess it is a non-package specific alternative to setting variables
like INFOPATH.
> > We could try discussing with developers of other GNU packages what
> > they do about these variables, and how the XDG specification works
> > with the GNU Coding Standards and existing practice.
>
> That could be possible.
>
> As a side note, I am not sure that it is very useful, but I tried to
> raise one issue I saw with inconsistency between $datadir/... and
> directories searched for in the XDG specification on the Xdg info list.
> There was some discussion and, in addition to my proposals a proposal to
> remove completly reference to $datadir in the specification to avoid the
> issue:
>
> https://lists.freedesktop.org/archives/xdg/2024-August/014748.html
> https://lists.freedesktop.org/archives/xdg/2024-August/014754.html
>
> It was not followed by any action, be it a rejection, nor more
> discussion nor implementation. It is not actually clear too me, now,
> that this list is really the place to discuss freedesktop.org's
> standards and specifications.
Thanks, I've read through that thread.