logical path to current dir lost during login

Andreas Amann amann at physik.tu-berlin.de
Thu Nov 16 06:46:11 EST 2000


Markus Friedl writes:
 > IMHO, setting $PWD is the job of the shell.
 > 
 > there are even some shells that do not need $PWD nor
 > care about symlinks.
 > 

>From "man 3 getcwd" (man-pages-1.31.):
 If the environment variable PWD is set, and its value is correct,
 then that value will be returned.

IMHO, that means that any program, that changes the current working
directory should also update  $PWD, so that it´s child processes 
can make a proper getcwd() call. Otherwise the child will not be able 
to recover the logical path of the current working directory, but only
the resolved path, which is usually not what they want, especially
when using automounting fs. 

Note that $PWD is not a shell-specific, but a glibc specific variable.
Since the shell does usually not change the working directory at
startup, it is not its task to set or change $PWD (how should it know
the correct value anyway, if not via $PWD from its parent?)


-- 
Andreas Amann
Institut fuer theoretische Physik, TU Berlin





More information about the openssh-unix-dev mailing list