From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3890 invoked from network); 23 Dec 1996 19:57:57 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 23 Dec 1996 19:57:57 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id OAA25031; Mon, 23 Dec 1996 14:58:42 -0500 (EST) Resent-Date: Mon, 23 Dec 1996 14:58:42 -0500 (EST) From: Zefram Message-Id: <4102.199612231959@stone.dcs.warwick.ac.uk> Subject: pwd -r odd failure mode To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Mon, 23 Dec 1996 19:59:43 +0000 (GMT) X-Patch: 148 X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]8619.16 X-US-Congress: Moronic fuckers Content-Type: text Resent-Message-ID: <"pK2vm1.0._66.nHklo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2618 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----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-----