inconsistency in basedir spec install in $datadir, search elsewhere

Bollinger, John John.Bollinger at STJUDE.ORG
Wed Aug 28 13:40:32 UTC 2024


Hello Patrice,

Then I don't understand your concern.  Again, yes, it is possible for software to be installed, and the Basedir variables set, such that the installed software does not find its files at runtime.  But I don't see how this points to any kind of flaw or inconsistency in the specifications.  I would account such an issue as arising from failure to comply with Basedir.

With respect specifically to $datadir, I urge you to consider how to interpret the spec's use of that symbol in context, in a way that makes the spec sensible and consistent.  I think that will bring you to an interpretation similar to the one I presented earlier.  It would be better if the spec were more explicit about its meaning, but I see no good justification for choosing an interpretation that makes the spec's provisions problematic.


Best regards,

John Bollinger
________________________________
From: Patrice Dumas <pertusus at free.fr>
Sent: Tuesday, August 27, 2024 6:03 PM
To: Bollinger, John <John.Bollinger at STJUDE.ORG>
Cc: xdg at lists.freedesktop.org <xdg at lists.freedesktop.org>
Subject: Re: inconsistency in basedir spec install in $datadir, search elsewhere

[You don't often get email from pertusus at free.fr. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Caution: External Sender. Do not open unless you know the content is safe.


On Tue, Aug 27, 2024 at 09:48:38PM +0000, Bollinger, John wrote:
> Hello Patrice,
>
> I think you're misunderstanding the use of "$datadir" in that part of the spec. I do not take it to mean an actual environment variable in the environment of the installation program, but rather as a placeholder *in the spec*, representing an arbitrary directory in the path specified by $XDG_DATA_DIRS, or representing the specified default value in the event that $XDG_DATA_DIRS is unset or empty.

I do not not take "$datadir" to be an actual environment variable in the
spec, but definitively a variable, as a shell-like syntax is used.
Now, I can't see why you assume that it represents a directory in
$XDG_DATA_DIRS, nothing says it anywhere.  The only thing we know is
that it should default to /usr/share, which is one of the possibility
for the $XDG_DATA_DIRS default values (though not the first one, but why
not), not much more.

> So yes, if the value of $XDG_DATA_DIRS observed by an installation program is used to choose installation directories, and that differs from the value of the same variable observed by the installed program at runtime, then it is possible that the program will not find its installed data files.  But that has nothing to do with an environment variable named $datadir.

I never said that $XDG_DATA_DIRS would be used by an installation
program to choose installation directories.  Also to me $datadir is not an
environment variable in the spec, but a way to denote where data files
are installed.

On $XDG_DATA_DIRS being used by an installation program to choose
installation directories, I actually think that it is probably unusual,
and is not what GNU/Linux distributions do in their building
infrastructure usually, they set compile time options, for example
./configure options corresponding to the location denoted as $datadir in
the specification to abide to the Filesystem Hierarchy standard.  Users
can also choose other installation directories, often /usr/local when
installing from source, but could also be /opt... and I guess that some
installers could use $XDG_DATA_DIRS, but it is is probably unusual.

> More importantly, however, that's not how XDG Basedir is typically used in practice. It is more common that an environment chooses installation directories for software, data files, etc in some characteristic, systematic manner, and sets $XDG_DATA_DIRS such that programs will find their files in the chosen locations.  That is, the choice of $XDG_DATA_DIRS is normally a function of the environment's installation practices, not the other way around.

I agree here that what you describe is the usual use case.  We could,
however, imagine many other possibilities (systematic installation in
/usr/share, no $XDG_DATA_DIRS set, installation in /opt, $XDG_DATA_DIRS
manually set after installation by a computer administrator in a place
where all the users find the variable for instance using the
environment.d service...). Fortunately, $XDG_DATA_DIRS and installation
directories are set consistently in practice.  My point is not that
people are dumb, but that the specification is not avoiding
inconsistentcies, and, rather, that lots of situations that are allowed
by the specification lead to inconsistent installation and search.  Not
necessarily an issue, but would deserve an explanation.

--
Pat

________________________________

Email Disclaimer: www.stjude.org/emaildisclaimer
Consultation Disclaimer: www.stjude.org/consultationdisclaimer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xdg/attachments/20240828/662af75d/attachment.htm>


More information about the xdg mailing list