zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: Re: cd -s symlink hangs (sometimes?)
Date: Mon, 23 Mar 2009 15:39:26 +0000	[thread overview]
Message-ID: <200903231539.n2NFdQom005220@news01.csr.com> (raw)
In-Reply-To: <090323081809.ZM4297@torch.brasslantern.com>

Bart Schaefer wrote:
> Anyway, as best I can tell the reason for the open("..") is to cause
> an error to be returned from restoredir() later.  At the code above,
> if open(".") fails but zgetdir() succeeds, we can stat(".") but not
> read it.  So the code attempts to arrange that restoredir() will cd
> into a directory that we CAN read (".." in this case)

I don't think that's likely to work anyway, though...  if we can't
open(".") because of *directory* permissions, that means we won't be
able to open("..") either.  They're both just entries in the current
directory (that happen to have special meanings).  (It's because we can
only track up the hard-linked layout by laboriously opening the file
".."  in the current directory that it's all so complicated.)

> but leaves
> mismatched ino,dev information in the dirsave struct so restoredir()
> will return nonzero, causing lchdir() to return -2.

Presumably with similar effects to what we're seeing now,
i.e. mismatched diretories.  Sounds like another good reason for
completely rewriting the ("..")  thing.

> In the course of looking at this I think I've spotted another problem,
> which possibly only affects filesystems where a double slash at the
> root means something different (mainly Cygwin at this point).  Have a
> look at zchdir() and consider the consequences of passing it a file
> name consisting entirely of "/" characters repeated PATH_MAX+N times.

So if the initial chdir() fails, shouldn't we rewind the pointer to the
start (dir), then break out of the loop and return failure?  Or what
else?

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


      reply	other threads:[~2009-03-23 15:43 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
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 [this message]

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=200903231539.n2NFdQom005220@news01.csr.com \
    --to=pws@csr.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).