Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Your reasoning is excellent -- it's only your basic assumptions that are wrong.


comp / comp.unix.programmer / Re: Default PATH setting - reduce to something more sensible?

SubjectAuthor
* Default PATH setting - reduce to something more sensible?Janis Papanagnou
+- Re: Default PATH setting - reduce to something more sensible?Dan Cross
`* Re: Default PATH setting - reduce to something more sensible?Rainer Weikusat
 `* Re: Default PATH setting - reduce to something more sensible?Scott Lurndal
  +- Re: Default PATH setting - reduce to something more sensible?Kaz Kylheku
  `* Re: Default PATH setting - reduce to something more sensible?Rainer Weikusat
   `* Re: Default PATH setting - reduce to something more sensible?Scott Lurndal
    +- Re: Default PATH setting - reduce to something more sensible?Dan Cross
    `* Re: Default PATH setting - reduce to something more sensible?Rainer Weikusat
     `* Re: Default PATH setting - reduce to something more sensible?Scott Lurndal
      `* Re: Default PATH setting - reduce to something more sensible?Rainer Weikusat
       `* Re: Default PATH setting - reduce to something more sensible?Janis Papanagnou
        +- Re: Default PATH setting - reduce to something more sensible?Scott Lurndal
        +- Re: Default PATH setting - reduce to something more sensible?Dan Cross
        +- Re: Default PATH setting - reduce to something more sensible?Rainer Weikusat
        `* Re: Default PATH setting - reduce to something more sensible?Waldek Hebisch
         `- Re: Default PATH setting - reduce to something more sensible?Rainer Weikusat

1
Subject: Default PATH setting - reduce to something more sensible?
From: Janis Papanagnou
Newsgroups: comp.unix.programmer
Organization: A noiseless patient Spider
Date: Tue, 14 Jan 2025 10:14 UTC
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.programmer
Subject: Default PATH setting - reduce to something more sensible?
Date: Tue, 14 Jan 2025 11:14:40 +0100
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <vm5dei$2c7to$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 14 Jan 2025 11:14:42 +0100 (CET)
Injection-Info: dont-email.me; posting-host="3244c3cf7af00d5f2b161a466407d110";
logging-data="2498488"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1d4cBlILqTxr0ZgMYHdCy"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:dWGjV7odxuIvttX8gNwbsjO/gLI=
X-Enigmail-Draft-Status: N1110
X-Mozilla-News-Host: news://news.eternal-september.org:119
View all headers

When I recently inspected an 'strace' log and saw the huge amount
of system-calls done for a simple standard command (like 'rm') -
it's more than a dozen! and most lead just to ENOENT - I wondered
about the default PATH definition which is for my system
/usr/lib/lightdm/lightdm
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
(here I'm omitting my own additions, '~/bin' and '.', and I separated
them, one on each line for a better visualization of the "problem" or,
maybe better, for the "questions".)

The above PATH components are for a terminal running under some
window manager, a plain console window will not show the 'lightdm'
entry (but I rarely work on plain consoles).

This raises a few questions, and someone may shed some light on the
rationale for above default settings... (and how to "fix" it best)

Why do I need 'lightdm/lightdm' in the user's PATH variable defined?
(That directory contains just one special script and one executable.)
This entry is what annoys me most; it also reminds me of systems that
have every program vendor add an own PATH entry for their products.
Would it be safe to just remove that (in my '~/.profile') from PATH?
Or can I make it vanish by some other change, to not appear in the
in the PATH first place? (Of course without destabilizing the system
by that.)

There's no files in '/usr/local/sbin' (on my system); no admins with
special tools desires.

I don't seem to use executables from all the 'sbin' directories; I'm
positive I need /usr/bin, /bin, and I've also installed some things
in /usr/local/bin. It seems to me that, as a normal user, the PATH
(and with it the path-search) could be drastically reduced. Is there
a method to only have them in the PATH when 'sudo'ing any programs
that require root privileges and the privileged programs in 'sbin'?

I mean, if I 'sodo' a shell I get - and I think this is sensible! -
only /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
(no 'lightdm', no 'games', and no personal settings) anyway, and I
seem to have those entries available independent of any parent
process's setting; PATH=/usr/bin sudo ksh will still provide all
the 'sbin' directories in the privileged shell's own PATH setting.

So my thought is, for the moment as a workaround, to edit the PATH
in the .profile, and _remove_ all 'sbin' and the 'lightdm' entries,
or just explicitly _define_ PATH without the spurious parts). (Or
would it be advisable to do that change in all the shells' .rc
files?) Or is there yet a better place to "fix" things system-wide?

(Or better not touch a running system? - but it looks so messy!)

Janis

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Dan Cross
Newsgroups: comp.unix.programmer, comp.unix.shell
Followup: comp.unix.shell
Organization: PANIX Public Access Internet and UNIX, NYC
Date: Tue, 14 Jan 2025 13:55 UTC
References: 1
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.unix.programmer,comp.unix.shell
Subject: Re: Default PATH setting - reduce to something more sensible?
Followup-To: comp.unix.shell
Date: Tue, 14 Jan 2025 13:55:19 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <vm5qc7$ft9$1@reader2.panix.com>
References: <vm5dei$2c7to$1@dont-email.me>
Injection-Date: Tue, 14 Jan 2025 13:55:19 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
logging-data="16297"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)
View all headers

[Meta note: This is more of a comp.unix.shell sort of post; not
so much comp.unix.programmer. Followup-To: set accordingly.]

In article <vm5dei$2c7to$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>When I recently inspected an 'strace' log and saw the huge amount
>of system-calls done for a simple standard command (like 'rm') -
>it's more than a dozen! and most lead just to ENOENT - I wondered
>about the default PATH definition which is for my system
> /usr/lib/lightdm/lightdm
> /usr/local/sbin
> /usr/local/bin
> /usr/sbin
> /usr/bin
> /sbin
> /bin
> /usr/games
>(here I'm omitting my own additions, '~/bin' and '.', and I separated
>them, one on each line for a better visualization of the "problem" or,
>maybe better, for the "questions".)

On a single-user system, it's not a huge deal, but on a
multiuser system where you may `cd` into a directory writable by
anyone (such as /tmp), `.` in $PATH is a known security problem.
YMMV, but caveat emptor.

>The above PATH components are for a terminal running under some
>window manager, a plain console window will not show the 'lightdm'
>entry (but I rarely work on plain consoles).
>
>This raises a few questions, and someone may shed some light on the
>rationale for above default settings... (and how to "fix" it best)
>
>Why do I need 'lightdm/lightdm' in the user's PATH variable defined?
>(That directory contains just one special script and one executable.)
>This entry is what annoys me most; it also reminds me of systems that
>have every program vendor add an own PATH entry for their products.
>Would it be safe to just remove that (in my '~/.profile') from PATH?
>Or can I make it vanish by some other change, to not appear in the
>in the PATH first place? (Of course without destabilizing the system
>by that.)

If you don't feel like you need to run that executable, and the
window manager works ok without it, I don't see why it would be
a problem to remove it from $PATH.

>There's no files in '/usr/local/sbin' (on my system); no admins with
>special tools desires.
>
>I don't seem to use executables from all the 'sbin' directories; I'm
>positive I need /usr/bin, /bin, and I've also installed some things
>in /usr/local/bin. It seems to me that, as a normal user, the PATH
>(and with it the path-search) could be drastically reduced. Is there
>a method to only have them in the PATH when 'sudo'ing any programs
>that require root privileges and the privileged programs in 'sbin'?

Yes, `sudo` can be configured to set $PATH for the programs that
it invokes; see sudoers(5) and look for `secure_path`. If you
don't invoke those from your normal shell, I don't see a problem
removing them from the default.

>I mean, if I 'sodo' a shell I get - and I think this is sensible! -
>only /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
>(no 'lightdm', no 'games', and no personal settings) anyway, and I
>seem to have those entries available independent of any parent
>process's setting; PATH=/usr/bin sudo ksh will still provide all
>the 'sbin' directories in the privileged shell's own PATH setting.
>
>So my thought is, for the moment as a workaround, to edit the PATH
>in the .profile, and _remove_ all 'sbin' and the 'lightdm' entries,
>or just explicitly _define_ PATH without the spurious parts). (Or
>would it be advisable to do that change in all the shells' .rc
>files?) Or is there yet a better place to "fix" things system-wide?
>
>(Or better not touch a running system? - but it looks so messy!)

Personally, I'd let well enough alone, but I suppose this
alludes to a larger question: does having those entries in $PATH
affect the operation of the system in any materially negative
way? Is this just a preference for tidiness kind of thing?

There's no harm in cleaning up, but I suspect any marginal
resource savings has already been offset by thinking about it
at all. :-)

What is the desired end-state here?

- Dan C.

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Rainer Weikusat
Newsgroups: comp.unix.programmer
Date: Tue, 14 Jan 2025 17:16 UTC
References: 1
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.programmer
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Tue, 14 Jan 2025 17:16:29 +0000
Lines: 35
Message-ID: <87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com>
References: <vm5dei$2c7to$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net 7lq2snxvclDm0DRjNRyZHAPo+zEwldhfnexRa866IPgJLnMPo=
Cancel-Lock: sha1:TY3HzM3As8Yg1Ngp6ulV70Da7lY= sha1:Dk89XTX8/JvOGU/k52DAo0nGFSU= sha256:iKI/zAvj6aZtbNIhjVaub1Jx2zr8Dohi6xbZ+H+ak4U=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
View all headers

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> When I recently inspected an 'strace' log and saw the huge amount
> of system-calls done for a simple standard command (like 'rm') -
> it's more than a dozen! and most lead just to ENOENT - I wondered
> about the default PATH definition which is for my system
> /usr/lib/lightdm/lightdm
> /usr/local/sbin
> /usr/local/bin
> /usr/sbin
> /usr/bin
> /sbin
> /bin
> /usr/games
> (here I'm omitting my own additions, '~/bin' and '.', and I separated
> them, one on each line for a better visualization of the "problem" or,
> maybe better, for the "questions".)
>
> The above PATH components are for a terminal running under some
> window manager, a plain console window will not show the 'lightdm'
> entry (but I rarely work on plain consoles).
>
> This raises a few questions, and someone may shed some light on the
> rationale for above default settings... (and how to "fix" it best)

Why do you want to change that? At worst, this will make seven execve to
execute binary. Usually, it will rather be 4. That's not going to take a
noticeable amount of time.

As far as I could determine, some sort of path searching has existed
since the 6th edition of UNIX (., /bin and /usr/bin hardcoded in the
shell) and in its present form, it has existed since the 7th edition of
UNIX. Which means PATH searching was used on PDP-11 16-bit minicomputers
in the 1970s. It didn't cause performance problems back
then and will thus certainly don't cause any today.

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Scott Lurndal
Newsgroups: comp.unix.programmer
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 14 Jan 2025 17:22 UTC
References: 1 2
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!news.quux.org!weretis.net!feeder9.news.weretis.net!newsfeed.hasname.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx48.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Default PATH setting - reduce to something more sensible?
Newsgroups: comp.unix.programmer
References: <vm5dei$2c7to$1@dont-email.me> <87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com>
Lines: 38
Message-ID: <53xhP.976$GtJ8.93@fx48.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 14 Jan 2025 17:22:09 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 14 Jan 2025 17:22:09 GMT
X-Received-Bytes: 2430
View all headers

Rainer Weikusat <rweikusat@talktalk.net> writes:
>Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>> When I recently inspected an 'strace' log and saw the huge amount
>> of system-calls done for a simple standard command (like 'rm') -
>> it's more than a dozen! and most lead just to ENOENT - I wondered
>> about the default PATH definition which is for my system
>> /usr/lib/lightdm/lightdm
>> /usr/local/sbin
>> /usr/local/bin
>> /usr/sbin
>> /usr/bin
>> /sbin
>> /bin
>> /usr/games
>> (here I'm omitting my own additions, '~/bin' and '.', and I separated
>> them, one on each line for a better visualization of the "problem" or,
>> maybe better, for the "questions".)
>>
>> The above PATH components are for a terminal running under some
>> window manager, a plain console window will not show the 'lightdm'
>> entry (but I rarely work on plain consoles).
>>
>> This raises a few questions, and someone may shed some light on the
>> rationale for above default settings... (and how to "fix" it best)
>
>Why do you want to change that? At worst, this will make seven execve to
>execute binary. Usually, it will rather be 4. That's not going to take a
>noticeable amount of time.
>
>As far as I could determine, some sort of path searching has existed
>since the 6th edition of UNIX (., /bin and /usr/bin hardcoded in the
>shell) and in its present form, it has existed since the 7th edition of
>UNIX. Which means PATH searching was used on PDP-11 16-bit minicomputers
>in the 1970s. It didn't cause performance problems back
>then and will thus certainly don't cause any today.

There are cases where it _does_ cause performance degradation, if one or
more of the PATH elements refer to NFS filesystems, for example.

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Kaz Kylheku
Newsgroups: comp.unix.programmer
Organization: A noiseless patient Spider
Date: Tue, 14 Jan 2025 17:59 UTC
References: 1 2 3
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: 643-408-1753@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.programmer
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Tue, 14 Jan 2025 17:59:05 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <20250114095609.372@kylheku.com>
References: <vm5dei$2c7to$1@dont-email.me>
<87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com>
<53xhP.976$GtJ8.93@fx48.iad>
Injection-Date: Tue, 14 Jan 2025 18:59:07 +0100 (CET)
Injection-Info: dont-email.me; posting-host="b479673028688f2f6c51e4e9dcb655c6";
logging-data="2651783"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ChHPszKcLTfRxuvPRQa4q258eYHymRoc="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:HM7tzcK2DWGAH5qsSB9kC53X37E=
View all headers

On 2025-01-14, Scott Lurndal <scott@slp53.sl.home> wrote:
> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>As far as I could determine, some sort of path searching has existed
>>since the 6th edition of UNIX (., /bin and /usr/bin hardcoded in the
>>shell) and in its present form, it has existed since the 7th edition of
>>UNIX. Which means PATH searching was used on PDP-11 16-bit minicomputers
>>in the 1970s. It didn't cause performance problems back
>>then and will thus certainly don't cause any today.
>
> There are cases where it _does_ cause performance degradation, if one or
> more of the PATH elements refer to NFS filesystems, for example.

If it doesn't hurt, that "hash -r" stuff in Bash and probably other
shells has to be just developer gold plating. :)

I suspect that machines becoming faster *and* process creation becoming
more complex and heavier (e.g. attaching multiple shared libraries and
resolving symbols) has allowed us to get away with longer PATHs without
noticing.

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

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Rainer Weikusat
Newsgroups: comp.unix.programmer
Date: Tue, 14 Jan 2025 19:23 UTC
References: 1 2 3
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.programmer
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Tue, 14 Jan 2025 19:23:41 +0000
Lines: 49
Message-ID: <87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com>
References: <vm5dei$2c7to$1@dont-email.me>
<87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com>
<53xhP.976$GtJ8.93@fx48.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net fQEpVcHZ/L6792pgL4A/GwVDSzIj7G4ngK8AkDOf0PK/3kYK0=
Cancel-Lock: sha1:JffcZp3VJCx+mgWkcoLSkksRadw= sha1:tvOOwRgtgcDjucQkWddM+6SoNwA= sha256:zP+LCHTNtIRjqfBNT3Dp/qLyocPk+hoJee2K1rAfE8I=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
View all headers

scott@slp53.sl.home (Scott Lurndal) writes:
> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>> When I recently inspected an 'strace' log and saw the huge amount
>>> of system-calls done for a simple standard command (like 'rm') -
>>> it's more than a dozen! and most lead just to ENOENT - I wondered
>>> about the default PATH definition which is for my system
>>> /usr/lib/lightdm/lightdm
>>> /usr/local/sbin
>>> /usr/local/bin
>>> /usr/sbin
>>> /usr/bin
>>> /sbin
>>> /bin
>>> /usr/games
>>> (here I'm omitting my own additions, '~/bin' and '.', and I separated
>>> them, one on each line for a better visualization of the "problem" or,
>>> maybe better, for the "questions".)
>>>
>>> The above PATH components are for a terminal running under some
>>> window manager, a plain console window will not show the 'lightdm'
>>> entry (but I rarely work on plain consoles).
>>>
>>> This raises a few questions, and someone may shed some light on the
>>> rationale for above default settings... (and how to "fix" it best)
>>
>>Why do you want to change that? At worst, this will make seven execve to
>>execute binary. Usually, it will rather be 4. That's not going to take a
>>noticeable amount of time.
>>
>>As far as I could determine, some sort of path searching has existed
>>since the 6th edition of UNIX (., /bin and /usr/bin hardcoded in the
>>shell) and in its present form, it has existed since the 7th edition of
>>UNIX. Which means PATH searching was used on PDP-11 16-bit minicomputers
>>in the 1970s. It didn't cause performance problems back
>>then and will thus certainly don't cause any today.
>
> There are cases where it _does_ cause performance degradation, if one or
> more of the PATH elements refer to NFS filesystems, for example.

The internet RTT from Reading/ UK to Dallas/ Texas is about
0.12s. That's fast enough that there's no noticeable latency in
interactive shell sessions. I doubt that many real-world NFS
installations span ⅕ of the planet and hence, the latencies certainly
ought to be a lot lower.
I'm growing a bit allergic to NFS as universal example of deviant
behaviour --- that's a problem of NFS and not of code innocently and
unknowingly making use of it.

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Scott Lurndal
Newsgroups: comp.unix.programmer
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 14 Jan 2025 22:17 UTC
References: 1 2 3 4
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Default PATH setting - reduce to something more sensible?
Newsgroups: comp.unix.programmer
References: <vm5dei$2c7to$1@dont-email.me> <87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com> <53xhP.976$GtJ8.93@fx48.iad> <87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com>
Lines: 62
Message-ID: <poBhP.1243903$bYV2.919023@fx17.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 14 Jan 2025 22:17:57 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 14 Jan 2025 22:17:57 GMT
X-Received-Bytes: 3559
View all headers

Rainer Weikusat <rweikusat@talktalk.net> writes:
>scott@slp53.sl.home (Scott Lurndal) writes:
>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>>> When I recently inspected an 'strace' log and saw the huge amount
>>>> of system-calls done for a simple standard command (like 'rm') -
>>>> it's more than a dozen! and most lead just to ENOENT - I wondered
>>>> about the default PATH definition which is for my system
>>>> /usr/lib/lightdm/lightdm
>>>> /usr/local/sbin
>>>> /usr/local/bin
>>>> /usr/sbin
>>>> /usr/bin
>>>> /sbin
>>>> /bin
>>>> /usr/games
>>>> (here I'm omitting my own additions, '~/bin' and '.', and I separated
>>>> them, one on each line for a better visualization of the "problem" or,
>>>> maybe better, for the "questions".)
>>>>
>>>> The above PATH components are for a terminal running under some
>>>> window manager, a plain console window will not show the 'lightdm'
>>>> entry (but I rarely work on plain consoles).
>>>>
>>>> This raises a few questions, and someone may shed some light on the
>>>> rationale for above default settings... (and how to "fix" it best)
>>>
>>>Why do you want to change that? At worst, this will make seven execve to
>>>execute binary. Usually, it will rather be 4. That's not going to take a
>>>noticeable amount of time.
>>>
>>>As far as I could determine, some sort of path searching has existed
>>>since the 6th edition of UNIX (., /bin and /usr/bin hardcoded in the
>>>shell) and in its present form, it has existed since the 7th edition of
>>>UNIX. Which means PATH searching was used on PDP-11 16-bit minicomputers
>>>in the 1970s. It didn't cause performance problems back
>>>then and will thus certainly don't cause any today.
>>
>> There are cases where it _does_ cause performance degradation, if one or
>> more of the PATH elements refer to NFS filesystems, for example.
>
>The internet RTT from Reading/ UK to Dallas/ Texas is about
>0.12s. That's fast enough that there's no noticeable latency in
>interactive shell sessions. I doubt that many real-world NFS
>installations span ⅕ of the planet and hence, the latencies certainly
>ought to be a lot lower.
>

You seem to have have forgotten that the NFS server needs to
do a directory lookup on the file server, which adds to the R/T
latency, sometimes significantly on a busy filesystem. Add
two or three NFS-based directories in the PATH variable and it
starts to become noticable. Even on a 100Gb/sec ethernet
LAN.

>
>I'm growing a bit allergic to NFS as universal example of deviant
>behaviour --- that's a problem of NFS and not of code innocently and
>unknowingly making use of it.

It is something that people run into every day in the real world.

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Dan Cross
Newsgroups: comp.unix.programmer, comp.unix.shell
Followup: comp.unix.shell
Organization: PANIX Public Access Internet and UNIX, NYC
Date: Tue, 14 Jan 2025 23:24 UTC
References: 1 2 3 4
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.unix.programmer,comp.unix.shell
Subject: Re: Default PATH setting - reduce to something more sensible?
Followup-To: comp.unix.shell
Date: Tue, 14 Jan 2025 23:24:09 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <vm6rmp$m3n$1@reader2.panix.com>
References: <vm5dei$2c7to$1@dont-email.me> <53xhP.976$GtJ8.93@fx48.iad> <87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com> <poBhP.1243903$bYV2.919023@fx17.iad>
Injection-Date: Tue, 14 Jan 2025 23:24:09 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
logging-data="22647"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)
View all headers

[Followup-To: comp.unix.shell]

In article <poBhP.1243903$bYV2.919023@fx17.iad>,
Scott Lurndal <slp53@pacbell.net> wrote:
>Rainer Weikusat <rweikusat@talktalk.net> writes:
>>scott@slp53.sl.home (Scott Lurndal) writes:
>>> [snip]
>>> There are cases where it _does_ cause performance degradation, if one or
>>> more of the PATH elements refer to NFS filesystems, for example.
>>
>>The internet RTT from Reading/ UK to Dallas/ Texas is about
>>0.12s. That's fast enough that there's no noticeable latency in
>>interactive shell sessions. I doubt that many real-world NFS
>>installations span ⅕ of the planet and hence, the latencies certainly
>>ought to be a lot lower.
>>
>
>You seem to have have forgotten that the NFS server needs to
>do a directory lookup on the file server, which adds to the R/T
>latency, sometimes significantly on a busy filesystem. Add
>two or three NFS-based directories in the PATH variable and it
>starts to become noticable. Even on a 100Gb/sec ethernet
>LAN.
>
>>
>>I'm growing a bit allergic to NFS as universal example of deviant
>>behaviour --- that's a problem of NFS and not of code innocently and
>>unknowingly making use of it.
>
>It is something that people run into every day in the real world.

Remember wuarchive? They used to used to provide access to the
collection via (read-only) NFS. When I was young, someone at
our site had added that to the automounter maps.

There was a local sysadmin who was, er, not exactly highly
regarded. At one point another sysadmin logged into a machine
and saw that the load was really, really high; this would have
been a Sun 4/380 class computer and load was like 3 or 4, all
uninterruptable kernel reads. Anyway, it turns out the first
guy had added some directory in the automounted wuarchive tree
to his $PATH. And that's the sort of thing one does to become
"poorly regarded by colleagues."

- Dan C.

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Rainer Weikusat
Newsgroups: comp.unix.programmer
Date: Wed, 15 Jan 2025 15:38 UTC
References: 1 2 3 4 5
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.programmer
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Wed, 15 Jan 2025 15:38:53 +0000
Lines: 55
Message-ID: <877c6wf5o2.fsf@doppelsaurus.mobileactivedefense.com>
References: <vm5dei$2c7to$1@dont-email.me>
<87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com>
<53xhP.976$GtJ8.93@fx48.iad>
<87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com>
<poBhP.1243903$bYV2.919023@fx17.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net T5Gos5mycUrgVMqf3fqmkQFZY3/wCB52q6F1bNOR6adUC1q4g=
Cancel-Lock: sha1:rMIg7/exSusQgdI3USM3TY+zRQo= sha1:Qt40Ct1iYI41blRTOsCUx/i737o= sha256:NC0HWpoVOqWtvjnyFhMVv6H9hStY2H6JVRuQFrD6ZKk=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
View all headers

scott@slp53.sl.home (Scott Lurndal) writes:
> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>scott@slp53.sl.home (Scott Lurndal) writes:
>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

[...]

>>>>As far as I could determine, some sort of path searching has existed
>>>>since the 6th edition of UNIX (., /bin and /usr/bin hardcoded in the
>>>>shell) and in its present form, it has existed since the 7th edition of
>>>>UNIX. Which means PATH searching was used on PDP-11 16-bit minicomputers
>>>>in the 1970s. It didn't cause performance problems back
>>>>then and will thus certainly don't cause any today.
>>>
>>> There are cases where it _does_ cause performance degradation, if one or
>>> more of the PATH elements refer to NFS filesystems, for example.
>>
>>The internet RTT from Reading/ UK to Dallas/ Texas is about
>>0.12s. That's fast enough that there's no noticeable latency in
>>interactive shell sessions. I doubt that many real-world NFS
>>installations span â…• of the planet and hence, the latencies certainly
>>ought to be a lot lower.
>
> You seem to have have forgotten that the NFS server needs to
> do a directory lookup on the file server, which adds to the R/T
> latency, sometimes significantly on a busy filesystem.

Well, then, which is it? Local file system operations or network
latencies? Local file system operations on a NFS server are no different
from local file system operations on some other multi-user machine, eg,
the abovementioned PDP-11.

[...]

>>I'm growing a bit allergic to NFS as universal example of deviant
>>behaviour --- that's a problem of NFS and not of code innocently and
>>unknowingly making use of it.
>
> It is something that people run into every day in the real world.

Maybe they do. But certainly not on Linux installations using only local
file systems. I'm also (barely) old enough to remember DCE clusters
based on DEC servers using AFS/ NFS to provide "home directories" and
"software" to diskless workstations and to know how real-world PATHs of
traditional UNIX installation used to look like, basically, every
software package installed into its own hierarchy and all glued together
with PATH into a seamless whole. These PATHs used to have a lot more
than just seven elements. I don't remember latencies being a particular
problem in this enivronment¹.

¹ A whose class B in a single, happy, broadcast domain and using
shared-medium yellowcable and even older technologies in the more
outlying areas

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Scott Lurndal
Newsgroups: comp.unix.programmer
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 15 Jan 2025 15:52 UTC
References: 1 2 3 4 5 6
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!news-out.netnews.com!s1-2.netnews.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx04.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Default PATH setting - reduce to something more sensible?
Newsgroups: comp.unix.programmer
References: <vm5dei$2c7to$1@dont-email.me> <87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com> <53xhP.976$GtJ8.93@fx48.iad> <87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com> <poBhP.1243903$bYV2.919023@fx17.iad> <877c6wf5o2.fsf@doppelsaurus.mobileactivedefense.com>
Lines: 57
Message-ID: <rRQhP.65293$XfF8.23235@fx04.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 15 Jan 2025 15:52:55 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 15 Jan 2025 15:52:55 GMT
X-Received-Bytes: 3222
View all headers

Rainer Weikusat <rweikusat@talktalk.net> writes:
>scott@slp53.sl.home (Scott Lurndal) writes:
>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>scott@slp53.sl.home (Scott Lurndal) writes:
>>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>>Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>
>[...]
>
>>>>>As far as I could determine, some sort of path searching has existed
>>>>>since the 6th edition of UNIX (., /bin and /usr/bin hardcoded in the
>>>>>shell) and in its present form, it has existed since the 7th edition of
>>>>>UNIX. Which means PATH searching was used on PDP-11 16-bit minicomputers
>>>>>in the 1970s. It didn't cause performance problems back
>>>>>then and will thus certainly don't cause any today.
>>>>
>>>> There are cases where it _does_ cause performance degradation, if one or
>>>> more of the PATH elements refer to NFS filesystems, for example.
>>>
>>>The internet RTT from Reading/ UK to Dallas/ Texas is about
>>>0.12s. That's fast enough that there's no noticeable latency in
>>>interactive shell sessions. I doubt that many real-world NFS
>>>installations span â…• of the planet and hence, the latencies certainly
>>>ought to be a lot lower.
>>
>> You seem to have have forgotten that the NFS server needs to
>> do a directory lookup on the file server, which adds to the R/T
>> latency, sometimes significantly on a busy filesystem.
>
>Well, then, which is it? Local file system operations or network
>latencies?

Clearly both factor into latency.

> Local file system operations on a NFS server are no different
>from local file system operations on some other multi-user machine, eg,
>the abovementioned PDP-11.

Clearly the PDP-11 cannot be rationally compared with a modern
lab with thousands of pooled servers sharing storage over NFS.

>
>[...]
>
>>>I'm growing a bit allergic to NFS as universal example of deviant
>>>behaviour --- that's a problem of NFS and not of code innocently and
>>>unknowingly making use of it.
>>
>> It is something that people run into every day in the real world.
>
>Maybe they do. But certainly not on Linux installations using only local
>file systems.

Our production grid has several _thousand_ linux boxes sharing
storage using a dozen NFS servers. The load in the NFS servers
can be considerable, even with a 100Gb backbone network.

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Rainer Weikusat
Newsgroups: comp.unix.programmer
Date: Wed, 15 Jan 2025 19:19 UTC
References: 1 2 3 4 5 6 7
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.programmer
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Wed, 15 Jan 2025 19:19:36 +0000
Lines: 52
Message-ID: <8734hjga0n.fsf@doppelsaurus.mobileactivedefense.com>
References: <vm5dei$2c7to$1@dont-email.me>
<87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com>
<53xhP.976$GtJ8.93@fx48.iad>
<87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com>
<poBhP.1243903$bYV2.919023@fx17.iad>
<877c6wf5o2.fsf@doppelsaurus.mobileactivedefense.com>
<rRQhP.65293$XfF8.23235@fx04.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 1IUdM5wRvrivrJrx3KDg9Aao5sxBK86B0APuciOqMxcrd4M+c=
Cancel-Lock: sha1:4hyecTxHJxQYuokVOcAC+dFOc7A= sha1:JZw5Ah1M3mpIY2ahy4VshAv89Cw= sha256:/xL1Plzs1hxHq5EioWBSVJCHAXzUhqklwb+PmteRygw=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
View all headers

scott@slp53.sl.home (Scott Lurndal) writes:
> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>scott@slp53.sl.home (Scott Lurndal) writes:
>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>scott@slp53.sl.home (Scott Lurndal) writes:
>>>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>>>Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>
>>[...]
>>
>>>>>>As far as I could determine, some sort of path searching has existed
>>>>>>since the 6th edition of UNIX (., /bin and /usr/bin hardcoded in the
>>>>>>shell) and in its present form, it has existed since the 7th edition of
>>>>>>UNIX. Which means PATH searching was used on PDP-11 16-bit minicomputers
>>>>>>in the 1970s. It didn't cause performance problems back
>>>>>>then and will thus certainly don't cause any today.
>>>>>
>>>>> There are cases where it _does_ cause performance degradation, if one or
>>>>> more of the PATH elements refer to NFS filesystems, for example.
>>>>
>>>>The internet RTT from Reading/ UK to Dallas/ Texas is about
>>>>0.12s. That's fast enough that there's no noticeable latency in
>>>>interactive shell sessions. I doubt that many real-world NFS
>>>>installations span â…• of the planet and hence, the latencies certainly
>>>>ought to be a lot lower.
>>>
>>> You seem to have have forgotten that the NFS server needs to
>>> do a directory lookup on the file server, which adds to the R/T
>>> latency, sometimes significantly on a busy filesystem.
>>
>>Well, then, which is it? Local file system operations or network
>>latencies?
>
> Clearly both factor into latency.

Trivially, they do. But NFS means Network Filesystem and hence, bringing
it up suggests that that's about ... well ... network operations and not
local filesystem operations.

>> Local file system operations on a NFS server are no different
>>from local file system operations on some other multi-user machine, eg,
>>the abovementioned PDP-11.
>
> Clearly the PDP-11 cannot be rationally compared with a modern
> lab with thousands of pooled servers sharing storage over NFS.

The PDP-11 can be rationally compared with the situation of the OP,
namely, doing local filesystem operations on a single
computer. PATH-searching was supported on PDP-11s serving multiple
users. Hence, it's very unlikely that that's going to be a real
performance problem on a single-user Linux installation on current PC
hardware, especiall if the path has only seven elements.

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Janis Papanagnou
Newsgroups: comp.unix.programmer
Organization: A noiseless patient Spider
Date: Wed, 15 Jan 2025 23:03 UTC
References: 1 2 3 4 5 6 7 8
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.programmer
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Thu, 16 Jan 2025 00:03:22 +0100
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <vm9err$35gfs$1@dont-email.me>
References: <vm5dei$2c7to$1@dont-email.me>
<87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com>
<53xhP.976$GtJ8.93@fx48.iad>
<87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com>
<poBhP.1243903$bYV2.919023@fx17.iad>
<877c6wf5o2.fsf@doppelsaurus.mobileactivedefense.com>
<rRQhP.65293$XfF8.23235@fx04.iad>
<8734hjga0n.fsf@doppelsaurus.mobileactivedefense.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 16 Jan 2025 00:03:24 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0c2da7011ed35a6ebb4aab6b1b5a29d9";
logging-data="3326460"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18cEyLpJjHHzxlA76dq2RFh"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:DnwEW22ovKA6RjrzrFSQxkmdIbM=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <8734hjga0n.fsf@doppelsaurus.mobileactivedefense.com>
View all headers

On 15.01.2025 20:19, Rainer Weikusat wrote:
> scott@slp53.sl.home (Scott Lurndal) writes:
>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>>>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]

> The PDP-11 can be rationally compared with the situation of the OP,
> namely, doing local filesystem operations on a single computer. [...]

Since you're referring to me, the OP, please note that most arguments
here have quickly made a relation to a straw man (a performance theme)
or made other deviations from the basic question(s) that concerned me.

Essentially there were two questions I had that I can reformulate in a
more compact form as

"Why, in the first place, are all these path components
part of the default PATH for ordinary users? - Is there
any [functional] rationale or necessity for that?"

"_If_ many of the default PATH components are unnecessary,
where and how to best reduce these settings to a sensible
subset? - Without spoiling the system, of course."

But we've seen mostly only statements maneuvering around the questions.

Please don't take that hint as offense, I just think it may be time to
put it on track again. - Thanks.

Janis

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Scott Lurndal
Newsgroups: comp.unix.programmer
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 15 Jan 2025 23:14 UTC
References: 1 2 3 4 5 6 7 8 9
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!news-out.netnews.com!s1-3.netnews.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Default PATH setting - reduce to something more sensible?
Newsgroups: comp.unix.programmer
References: <vm5dei$2c7to$1@dont-email.me> <87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com> <53xhP.976$GtJ8.93@fx48.iad> <87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com> <poBhP.1243903$bYV2.919023@fx17.iad> <877c6wf5o2.fsf@doppelsaurus.mobileactivedefense.com> <rRQhP.65293$XfF8.23235@fx04.iad> <8734hjga0n.fsf@doppelsaurus.mobileactivedefense.com> <vm9err$35gfs$1@dont-email.me>
Lines: 61
Message-ID: <BjXhP.796221$DYF8.575618@fx14.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 15 Jan 2025 23:14:41 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 15 Jan 2025 23:14:41 GMT
X-Received-Bytes: 3425
View all headers

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>On 15.01.2025 20:19, Rainer Weikusat wrote:
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>>>>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>[...]
>
>> The PDP-11 can be rationally compared with the situation of the OP,
>> namely, doing local filesystem operations on a single computer. [...]
>
>Since you're referring to me, the OP, please note that most arguments
>here have quickly made a relation to a straw man (a performance theme)
>or made other deviations from the basic question(s) that concerned me.
>
>Essentially there were two questions I had that I can reformulate in a
>more compact form as
>
> "Why, in the first place, are all these path components
> part of the default PATH for ordinary users? - Is there
> any [functional] rationale or necessity for that?"

Fundamentally, it's an implementation choice. For example,
the Fedora root user will have

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

as the PATH variable.

Novice users likely never change from the default path,
and one hopes (absent duplicate command names) that the
PATH variable places the most likely elements towards
the front of the list.

For korn shell, it will remember the element on a hit
and subsequent invocations of the command will get
a hit in the shell cache and will not search PATH.

If one has a custom command that clashes with one in the
distribution, one can simply include that directory in the
path before the rest (e.g. /usr/local/sbin above), but I
wouldn't expect to find that most general linux users
ever touch PATH.

In a multi-user environment (grid or multiuser machine),
it is not uncommon to place executables on an NFS exported
filesystem (e.g. for CAD tools), and include the NFS
directory in the default PATH for the CAD users in
e.g. /profile, or in an evironment initailization
script.

>
> "_If_ many of the default PATH components are unnecessary,
> where and how to best reduce these settings to a sensible
> subset? - Without spoiling the system, of course."

Iteratively remove elements. If things don't work, put them back.

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Dan Cross
Newsgroups: comp.unix.programmer, comp.unix.shell
Followup: comp.unix.shell
Organization: PANIX Public Access Internet and UNIX, NYC
Date: Wed, 15 Jan 2025 23:26 UTC
References: 1 2 3 4
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.unix.programmer,comp.unix.shell
Subject: Re: Default PATH setting - reduce to something more sensible?
Followup-To: comp.unix.shell
Date: Wed, 15 Jan 2025 23:26:51 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <vm9g7r$ish$1@reader2.panix.com>
References: <vm5dei$2c7to$1@dont-email.me> <rRQhP.65293$XfF8.23235@fx04.iad> <8734hjga0n.fsf@doppelsaurus.mobileactivedefense.com> <vm9err$35gfs$1@dont-email.me>
Injection-Date: Wed, 15 Jan 2025 23:26:51 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
logging-data="19345"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)
View all headers

In article <vm9err$35gfs$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>[snip]
>Since you're referring to me, the OP, please note that most arguments
>here have quickly made a relation to a straw man (a performance theme)
>or made other deviations from the basic question(s) that concerned me.
>
>Essentially there were two questions I had that I can reformulate in a
>more compact form as
>
> "Why, in the first place, are all these path components
> part of the default PATH for ordinary users? - Is there
> any [functional] rationale or necessity for that?"

Not particularly.

The system has, probably for no really principled reason,
evolved over time such that that's simply the set of things that
are in $PATH by default on that particular machine. Another
machine might be different.

If I had to hazard a guess, I imagine some of it comes from the
folks who put together the distribution, some upgrades, and the
choices of e.g. the window manager you're using (recalling that
at least one $PATH component appeared to come from that).

> "_If_ many of the default PATH components are unnecessary,
> where and how to best reduce these settings to a sensible
> subset? - Without spoiling the system, of course."

There are many ways you could do this. Probably the easiest is
just to explicitly set $PATH in your shell's startup files to
those directories you care about; that's what I usually do. If
you make a mistake with it, you won't affect the rest of the
system.

If you want to set it globally for all users, there's likely
some file in /etc or similar that sets the defaults; on my Linux
machine I see a number of things in /etc/profile and
/etc/profile.d/* that seem relevant and there's /etc/login.defs;
PAM has its own way to set up $PATH. I'm not sure I'd bother,
though, if setting it up for your own account is sufficient.

- Dan C.

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Rainer Weikusat
Newsgroups: comp.unix.programmer
Date: Thu, 16 Jan 2025 11:51 UTC
References: 1 2 3 4 5 6 7 8 9
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.programmer
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Thu, 16 Jan 2025 11:51:13 +0000
Lines: 51
Message-ID: <87v7ufkmdq.fsf@doppelsaurus.mobileactivedefense.com>
References: <vm5dei$2c7to$1@dont-email.me>
<87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com>
<53xhP.976$GtJ8.93@fx48.iad>
<87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com>
<poBhP.1243903$bYV2.919023@fx17.iad>
<877c6wf5o2.fsf@doppelsaurus.mobileactivedefense.com>
<rRQhP.65293$XfF8.23235@fx04.iad>
<8734hjga0n.fsf@doppelsaurus.mobileactivedefense.com>
<vm9err$35gfs$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net ysoGJbZSm3f/q9+Bsss48wFQkPVcJjRMPpLjeDcpovNDq359A=
Cancel-Lock: sha1:RjFpdDQ00dKKV3dgujeQzF97meE= sha1:HkiHwbwTB3fiV1Yvi607ioeKLUY= sha256:/pIhG2GEiOzvLUceBAoIjy+hZnZilk/CCc4027zWlxI=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
View all headers

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> On 15.01.2025 20:19, Rainer Weikusat wrote:
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>>>>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> [...]
>
>> The PDP-11 can be rationally compared with the situation of the OP,
>> namely, doing local filesystem operations on a single computer. [...]
>
> Since you're referring to me, the OP, please note that most arguments
> here have quickly made a relation to a straw man (a performance theme)
> or made other deviations from the basic question(s) that concerned me.
>
> Essentially there were two questions I had that I can reformulate in a
> more compact form as
>
> "Why, in the first place, are all these path components
> part of the default PATH for ordinary users? - Is there
> any [functional] rationale or necessity for that?"

Because someone thinks that all these locations should be searched for
commands in the order specified. Eg, the point of the lightdm entry is
very likely to enable lightdm to 'override' arbitrary user commands by
making sure that the shell will find lightdm-commands of the same name
first.

OTOH, that's pretty much a truism.

>
> "_If_ many of the default PATH components are unnecessary,
> where and how to best reduce these settings to a sensible
> subset? - Without spoiling the system, of course."

As already written above: They are part of PATH because someone thinks
that's sensible. Whether or not they're necessary in a certain situation
is an entirely different question. If you want to work out empirically
what's "necessary" for you, remove them all and add directories to the
default PATH one-by-one as the need arises.

OTOH, what's the point? My flat contains more light switches than I
actually need, with some of them being (as far as I could determine)
entirely blind/ connected to lamps I don't use and some of them being
redundant because they switch lamps on or off which can also be switched
on or off with another light switch. But as they're just sitting on the
wall and removing them would require work, I haven't even considered
doing so.

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Waldek Hebisch
Newsgroups: comp.unix.programmer
Organization: To protect and to server
Date: Thu, 16 Jan 2025 17:01 UTC
References: 1 2 3 4 5 6 7 8 9
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
From: antispam@fricas.org (Waldek Hebisch)
Newsgroups: comp.unix.programmer
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Thu, 16 Jan 2025 17:01:59 -0000 (UTC)
Organization: To protect and to server
Message-ID: <vmbe25$3v6su$4@paganini.bofh.team>
References: <vm5dei$2c7to$1@dont-email.me> <87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com> <53xhP.976$GtJ8.93@fx48.iad> <87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com> <poBhP.1243903$bYV2.919023@fx17.iad> <877c6wf5o2.fsf@doppelsaurus.mobileactivedefense.com> <rRQhP.65293$XfF8.23235@fx04.iad> <8734hjga0n.fsf@doppelsaurus.mobileactivedefense.com> <vm9err$35gfs$1@dont-email.me>
Injection-Date: Thu, 16 Jan 2025 17:01:59 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="4168606"; posting-host="WwiNTD3IIceGeoS5hCc4+A.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A";
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
X-Notice: Filtered by postfilter v. 0.9.3
View all headers

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
> On 15.01.2025 20:19, Rainer Weikusat wrote:
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>>>> Rainer Weikusat <rweikusat@talktalk.net> writes:
>>>>>>>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> [...]
>
>> The PDP-11 can be rationally compared with the situation of the OP,
>> namely, doing local filesystem operations on a single computer. [...]
>
> Since you're referring to me, the OP, please note that most arguments
> here have quickly made a relation to a straw man (a performance theme)
> or made other deviations from the basic question(s) that concerned me.
>
> Essentially there were two questions I had that I can reformulate in a
> more compact form as
>
> "Why, in the first place, are all these path components
> part of the default PATH for ordinary users? - Is there
> any [functional] rationale or necessity for that?"

On my Debian system PATH is:

/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

'/bin' is a symlink to '/usr/bin', so AFAICS '/bin' could be
safely removed from the path. '/usr/local/games' and
'/usr/games' are empty and I do not intend to put anything
there, so they could be removed too. I have programs in
'/usr/local/bin' so for me minimal PATH could be

/usr/local/bin:/usr/bin

Note: On Debian when as a normal user I need something from
'/sbin' I use full pathname. That is purely matter of
convenience.

Note2: Some programs depend on specific PATH settings. IMO
it is responsibility of the program to ensure proper PATH.
In particular "main" program invoked by users may be a shell
scripts which sets up needed environment variables (including
PATH) and then execs acutal program.

> "_If_ many of the default PATH components are unnecessary,
> where and how to best reduce these settings to a sensible
> subset? - Without spoiling the system, of course."

Arguably, as long as standard system utilities are in the
PATH, nothing should brake. That is if some programs wants
something extra in PATH this is a bug in the program or at best
inconvenient user interface.

--
Waldek Hebisch

Subject: Re: Default PATH setting - reduce to something more sensible?
From: Rainer Weikusat
Newsgroups: comp.unix.programmer
Date: Thu, 16 Jan 2025 19:07 UTC
References: 1 2 3 4 5 6 7 8 9 10
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.programmer
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Thu, 16 Jan 2025 19:07:44 +0000
Lines: 18
Message-ID: <87o7068tmn.fsf@doppelsaurus.mobileactivedefense.com>
References: <vm5dei$2c7to$1@dont-email.me>
<87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com>
<53xhP.976$GtJ8.93@fx48.iad>
<87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com>
<poBhP.1243903$bYV2.919023@fx17.iad>
<877c6wf5o2.fsf@doppelsaurus.mobileactivedefense.com>
<rRQhP.65293$XfF8.23235@fx04.iad>
<8734hjga0n.fsf@doppelsaurus.mobileactivedefense.com>
<vm9err$35gfs$1@dont-email.me> <vmbe25$3v6su$4@paganini.bofh.team>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net DgNme6DWc52xyXCbOBwG4wtKp3LmIceolD12563l9FE8PY/yc=
Cancel-Lock: sha1:yMEvppmGHa8Zsl0Y7iANPZVNlag= sha1:YUerNAvDa05tH+5AjHN0SxJyOp0= sha256:icRK3msKgXlpOQ6srfewnoBF8jES5+itZ0JZsH90c6w=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
View all headers

antispam@fricas.org (Waldek Hebisch) writes:

[...]

> On my Debian system PATH is:
>
> /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
>
> '/bin' is a symlink to '/usr/bin', so AFAICS '/bin' could be
> safely removed from the path. '/usr/local/games' and
> '/usr/games' are empty and I do not intend to put anything
> there,

Games packaged by Debian will usually install their binaries/ programs
in /usr/games. For as long as you don't actually install any games,
/usr/games sitting at the end of the path will have no effect except
increasing the time until a "command not found" error is displayed by an
immeasurably small amount.

1

rocksolid light 0.9.8
clearnet tor