bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 9/9] variables: define default BASH_LIBRARIES_PATH


From: Koichi Murase
Subject: Re: [PATCH 9/9] variables: define default BASH_LIBRARIES_PATH
Date: Wed, 8 May 2024 18:08:40 +0900

2024年5月8日(水) 9:13 Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>:
> Please let me know if you agree to any of the following paths:
>
>     ~/.local/share/bash:/usr/share/bash
>     ~/.local/share/bash/lib:/usr/share/bash/lib

The former is absolutely no. If we choose that location to store
scripts, no place is left for the future addition of other types of
files. The latter style (but with `lib' being replaced by another word
if necessary as in an ongoing discussion about the name `library')
should be fine.

Even if it would finally be `library', I suggest that the directory
name `lib' should instead be `library' or `libraries' because
inexperienced users can be easily confused with the dynamic library
location `lib' when a script framework instructs the users to put
their script files in `share/bash/lib'. Even if we explicitly instruct
the users to put them in `/usr/share/bash/lib', some users still try
to put them in `/usr/lib' for some mysterious reason. It would
probably happen when `/usr/share/bash/lib' doesn't work for another
reason, and users try to put them directly in `/usr/lib` to "solve"
the problem. That happened with my framework. I named the directory of
the script files as `lib', which I regret now.

> Note that the default value of XDG_DATA_HOME
> is defined to be ~/.local/share.

In this case, I think the default value should actually honor the
value of XDG_DATA_HOME if present (instead of hard-coding it to be
~/.local/share).

  BASH_SOURCE_PATH=${XDG_DATA_HOME:-$HOME/.local/share}/:...

Then, there arise the repeated arguments of the chicken or the egg of
the XDG base directory initialization. Since XDG_DATA_HOME is supposed
to be set by the user in .bash_profile (or similar initialization
file), the prefered value of XDG_DATA_HOME is not known at the
initialization stage of login sessions of Bash.

> I'm not exactly invested in getting any XDG stuff
> into bash but it seems like a reasonable enough
> default for the user's personal libraries directory.

As mentioned above, it's useful but there is an issue of the chicken
or the egg. The user sets values to the variables in the shell, but
the shell wants to know the value of the variables to initialize it on
its startup. Some alternative ways are proposed, but a clean way
hasn't yet appeared.

I think it would be better to just confine ourselves in a similar
default as BASH_LOADABLES_PATH within this patch. The choices for the
location in the home directory can be discussed with the approach to
the XDG base directories.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]