From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: Re: cd -s symlink hangs (sometimes?)
Date: Mon, 6 Apr 2009 13:07:37 +0200 [thread overview]
Message-ID: <237967ef0904060407r657c3bfbp132ed4350e66524f@mail.gmail.com> (raw)
In-Reply-To: <20090324124612.26017e86@news01>
2009/3/24 Peter Stephenson <pws@csr.com>:
> On Mon, 23 Mar 2009 12:27:14 +0000
> Peter Stephenson <pws@csr.com> wrote:
>> On Mon, 23 Mar 2009 12:46:10 +0100
>> Mikael Magnusson <mikachu@gmail.com> wrote:
>> > 2009/3/23 Peter Stephenson <pws@csr.com>:
>> > Trying the patch now and it does stop the leak... but you didn't think
>> > this adventure was over yet, did you?
>>
>> No, I definitely want to fix the diagnostics and at the least the internal
>> setting of pwd when a cd fails, but I'm not sure what a neat way is.
>
> On top of this, I've found another pre-existing bug down to poorly thought
> out code structure, which may be something to do with the side effect
> Mikael was seeing: on failure, restoredir() could call upchdir()
> repeatedly because it thought it was doing a recursive glob since the "level"
> element wasn't initialised. I only got this sometimes with an optimised
> compilation; before, I was using a debug build which didn't show it up at
> all. I've now put the initialisation for a "struct dirsav" in a
> subroutine.
>
> For the diagnostics and pwd, I've just borrowed what the recursive handling
> in zsh/files does, which is cd to /, set pwd consistently, and report the
> error. This is at least much better; an algorithm for fixing up the
> current directory even better is a good deal more complicated and given you
> can't cd to the correct directory in this case it's not clear how useful it
> is. So I'm tempted to leave it at this.
>
> In addition to "cd -s", this may address theoretical problems with recursive
> globs under similar circumstances.
I wasn't able to make it happen, but is it possible that under some
circumstance, a command of the form
/unimportant/dir% ls **/*; rm -rf *
could now remove everything in my home directory?
--
Mikael Magnusson
next prev parent reply other threads:[~2009-04-06 11:07 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 [this message]
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=237967ef0904060407r657c3bfbp132ed4350e66524f@mail.gmail.com \
--to=mikachu@gmail.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).