Red Hat Bugzilla – Bug 1278156
bash is inconsistent in respect to symlink followup
Last modified: 2016-05-23 02:33:04 EDT
Description of problem:
When user is in symlink pointing into directory, there is disparity between behaviour of bash completion and coreutils commands.
Situation [annotated find output]:
./b/c [target dir of symlink]
./c [symlink to absolute ./b/c]
after going into ./c, there is disparity - bash understands .. as original ./, coreutils as ./b.
Bash even tries to use './' in tab completion, but fails when you try to continue to for example ./a [as autocompletion understands a as a file, not as directory]
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create structure noted above
2. cd c
3a. cat ../[tab][tab] // now original ./ is displayed
3b. continue autocompletion with a // but it does not behave as directory but as a file [it is autocompleted with space after it - obviously wrong]
and as an illustration of coreutils behavior:
4. cat ../a/A // failure 'cat: ../a/A: No such file or directory'
5. cat ../../a/A // success
inlined in reproduction steps
autocompletion of ../ looks into ./b/ directory [to be consistent with the rest of utilities]
bash follows posix behaviour and it is not aware if the external commands repsect symbolic links in current working directory path.
To avoid this issue you can use 'cd' with '-P' switch, or use 'set -o physical' flag to by default use physical paths in bash.