On 5/29/17 6:48 PM, dualbus wrote: > On Mon, May 29, 2017 at 06:25:06PM -0400, Chet Ramey wrote: > [...] >> If PWD appears in the environment, and it is an absolute pathname of the >> CWD, set PWD to the canonicalized version of the environment value. The >> canonicalized version removes . and .., makes sure that the length is >> less than PATH_MAX, and validates that at each step, removing . and .. >> results in a valid pathname. If canonicalization fails, PWD gets the value >> that would be printed by pwd -P if PWD were not set. > > That's not quite true. In variables.c `set_pwd', there's the following:
That's true. The algorithm as described sets the shell's internal version of the current working directory as long as canonicalization succeeds. It's consistent with bash's philosophy of not modifying variables imported from the environment. I'll look at whether this makes sense to add in Posix mode. This happens very early in shell initialization, before the startup files are run, and before a shell named `sh' goes into Posix mode. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/