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

Re: default search PATH



On Oct 21, Andrew Pimlott wrote:
>     The default [$PATH] value on Debian systems is:
> 
>     /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
> 
> Ok, so maybe some package just made a mistake.  However, upon further 
> investigation ...
> 
> 1.  There is no mention of the PATH in the Policy Manual.
> 2.  There does not seem to be any coordinated effort to do something sane.
> (3.  I didn't find any discussion or explanation of 1. and 2. in the list 
> archives)
> 
> I was quite surprised to find this issue unaddressed, since Debian is 
> well thought-out in most respects.  I hope some developers on this list 
> are interested in rectifying it.

Above echoes my sentiments.

So far, I've been using /etc/environment; it's sourced by /etc/profile
and /etc/X11/Xsession (or at least it is by mine - I don't remember if
the stock version does this.) As for different shells, here's what I
currently do for tcsh:

  setenv ENVFILE /etc/environment 
  if( -f $ENVFILE ) then
    set path=(`sed -n -e 's/:/ /g' -e '/^ *PATH=/s/PATH=//p' $ENVFILE`)
  else
    set path=(/bin /usr/bin /usr/X11R6/bin /usr/local/bin)
  fi

> - login (login-980403-0.3) has the path /bin:/usr/bin compiled in, and the
> configuration file /etc/login.defs sets the path to the same for non-root
> users.

Isn't this desireable?

> - sshd (ssh-1.2.26-1) has the path /usr/bin:/bin:/usr/bin compiled in.

Why the duplicate entry?  Otherwise, I think that's a good default.

> As for a solution...  In /etc/login.defs, a comment suggests that login
> should set a minimal path, and shell startup files should set a more
> complete path.  If that were agreed upon, it should be the responsibility
> of each shell packager to make sure the shell _unconditionally_ sets the
> path to the default Debian path--but only for login shells.  xdm (and
> workalikes) should probably be considered a shell for this purpose, though
> I don't know xdm that well.  

This sounds reasonable, but I don't think the shell should know what the
default path is - it should come from the filesystem.  Personally, I
like HP's /etc/PATH and /etc/MANPATH files:  very unambiguous and easily
shared by different shells.  Moreover, they can be refered to be
/etc/environment, allowing me and others to retain any customizations
we've done based on it.

> Additionally, the minimal path set by login should be standardized,
> and sshd et al should set the same minimal path.

Seems like it is, or nearly - just the sequence that differed between
sshd and login.  But I suppose it would be better if it were spelled out.


Reply to: