zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: "ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: Re: PATCH: 3.1.6-test-1: strange cd behaviour
Date: Thu, 15 Jul 1999 14:23:26 +0200	[thread overview]
Message-ID: <9907151223.AA35531@ibmth.df.unipi.it> (raw)
In-Reply-To: ""Andrej Borsenkow""'s message of "Thu, 15 Jul 1999 15:57:59 DFT." <000901beceb9$48b6be40$21c9ca95@mow.siemens.ru>

"Andrej Borsenkow" wrote:
> Yes. Completely remove this. If current dir no more exists, the error message
> here is more of a feature - it indicates, that somethig went wrong. User alwa
> ys
> has ``cd'' or even ``cd /'' fallback. I'm afraid, in this case zsh oversmarts
> itself.  And after all, with all symlinks around, you cannot even be sure, th
> at
> $PWD is prefix of current dir :-( (Our /bin/sh resolves links while /bin/ksh
> does not).

Actually, that's not completely removing it, that's including about half
the code, just not the stuff that allows the PWD to be backtracked
automatically.  (Unless you are suggesting going back to not testing for a
non-existent directory at all?  But then you don't get the error message
with `cd ..'.)

Furthermore, whether PWD is a prefix of the *physical* current directory is
a different issue entirely, depending on the option CHASELINKS.  Without
that set, zsh will always try to turn $PWD/.. into ${PWD:h}, wherever that
lands you up.  The issue here is whether to check for the existence of
$PWD/.. in the former case, as soon as it sees the .. .

Which opens another kettle of fish: if the .. is not at the end, then
/foo/bar/../rod might not be the same physical path as /foo/rod.  So if you
are in /foo/bar, and that is a symbolic link to somewhere not under foo,
and you try to change to /foo/rod by `cd ../rod', then without the bit of
laxity I added allowing backing up $PWD regardless of existence, cd ../rod
will fail, which I don't think is on, since if CHASELINKS is not set this
is just the sort of behaviour you expect to work --- note that this works
in ksh, too.  (Although with AUTOCD `../rod' on its own already fails,
because it tests for a physical directory, since cancd() doesn't call
fixdir() --- anyone want that fixed?)

It's now true that if you do `cd bar/../rod' and bar is a symlink, then
this won't work because of the test I added --- it stat's bar/../rod which
looks for rod in the physical parent of the directory to which bar points.
Maybe this is already going too far when CHASELINKS is unset.  (I could
change it to stat every occurrence of <dir>/.. , which was my first thought,
and which should get round this.)

So the options seem to be: as it was or as it is now, the halfway house
breaks too much when the current directory is a link.  Zsh has been
oversmart with directories all its life.

Any more suggestions?  I could maybe make it more stringent when CHASELINKS
is not set --- but that's increasing the complexity still further.  I would
be perfectly happy to back off the patch altogether, too.

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


  reply	other threads:[~1999-07-15 12:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
1999-07-15 15:56             ` Peter Stephenson
1999-07-15 17:27             ` Bart Schaefer
1999-07-16 10:14               ` PATCH: 3.1.6-test-1: remorselessly " Peter Stephenson

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=9907151223.AA35531@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --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).