zsh-workers
 help / color / mirror / code / Atom feed
* pwd -r odd failure mode
@ 1996-12-23 19:59 Zefram
  1996-12-26  3:45 ` Zoltan Hidvegi
  0 siblings, 1 reply; 2+ messages in thread
From: Zefram @ 1996-12-23 19:59 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----BEGIN PGP SIGNED MESSAGE-----

On some systems, pwd -r from a deleted directory can pick the first
pathname from the parent directory -- possibly a file -- and call that the
current directory.  The code responsible for this is a bit of zgetcwd()
that, if it fails to find the current directory's inode, reads the
directory again, accepting anything on the same device.  I don't see
how such an algorithm could ever produce a correct answer, and it isn't
commented, so just removing it seems sensible.  Does anyone know better?

 -zefram

      Index: Src/compat.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/compat.c,v
      retrieving revision 1.1.1.11
      diff -c -r1.1.1.11 compat.c
      *** Src/compat.c	1996/12/22 01:13:20	1.1.1.11
      --- Src/compat.c	1996/12/22 22:45:25
      ***************
      *** 166,184 ****
        		    goto match;
        	    }
        	}
      - 	closedir(dir);
      - 	dir = opendir(".");
      - 	while ((de = readdir(dir))) {
      - 	    char *fn = de->d_name;
      - 	    /* Ignore `.' and `..'. */
      - 	    if (fn[0] == '.' &&
      - 		(fn[1] == '\0' ||
      - 		 (fn[1] == '.' && fn[2] == '\0')))
      - 		continue;
      - 	    lstat(fn, &sbuf);
      - 	    if (sbuf.st_dev == dev)
      - 		goto match;
      - 	}
        	noholdintr();
        	closedir(dir);
        	return ztrdup(".");
      --- 166,171 ----

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMr27inD/+HJTpU/hAQHRQwP/VihCu3jo3QAZk41QG2UuooDakzMnFCoa
W4E1dhtEOt4J3PwjITlxPyzEcZLZZTjgVCEcSudCXPATzIiX35S54tOn3K6sJWid
j8vc+ssPQj1Ef9ZGlmNLRRD48CJ3qjXUxH++YvgYuobbtj+FEotmuMuVdB7rhCLh
DlY/IKgK5pQ=
=CGUm
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-12-26  3:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-23 19:59 pwd -r odd failure mode Zefram
1996-12-26  3:45 ` Zoltan Hidvegi

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).