tech-userlevel archive

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

Re: sh(1) and ksh(1) default PATH



    Date:        Sat, 13 Aug 2022 20:59:07 +0000
    From:        nia <nia%NetBSD.org@localhost>
    Message-ID:  <YvgQm0Rc3nmmHBDU%homeworld.netbsd.org@localhost>

  | This patch synchronizes the defaults for sh(1) and ksh(1)
  | with /etc/skel/.profile.

In addition to what Joerg & Jeremy said, that would be the wrong
fix for /bin/sh (I don't know ksh well enough to say, but if it
isn't already wrong there, ksh should be altered so it would be).

The normal default path for sh comes from sysctl user.cs_path
and if there was a desire to alter that, that would be the place to
do it (as in, by setting that in /etc/sysctl.conf).   It is hard to
believe that you looked at the code and did not see that.

The list of directories in the shell is only for when that fails, or when
the shell cannot allocate memory, both of which happen never (or not at
shell startup, it is of course possible to exhaust memory while the shell
is running with a badly written, or simply deliberate, script).

It is also certainly wrong to add /usr/X11R7/bin to $PATH unless the
user is actually in an X environment, that ought be added in the X11
startup scripts, not in the shell, or in  user.cs_path   A profile
file can check if DISPLAY is set, doing that in the shell isn't appropriate.

kre




Home | Main Index | Thread Index | Old Index