Date: Fri, 21 Nov 2003 01:28:03 +0300 (MSK) From: Dmitry Afanasiev <dima@KOT.SPb.Ru> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/59530: strange bug in /bin/sh Message-ID: <200311202228.hAKMS3JB086237@orion.ifmo.ru> Resent-Message-ID: <200311202230.hAKMULpc016605@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 59530
>Category: bin
>Synopsis: strange bug in /bin/sh
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Nov 20 14:30:20 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Dmitry Afanasiev
>Release: FreeBSD 4.9-RC i386
>Organization:
>Environment:
System: FreeBSD orion 4.9-RC FreeBSD 4.9-RC #31: Mon Oct 6 16:12:22 MSD 2003 root@orion:/usr/obj/usr/src/sys/MATPOCKuH i386
>Description:
If cd builted in /bin/sh called to directory with no permissions, current directory after this is is not valid.
>How-To-Repeat:
(!) Not from root:
$ mkdir test
$ cd test
$ mkdir noperm
$ chmod 0 noperm
$ cd noperm
cd: can't cd to noperm
$ pwd
/tmp/test/noperm
$ cd noperm
cd: can't cd to noperm
$ cd noperm
cd: can't cd to noperm
$ pwd
/tmp/test/noperm/noperm/noperm
$ ls
noperm
>Fix:
--- cd.c.orig Fri Nov 21 01:10:44 2003
+++ cd.c Fri Nov 21 01:10:02 2003
@@ -204,7 +204,7 @@
}
INTOFF;
- if (updatepwd(badstat ? NULL : dest) < 0 || chdir(curdir) < 0) {
+ if (chdir(curdir) < 0 || updatepwd(badstat ? NULL : dest) < 0) {
INTON;
return (-1);
}
But this path may be incorrect. :)
>Release-Note:
>Audit-Trail:
>Unformatted:
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311202228.hAKMS3JB086237>
