Deutsch   English   Français   Italiano  
<20250123171808.91@kylheku.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.unix.shell
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Fri, 24 Jan 2025 01:57:55 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <20250123171808.91@kylheku.com>
References: <vm5dei$2c7to$1@dont-email.me>
 <1a876l-53v.ln1@ID-313840.user.individual.net>
 <20250122120930.74@kylheku.com>
 <ccr96l-eot.ln1@ID-313840.user.individual.net>
 <vmthmu$3bb88$1@news.xmission.com> <20250123134647.436@kylheku.com>
 <87v7u5m9m5.fsf@nosuchdomain.example.com>
 <87y0z1595p.fsf@nosuchdomain.example.com>
Injection-Date: Fri, 24 Jan 2025 02:57:55 +0100 (CET)
Injection-Info: dont-email.me; posting-host="7f33a37540ba8b226dd6885cb0d9398b";
	logging-data="2016349"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+xqHjvXo04E6GVz0R/e88zUcNqSOD/zfQ="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:KyuASrGvW5kfHgmRzI8ULQB6s+Y=
Bytes: 3142

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/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca