zsh-workers
 help / color / mirror / code / Atom feed
* bad cd completion for ../ (with CHASE_DOTS unset)
@ 2004-08-30 13:03 Vincent Lefevre
  2004-09-01  9:16 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Lefevre @ 2004-08-30 13:03 UTC (permalink / raw)
  To: zsh-workers

Hi,

Here, CHASE_DOTS isn't set, and my /home/lefevre/Mail directory
contains the following symbolic link, in particular:

  arc -> /users/spaces/lefevre/Mail/arc/

Now, if I do a "cd .." from the /home/lefevre/Mail/arc directory,
I go to the /home/lefevre/Mail directory as expected. But if I try
to do a completion with "cd ../[TAB]", zsh gives the completions
corresponding to the subdirectories of /users/spaces/lefevre/Mail
instead of the subdirectories of /home/lefevre/Mail, though
CHASE_DOTS isn't set. I think this is a bug.

Zsh version: 4.2.1, and I'm using the new completion system.

Please Cc to me (the Mail-Followup-To should be set correctly).

Regards,

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
Championnat International des Jeux Mathématiques et Logiques, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bad cd completion for ../ (with CHASE_DOTS unset)
  2004-08-30 13:03 bad cd completion for ../ (with CHASE_DOTS unset) Vincent Lefevre
@ 2004-09-01  9:16 ` Bart Schaefer
  2004-09-01 12:01   ` Vincent Lefevre
  2004-09-01 13:00   ` Vincent Lefevre
  0 siblings, 2 replies; 5+ messages in thread
From: Bart Schaefer @ 2004-09-01  9:16 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: zsh-workers

I'm having a serious case of deja-vu over this ... I'm sure I explained 
this before, and not that long ago, but I can't find the message anywhere.

On Mon, 30 Aug 2004, Vincent Lefevre wrote:

> Here, CHASE_DOTS isn't set, and my /home/lefevre/Mail directory contains 
> [a] symbolic link [...] if I try to do a completion with "cd ../[TAB]", 
> zsh gives the completions corresponding to the subdirectories of 
> /users/spaces/lefevre/Mail instead of the subdirectories of 
> /home/lefevre/Mail, though CHASE_DOTS isn't set. I think this is a bug.

The trouble is that completion uses globbing to find the possible matching 
files, and globbing always behaves the way "cd" does with CHASE_LINKS set.

You might think that the fix is as easy as deleting "parent/.." substrings 
and replacing a leading "../" with "$PWD:h/", but the way the completion 
code is structured makes that a tricky proposition ... I don't think there 
is any variable whose value can be changed in _cd that remains visible 
down in _path_files when it starts decomposing the path at slashes and 
examining each directory ... and even if there is, doing so would probably 
generate some strange completions.

That means the only "fix" is putting a fairly ugly special-case into 
_path_files that applies only to _cd, without breaking every other path 
completion in the world.  Sven W. is incommunicado and no one else has 
been brave enough to plunge into the jungle with a machete.

(I've always thought CHASE_LINKS ought to be the one and only behavior.)

A possible workaround is to insert another function into your completer 
style, which acts as an expander to do the above-mentioned replacements on
the current word.  Thus you'd have this sort of behavior:

zsh% cd ~/Mail/arc
zsh% cd ../<TAB>
zsh% cd ~/Mail/

That is, you'd have to press TAB once to get the expansion before you can
start completing.

> Please Cc to me (the Mail-Followup-To should be set correctly).

Chortle.  Quite a, shall we say, discussion about M-F-T is in progress on 
one of the IETF lists the last couple of days.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bad cd completion for ../ (with CHASE_DOTS unset)
  2004-09-01  9:16 ` Bart Schaefer
@ 2004-09-01 12:01   ` Vincent Lefevre
  2004-09-01 13:00   ` Vincent Lefevre
  1 sibling, 0 replies; 5+ messages in thread
From: Vincent Lefevre @ 2004-09-01 12:01 UTC (permalink / raw)
  To: zsh-workers

On 2004-09-01 02:16:37 -0700, Bart Schaefer wrote:
> I'm having a serious case of deja-vu over this ... I'm sure I
> explained this before, and not that long ago, but I can't find the
> message anywhere.
[...]

Thanks for the explanation. The completion behavior should probably
be mentioned in the zshoptions(1) man page.

> (I've always thought CHASE_LINKS ought to be the one and only behavior.)

Hmm... yes, I'll change that, more because it is a security hole
(as one may easily think to be on a wrong device) than anything
else. Shouldn't CHASE_LINKS be set by default?

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
Championnat International des Jeux Mathématiques et Logiques, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bad cd completion for ../ (with CHASE_DOTS unset)
  2004-09-01  9:16 ` Bart Schaefer
  2004-09-01 12:01   ` Vincent Lefevre
@ 2004-09-01 13:00   ` Vincent Lefevre
  2004-09-01 15:01     ` Bart Schaefer
  1 sibling, 1 reply; 5+ messages in thread
From: Vincent Lefevre @ 2004-09-01 13:00 UTC (permalink / raw)
  To: zsh-workers

On 2004-09-01 02:16:37 -0700, Bart Schaefer wrote:
> I'm having a serious case of deja-vu over this ... I'm sure I
> explained this before, and not that long ago, but I can't find the
> message anywhere.

FYI, there was a similar problem I noticed in the past:

  http://www.zsh.org/mla/users/2002/msg00180.html

Perhaps you were thinking about this one?

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
Championnat International des Jeux Mathématiques et Logiques, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bad cd completion for ../ (with CHASE_DOTS unset)
  2004-09-01 13:00   ` Vincent Lefevre
@ 2004-09-01 15:01     ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2004-09-01 15:01 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: zsh-workers

On Wed, 1 Sep 2004, Vincent Lefevre wrote:

>   http://www.zsh.org/mla/users/2002/msg00180.html
> 
> Perhaps you were thinking about this one?

No, I'm sure it was specifically about completion.  I must just have been
writing to someone off-list.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-09-01 15:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-30 13:03 bad cd completion for ../ (with CHASE_DOTS unset) Vincent Lefevre
2004-09-01  9:16 ` Bart Schaefer
2004-09-01 12:01   ` Vincent Lefevre
2004-09-01 13:00   ` Vincent Lefevre
2004-09-01 15:01     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).