Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14422

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

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: cd -L not behaving as documented with symlinks and ..
Date 2018-07-30 16:58 -0400
Message-ID <mailman.4435.1532984337.1292.bug-bash@gnu.org> (permalink)
References <CAK7k5HEUf9cqTdKktbSoD6gAThMYue4QfPhVv05kYiwDfpwhdw@mail.gmail.com>

Show all headers | View raw


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

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: cd -L not behaving as documented with symlinks and .. Chet Ramey <chet.ramey@case.edu> - 2018-07-30 16:58 -0400

csiph-web