Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: cd -s symlink hangs (sometimes?)



On Mon, 23 Mar 2009 12:46:10 +0100
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> 2009/3/23 Peter Stephenson <pws@xxxxxxx>:
> 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.

> zsh -f
> % chmod -x .
> % cd -s /nonexisting
> cd: no such file or directory: /nonexisting
> % ls
> ls: write error: Bad file descriptor

That was finger trouble:  parentheses in the wrong place.

Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.217
diff -u -r1.217 utils.c
--- Src/utils.c	23 Mar 2009 10:58:57 -0000	1.217
+++ Src/utils.c	23 Mar 2009 12:21:25 -0000
@@ -5423,7 +5423,7 @@
 #ifdef HAVE_FCHDIR
     if (d->dirfd < 0) {
 	close_dir = 1;
-        if ((d->dirfd = open(".", O_RDONLY | O_NOCTTY) < 0) &&
+        if ((d->dirfd = open(".", O_RDONLY | O_NOCTTY)) < 0 &&
 	    zgetdir(d) && *d->dirname != '/')
 	    d->dirfd = open("..", O_RDONLY | O_NOCTTY);
     }

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



Messages sorted by: Reverse Date, Date, Thread, Author