Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jan 1997 11:26:04 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        joerg_wunsch@uriah.heep.sax.de
Cc:        chuckr@Glue.umd.edu, eagriff@global2000.net, current@freebsd.org
Subject:   Re: Can't get `.' off of root's path
Message-ID:  <199701281826.LAA08607@phaeton.artisoft.com>
In-Reply-To: <Mutt.19970128100002.j@uriah.heep.sax.de> from "J Wunsch" at Jan 28, 97 10:00:02 am

next in thread | previous in thread | raw e-mail | index | archive | help
> >   In both cases, su
> > complains about relative components in the path, whether they are there or
> > not.  I'm going to check the su code.
> 
> No need.  Either 1) turn on your brain first :-))) (and think about
> the sequence, and about which PATH su(1) can examine at all), or 2) go
> back and re-read my followup in this thread.
> 
> Finally, you'll end up with either removing the dot from the PATH of
> the invoking user (_NOT_ of the _invoked_ user!), or you gotta live
> with the warning (or you hack su to no longer warn you...).

man su (look for -l and -m)

The error does not occur using -l.

The error does not occur for sh if the user PATH does not contain a
naked trailing ":" or a ":." anywhere in the path

The error does not occur for csh if the user path does not contain a
".".

The error *does* occur for csh *if* the user path is set on every
invocation instead of on login only, *even* if you have modified
your current invocation's path to not include a ".".

This is a common mistake of novice csh users who do not differentiate
between inherited and uninherited values for subshells, and is an
error in the FreeBSD user account template files.

The FreeBSD user account template files are currently in error.


The error occurs because the invocation of the csh for the root shell
obtains which .cshrc to run from the HOME environment variable of
the invoking user... and the path is reset instead of being inherited.



There *IS* a bug in su, however:

*If* the FreeBSD account template .cshrc and/or .login is corrected,
*and* you "su -m" instead of "su", *and* your current path has a "."
in it, *but* the path set by your .cshrc does not...

You still get the error, even though the resulting path for the root
user after the su does *not* have a relative path.

So the behaviour of "su -m" *incorrectly* checks the preinvocation
environment instead of the postinvocation environment.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701281826.LAA08607>