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


Groups > gnu.bash.bug > #14418

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

From Hugo Gabriel Eyherabide <hugogabriel.eyherabide@gmail.com>
Newsgroups gnu.bash.bug
Subject cd -L not behaving as documented with symlinks and ..
Date 2018-07-30 14:48 +0300
Message-ID <mailman.4410.1532951294.1292.bug-bash@gnu.org> (permalink)

Show all headers | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale$
uname output: Linux hugo-agile 4.13.0-43-generic #48~16.04.1-Ubuntu SMP Thu
May 17 12:56:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

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).

I believe that pathcanon is correct, and that the problem is in
change_to_directory, when choosing between the canon and non-canon form.

Repeat-By:
See above.
Fix:

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


Thread

cd -L not behaving as documented with symlinks and .. Hugo Gabriel Eyherabide <hugogabriel.eyherabide@gmail.com> - 2018-07-30 14:48 +0300

csiph-web