On 2021/08/21 17:55, Brian Inglis wrote:
On 2021-08-21 18:40, Thomas Wolff wrote:
>
>
> Am 21.08.2021 um 23:59 schrieb Ken Brown via Cygwin:
>> On 8/21/2021 4:15 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin
>> wrote:
>>> Hi,
>>> Please consider the following Cygwin session:
>>> $ cd ~
>> I don't know why bash completion suggests something different.  My
>> guess (and it's only a guess) is that bash completion takes a
>> shortcut for performance reasons.
---
   cd w/completion uses the physical path because completion
is an external "script", while "cd" alone uses bash's internal
"logical" dir.

> The symlink/.. confusion is a dreadful trap since Unix times.
> Unfortunately, bash completion does not consider path resolution, so
> if any, it's a bash completion bug.
---
   Not a bug or trap.  It is a user choice to have 'cd' use logical paths
instead of physical paths, whereas completion uses physical paths.

You can get physical paths w/cd with "set -P", but most people find
logical paths more friendly:

/tmp> ln -s .. foo
/tmp> cd foo            # really cd's into '/'
/tmp/foo> cd ..         # but logically '/tmp/foo'
/tmp> set -P            # turns on physical paths w/cd
/tmp> cd foo            # now cd 'foo' puts you in physical '/'
/> cd -                 # go back to last dir before 'cd'
/tmp> set +P            # turn off physical paths (logical back on)
/tmp> cd foo
/tmp/foo> cd ..
/tmp> rm foo

Or, as previously suggested.  One time usage w/param to 'cd'.
(Don't alias this, would be rather confusing)

Try using cd -P (via alias?) which may resolve physically if it works.
Otherwise enjoy the quirks of cd via symlinks and .. resolution after.

It's not just '..', but also when you 'cd' into a mounted
file system, then completion and other utils _may_
show you the contents of the dir the file system is mounted on.




--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to