Date: Wed, 19 Jun 2002 08:07:39 -0700 (PDT) From: Robert Jan <rj@xs4all.nl> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/39527: getcwd() and unreadable parent directory Message-ID: <200206191507.g5JF7dYU096490@www.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 39527 >Category: kern >Synopsis: getcwd() and unreadable parent directory >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jun 19 08:10:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Robert Jan >Release: 4.5-RELEASE >Organization: XS4ALL Internet >Environment: FreeBSD xs0.xs4all.nl 4.5-RELEASE-p3 FreeBSD 4.5-RELEASE-p3 #5: Tue Apr 23 10:22:45 CEST 2002 cor@xs0.xs4all.nl:/usr/src/sys/compile/XS0 i386 >Description: When working in a directory of which a parent directory is not readable to you, deleting a subdirectory in the current working directory seems to invalidate the directory cache, causing calls to getcwd() to fail with a Permission Denied error, which it did not before. stat()ing the full path to the current working directory seems to re-initialize the cache and solve the problem. stat()ing "." or the chdir() system call do not solve the problem. This bug was reproduced on FreeBSD 4.2, 4.5, 4.6-RC and 5.0-CURRENT. >How-To-Repeat: As root do: root# cd /tmp && mkdir -p foo/bar && chmod 711 foo && chown user foo/bar As user do: user$ cd /tmp/foo/bar user$ mkdir foo && rmdir foo user$ /bin/pwd pwd: .: Permission denied >Fix: user$ cd . user$ /bin/pwd /tmp/foo/bar It is the stat() call on /tmp/foo/bar that fixes the problem. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206191507.g5JF7dYU096490>