From: Zefram <zefram@dcs.warwick.ac.uk>
To: zsh-workers@math.gatech.edu (Z Shell workers mailing list)
Subject: pwd -r odd failure mode
Date: Mon, 23 Dec 1996 19:59:43 +0000 (GMT) [thread overview]
Message-ID: <4102.199612231959@stone.dcs.warwick.ac.uk> (raw)
-----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-----
next reply other threads:[~1996-12-23 19:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-12-23 19:59 Zefram [this message]
1996-12-26 3:45 ` Zoltan Hidvegi
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=4102.199612231959@stone.dcs.warwick.ac.uk \
--to=zefram@dcs.warwick.ac.uk \
--cc=zsh-workers@math.gatech.edu \
/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).