zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: Re: cd -s symlink hangs (sometimes?)
Date: Sun, 22 Mar 2009 12:54:10 +0000	[thread overview]
Message-ID: <20090322125410.66a9d294@pws-pc> (raw)
In-Reply-To: <237967ef0903201615x72769fe4va86273c3fa07cb2e@mail.gmail.com>

On Sat, 21 Mar 2009 00:15:24 +0100
Mikael Magnusson <mikachu@gmail.com> wrote:
> For some more fun I tried this, and it does still break:
> mkdir a
> ln -s a b
> cd a
> chmod -x .
> cd -s $PWD:h/b
> #infinite loop here still

This is basically the same problem.  I'm not sure why when the directory
is restored wrongly and you end up in "/" you are seeing this infinite
loop and I'm not, but it may just be a side effect.

The problem is still the code I was scratching my head over before:

#ifdef HAVE_FCHDIR
    if (d->dirfd < 0 && (d->dirfd = open(".", O_RDONLY | O_NOCTTY)) < 0 &&
	zgetdir(d) && *d->dirname != '/')
	d->dirfd = open("..", O_RDONLY | O_NOCTTY);
#endif

It's now being executed, but we can't open "." any more.  So it's
failing to save a fchdir-able directory for restoring, so after the "cd
-s" fails we end up still in / again.

I'm not sure if there's a full fix for this.  It can probably be handled
better than it is at the moment, but apart from warning the user and
making sure the shell knows what directory it's actually in I'm
don't really know how.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  reply	other threads:[~2009-03-22 12:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-20 21:12 Mikael Magnusson
2009-03-20 22:48 ` Peter Stephenson
2009-03-20 23:15   ` Mikael Magnusson
2009-03-22 12:54     ` Peter Stephenson [this message]
2009-03-22 23:05       ` Mikael Magnusson
2009-03-23 10:49         ` Peter Stephenson
2009-03-23 11:46           ` Mikael Magnusson
2009-03-23 12:27             ` Peter Stephenson
2009-03-24 12:46               ` Peter Stephenson
2009-03-24 15:15                 ` Bart Schaefer
2009-03-24 16:02                   ` Peter Stephenson
2009-04-06 11:07                 ` Mikael Magnusson
2009-04-06 11:13                   ` Peter Stephenson
2009-03-23 15:18       ` Bart Schaefer
2009-03-23 15:39         ` 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=20090322125410.66a9d294@pws-pc \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@sunsite.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).