bug-bash
[Top][All Lists]
Advanced

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

Re: PWD not made canonical on shell start


From: Chet Ramey
Subject: Re: PWD not made canonical on shell start
Date: Tue, 30 May 2017 10:32:33 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

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    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]