bug-bash
[Top][All Lists]
Advanced

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

Re: cd -L not behaving as documented with symlinks and ..


From: Chet Ramey
Subject: Re: cd -L not behaving as documented with symlinks and ..
Date: Mon, 30 Jul 2018 16:58:48 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 7/30/18 7:48 AM, Hugo Gabriel Eyherabide wrote:

> Bash Version: 4.4
> Patch Level: 0
> Release Status: release
> 
> Description:
> According to the documentation, cd -L should resolve symlinks after
> evaluating .., and that is indeed the case, unless the canonicalization
> fails, in which case it uses the original path, seemingly behaving as cd -P.
> 
> More specifically, suppose that in the current working directory /tmp there
> only exists a directory a/b and a symlink c->a/b. Then, cd -L c/../; pwd
> produces /tmp as expected. However, cd -L c/../b; pwd results in /tmp/a/b,
> as opposed to an error (because the directory /tmp/b does not exists).

Yes. Bash has used the directory name passed as an argument as a fallback
if canonicalization fails for a very long time (at least 25 years). POSIX
says this should fail, though, so when running in posix mode, bash returns
failure if the canonicalization fails.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/



reply via email to

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