zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: 3.1.6-test-1: strange cd behaviour
Date: Wed, 14 Jul 1999 08:56:07 +0200 (MET DST)	[thread overview]
Message-ID: <199907140656.IAA10258@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Tue, 13 Jul 1999 19:29:02 +0400


Andrej Borsenkow wrote:

> (/tools/src  is in cdpath)
> 
> bor@itsrm2:/tools/src/zsh-3.1.6-test-1%> builtin cd zsh-3.1.6-test-1/..
> bor@itsrm2:/tools/src/zsh-3.1.6-test-1%> echo $?
> 0
> bor@itsrm2:/tools/src/zsh-3.1.6-test-1%> /bin/pwd
> /tools/src/zsh-3.1.6-test-1
> 
> That is, cd does not change directory and returns success. I have some scripts
> that do "cd /some/dir && rm -r ..." ahem ...

That's a bit tricky... you have either no `.' in your `cdpath', or it is 
before /tools/src, right?

The problem is that cd_do_chdir() calls cd_try_chdir() with all
elements from `cdpath' -- if cdpath contains no `.', it first calls
cd_try_chdir() for the current directory (always plus the argument
given to `cd'). Well, cd_try_chdir() builds the full path (directory
from `cdpath' or current directory and the argument) and then calls
fixdir() -- which reduces /foo/bar/baz/.. to /foo/bar. So if `.' is
tested first and you try to `cd' to `dir/..', `cd' will always decide to
go to the current directory -- i.e. do nothing.

So the workaround for now is to put a `.' at the end of `cdpath'.

Hm, should we just document this or change it -- and how?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~1999-07-14  6:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-14  6:56 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-07-13 15:29 Andrej Borsenkow
1999-07-14  8:06 ` Peter Stephenson
1999-07-14  8:47   ` Bart Schaefer
1999-07-14  9:15     ` Peter Stephenson
1999-07-14 12:32       ` PATCH: " Peter Stephenson
1999-07-15 11:57         ` Andrej Borsenkow
1999-07-15 12:23           ` Peter Stephenson
1999-07-15 17:27             ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199907140656.IAA10258@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).