You are not logged in.

#1 2009-09-02 14:09:47

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

(bash) ".." when $(pwd -L) != $(pwd -P)

If I do this:

$ mkdir -p test/alpha/one test/alpha/two test/beta/three test/beta/four; cd test

$ ln -s ../beta/three alpha/three

$ cd alpha; ls -l
total 8
drwxr-xr-x 2 jim users 4096 2009-09-02 10:03 one
lrwxrwxrwx 1 jim users   13 2009-09-02 10:03 three -> ../beta/three
drwxr-xr-x 2 jim users 4096 2009-09-02 10:03 two

$ cd three

$ pwd -L
/home/jim/test/alpha/three

$ pwd -P
/home/jim/test/beta/three

$ cd ..; pwd -P
/home/jim/test/alpha

all good. But now if I continue:

$ cd three; ls ..
four  three

$ cd ../[TAB]
# only ../three/ is presented as an option

In other words, ".." in "ls .." refers to the parent of $(pwd -P). And I don't know what's going on with "cd ../[TAB]": we seem not to be getting the completion you'd expect for either test/alpha or test/beta.

Maybe it's always been this way? But my muscle memory/subconscious expectations keep reacting to this, as though it's a new change. Did this work different in bash 3.*? Is there some environment variable or shell option I can set to get ".." always referring to the parent of $(pwd -L) rather than the parent of $(pwd -P)? I think in the filesystem ".." is a hard link to the parent of $(pwd -P), but the way this has recently been surprising me so often makes me think my shell used to interpret ".." differently (as it does with a bare "cd ..").

Or am I just delusional?

Offline

#2 2009-09-02 15:07:39

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: (bash) ".." when $(pwd -L) != $(pwd -P)

This doesn't happen for me:

$ cd ../[TAB]
# only ../three/ is presented as an option

Otherwise, zsh seems to tab-complete .. on $(pwd -L)/../, and bash on $(pwd -P)/../

Offline

#3 2009-09-02 15:21:09

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: (bash) ".." when $(pwd -L) != $(pwd -P)

Thanks procyon. Would you mind posting the results of "shopt; shopt -o" in bash? That might help me figure out what's going on with my completion.

Offline

#4 2009-09-02 15:30:26

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: (bash) ".." when $(pwd -L) != $(pwd -P)

Offline

#5 2009-09-02 15:52:31

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: (bash) ".." when $(pwd -L) != $(pwd -P)

Thanks; OK, the difference between the tab-completion behavior we see isn't due to any shell option. Even when I make mine the same as yours,

cd test/alpha/three
cd ../[TAB]

is still only showing me "three" as a possible completion. Whereas:

cd test/alpha/two
cd ../[TAB]

is showing all of one, two, and three (as you'd expect).

So still stumped. But thanks for your assist.

Offline

#6 2009-09-02 16:09:42

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: (bash) ".." when $(pwd -L) != $(pwd -P)

I also have this in .inputrc:

set show-all-if-ambiguous on
set visible-stats on
set mark-directories on
set completion-query-items 200
set completion-ignore-case on
set page-completions off
set print-completions-horizontally off
set horizontal-scroll-mode off

Offline

#7 2009-09-02 16:16:09

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: (bash) ".." when $(pwd -L) != $(pwd -P)

I added all of those to end of my .inputrc and opened a new terminal, but still same behavior. I'm trying this both with login shells (which I don't get by default, with my urxvt setup), and non-login shells (which I do get by default). Just in case that's relevant.

Still stumped...

Offline

Board footer

Powered by FluxBB