bug-bash
[Top][All Lists]
Advanced

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

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


From: Hugo Gabriel Eyherabide
Subject: cd -L not behaving as documented with symlinks and ..
Date: Mon, 30 Jul 2018 14:48:09 +0300

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:


reply via email to

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