Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
pwd -r odd failure mode
- X-seq: zsh-workers 2618
- From: Zefram <zefram@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Z Shell workers mailing list)
- Subject: pwd -r odd failure mode
- Date: Mon, 23 Dec 1996 19:59:43 +0000 (GMT)
-----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-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author