Sujet : Re: Default PATH setting - reduce to something more sensible?
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.unix.shellDate : 24. Jan 2025, 02:57:55
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250123171808.91@kylheku.com>
References : 1 2 3 4 5 6 7 8
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-01-24, Keith Thompson <Keith.S.Thompson+
u@gmail.com> wrote:
Here's my bug report:
>
https://lists.gnu.org/archive/html/bug-bash/2025-01/msg00114.html
The documentation's wording that is second most relevant to this
issue is:
"Each variable assignment is checked for unquoted tilde-prefixes
immediately following a ':' or the first '='. In these cases, tilde
expansion is also performed. Consequently, one may use filenames with
tildes in assignments to PATH, MAILPATH, and CDPATH, and the shell
assigns the expanded value."
In particular, the "Consequently," suggests that it is /as a
consequence/ of the above requirements (expansion of unescaped tildes in
variable assignments), and no other requirements, that it is possible to
tildes in PATH!
I say second most relevant, because I the most relevant passage in
the GNU Info manual:
6.11 Bash POSIX Mode
[ ... ]
The following list is what's changed when 'POSIX mode' is in effect:
1. [ ... ]
[ ... ]
19. Literal tildes that appear as the first character in elements of
the PATH variable are not expanded as described above under
Tilde Expansion.
Aha! This is the very feature: leading literal tildes in the PATH
elements being expanded, disabled by POSIX mode (such as invocation
as #!/bin/sh).
But Tilde Expansion mentions no such thing!
That's where the documentation would have to be, to fix the
dangling reference above.
Still, the requirement itself can be deemed as being documented by point
19 above; it implies that when Bash is in POSIX mode, tildes are somehow
expanded. Though the promised detailed description is missing, it
cannot reasonably be anything other than replacement by $HOME,
which is the actual behavior that can be inferred from experiments.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca