Re: Default PATH setting - reduce to something more sensible?

Liste des GroupesRevenir à cu shell 
Sujet : Re: Default PATH setting - reduce to something more sensible?
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.unix.shell
Date : 26. Jan 2025, 06:26:38
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250125211146.219@kylheku.com>
References : 1 2 3 4 5 6 7 8 9
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-01-26, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
On 24.01.2025 23:00, Keith Thompson wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
On 24.01.2025 14:46, Dan Cross wrote:
[...]
 
/usr/bin/which is limited in what it can do.  It follows POSIX-specified
behavior for $PATH; it doesn't recognize any shell-specific rules. [...]
>
Sure.
>
[...]
The settings  PATH=~/bin  and  PATH="~/bin"  respectively shall
result in the same behavior across shells when searching for
programs; in the first case looking into "/home/someuser/bin/"
and in the second case looking into "./~/bin/" (i.e. a path
component with a local directory named "~").
 
What do you mean by "shall result?
>
I mean that a shell should behave consistently. (I think Bash does
not in the given case.)
>
Consistently with what?  Bash consistently expands literal '~'s in
$PATH, and consistently disables that expansion in POSIX mode.
>
All shells have shell-specific features.  What's odd about this case is
that bash has a POSIX-violating feature that affects command name
resolution.

It's a feature that (if used) leaks tildes into child processes via
the environment variable. Path resultion in child processes, if it
reaches a PATH element with a tilde, will somehow process that tilde.

I just tried this experiment. I made a directory named ~ and put ~:
as the leading element of PATH. I put a program called "foo" that
directory.

Surely enough, I can run "foo" from the parent directory above.

The exec functions treat ~ as an ordinary path component.

(I cannot do that out of Bash, which processes the tilde, but
the 'p' family of the exec functions will find it!)

This is a problem similar to "." being in PATH.

If someone has, say, "~/bin" in their PATH, ahead of /bin and /usr/bin,
I can put a malicious program in some directory called "~/bin"
somewhere in the filesystem, give that program the name of a common
external utility, and trick the user into changing into that location
where they will run this common command, resolving to my malicious
program.

If we regard this as a security hole, that atually raises the priority
and bolsters the argument that it ought to be removed even if it
breaks some users, perhaps through a process of noisy deprecation.

Furhermore, the case can be made that the exec stuff in the Linux kernel
or C libraries should be patched with a check against components with a
leading tilde.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Date Sujet#  Auteur
14 Jan 25 * Re: Default PATH setting - reduce to something more sensible?84Dan Cross
14 Jan 25 +- Re: Default PATH setting - reduce to something more sensible?1Richard Harnden
20 Jan 25 `* Re: Default PATH setting - reduce to something more sensible?82Wayne
20 Jan 25  `* Re: Default PATH setting - reduce to something more sensible?81Janis Papanagnou
21 Jan 25   `* Re: Default PATH setting - reduce to something more sensible?80Axel Reichert
21 Jan 25    +* Re: Default PATH setting - reduce to something more sensible?7Janis Papanagnou
22 Jan 25    i+* Soft-links to binaries (was Re: Default PATH setting)4Janis Papanagnou
22 Jan 25    ii`* Re: Soft-links to binaries (was Re: Default PATH setting)3Keith Thompson
22 Jan 25    ii +- Re: Soft-links to binaries (was Re: Default PATH setting)1Lawrence D'Oliveiro
23 Jan 25    ii `- Re: Soft-links to binaries (was Re: Default PATH setting)1Janis Papanagnou
25 Jan 25    i`* PATH for GUI applications (was: Default PATH setting - reduce to something more sensible?)2Axel Reichert
26 Jan 25    i `- Re: PATH for GUI applications (was: Default PATH setting - reduce to something more sensible?)1Lawrence D'Oliveiro
22 Jan 25    `* Re: Default PATH setting - reduce to something more sensible?72Geoff Clare
22 Jan 25     `* Re: Default PATH setting - reduce to something more sensible?71Kaz Kylheku
23 Jan 25      `* Re: Default PATH setting - reduce to something more sensible?70Geoff Clare
23 Jan 25       `* Re: Default PATH setting - reduce to something more sensible?69Kenny McCormack
23 Jan 25        +* Re: Default PATH setting - reduce to something more sensible?52Dan Cross
23 Jan 25        i`* Re: Default PATH setting - reduce to something more sensible?51Janis Papanagnou
23 Jan 25        i +* Re: Default PATH setting - reduce to something more sensible?3Keith Thompson
24 Jan 25        i i`* Re: Default PATH setting - reduce to something more sensible?2Janis Papanagnou
24 Jan 25        i i `- Re: Default PATH setting - reduce to something more sensible?1Keith Thompson
23 Jan 25        i +* Re: Default PATH setting - reduce to something more sensible?3Kaz Kylheku
24 Jan 25        i i+- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
24 Jan 25        i i`- Re: Default PATH setting - reduce to something more sensible?1Jerry Peters
23 Jan 25        i +- Re: Default PATH setting - reduce to something more sensible?1marrgol
24 Jan 25        i `* Re: Default PATH setting - reduce to something more sensible?43Dan Cross
24 Jan 25        i  `* Re: Default PATH setting - reduce to something more sensible?42Janis Papanagnou
24 Jan 25        i   +* Re: Default PATH setting - reduce to something more sensible?14Dan Cross
25 Jan 25        i   i+* Re: Default PATH setting - reduce to something more sensible?5Janis Papanagnou
25 Jan 25        i   ii`* Re: Default PATH setting - reduce to something more sensible?4Dan Cross
26 Jan 25        i   ii +* Re: Default PATH setting - reduce to something more sensible?2Keith Thompson
27 Jan 25        i   ii i`- Re: Default PATH setting - reduce to something more sensible?1Dan Cross
26 Jan 25        i   ii `- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
26 Jan 25        i   i`* Re: Default PATH setting - reduce to something more sensible?8Keith Thompson
26 Jan 25        i   i +* Re: Default PATH setting - reduce to something more sensible?3Janis Papanagnou
26 Jan 25        i   i i`* Re: Default PATH setting - reduce to something more sensible?2Christian Weisgerber
27 Jan 25        i   i i `- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
26 Jan 25        i   i `* Early history of Bash (was: Re: Default PATH setting - reduce to something more sensible?)4Christian Weisgerber
27 Jan 25        i   i  +- Re: Early history of Bash1Keith Thompson
27 Jan 25        i   i  `* Re: Early history of Bash2Keith Thompson
27 Jan 25        i   i   `- Re: Early history of Bash1Lawrence D'Oliveiro
24 Jan 25        i   `* Re: Default PATH setting - reduce to something more sensible?27Keith Thompson
25 Jan 25        i    `* Re: Default PATH setting - reduce to something more sensible?26Janis Papanagnou
26 Jan 25        i     `* Re: Default PATH setting - reduce to something more sensible?25Keith Thompson
26 Jan 25        i      +* Re: Default PATH setting - reduce to something more sensible?23Kaz Kylheku
26 Jan 25        i      i`* Re: Default PATH setting - reduce to something more sensible?22Janis Papanagnou
26 Jan 25        i      i +* Re: Default PATH setting - reduce to something more sensible?2Kaz Kylheku
27 Jan 25        i      i i`- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
26 Jan 25        i      i +* Re: Default PATH setting - reduce to something more sensible?3Keith Thompson
3 Feb 25        i      i i`* Re: Default PATH setting - reduce to something more sensible?2Keith Thompson
3 Feb 25        i      i i `- Re: Default PATH setting - reduce to something more sensible?1Kaz Kylheku
27 Jan 25        i      i `* Re: Default PATH setting - reduce to something more sensible?16Lawrence D'Oliveiro
27 Jan 25        i      i  +- Re: Default PATH setting - reduce to something more sensible?1Kenny McCormack
27 Jan 25        i      i  +* Re: Default PATH setting - reduce to something more sensible?11Alexis
27 Jan 25        i      i  i+* Re: Default PATH setting - reduce to something more sensible?2Kenny McCormack
27 Jan 25        i      i  ii`- Re: Default PATH setting - reduce to something more sensible?1Alexis
27 Jan 25        i      i  i`* Re: Default PATH setting - reduce to something more sensible?8Lawrence D'Oliveiro
27 Jan 25        i      i  i `* Re: Default PATH setting - reduce to something more sensible?7Keith Thompson
27 Jan 25        i      i  i  +* Re: Default PATH setting - reduce to something more sensible?3Kaz Kylheku
27 Jan 25        i      i  i  i`* Arbitrary characters in filenames (was Re: Default PATH setting ...)2Janis Papanagnou
27 Jan 25        i      i  i  i `- Re: Arbitrary characters in filenames (was Re: Default PATH setting ...)1Kaz Kylheku
28 Jan 25        i      i  i  `* Re: Default PATH setting - reduce to something more sensible?3Lawrence D'Oliveiro
28 Jan 25        i      i  i   +- Re: Default PATH setting - reduce to something more sensible?1Keith Thompson
28 Jan 25        i      i  i   `- Re: Default PATH setting - reduce to something more sensible?1Kenny McCormack
27 Jan 25        i      i  +* Re: Default PATH setting - reduce to something more sensible?2Janis Papanagnou
28 Jan 25        i      i  i`- Re: Default PATH setting - reduce to something more sensible?1Lawrence D'Oliveiro
27 Jan 25        i      i  `- Re: Default PATH setting - reduce to something more sensible?1Kaz Kylheku
26 Jan 25        i      `- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
23 Jan 25        +* Re: Default PATH setting - reduce to something more sensible?14Kaz Kylheku
23 Jan 25        i`* Re: Default PATH setting - reduce to something more sensible?13Keith Thompson
24 Jan 25        i +* Re: Default PATH setting - reduce to something more sensible?5Keith Thompson
24 Jan 25        i i`* Re: Default PATH setting - reduce to something more sensible?4Kaz Kylheku
24 Jan 25        i i `* Re: Default PATH setting - reduce to something more sensible?3Keith Thompson
24 Jan 25        i i  `* Re: Default PATH setting - reduce to something more sensible?2Lawrence D'Oliveiro
24 Jan 25        i i   `- Re: Default PATH setting - reduce to something more sensible?1Keith Thompson
24 Jan 25        i `* Re: Default PATH setting - reduce to something more sensible?7Janis Papanagnou
24 Jan 25        i  `* Re: Default PATH setting - reduce to something more sensible?6Dan Cross
24 Jan 25        i   `* Re: Default PATH setting - reduce to something more sensible?5Janis Papanagnou
24 Jan 25        i    +* Re: Default PATH setting - reduce to something more sensible?2Dan Cross
25 Jan 25        i    i`- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
24 Jan 25        i    `* Re: Default PATH setting - reduce to something more sensible?2Keith Thompson
25 Jan 25        i     `- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
24 Jan 25        `* Re: Default PATH setting - reduce to something more sensible?2Geoff Clare
24 Jan 25         `- Re: Default PATH setting - reduce to something more sensible?1Kenny McCormack

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal