From owner-freebsd-bugs Wed Jun 19 8:11:19 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2D4D137B4F4 for ; Wed, 19 Jun 2002 08:10:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5JFA2p17994; Wed, 19 Jun 2002 08:10:02 -0700 (PDT) (envelope-from gnats) Received: from nwww.freebsd.org (www.FreeBSD.org [216.136.204.117]) by hub.freebsd.org (Postfix) with ESMTP id E736B37B487 for ; Wed, 19 Jun 2002 08:07:39 -0700 (PDT) Received: from www.freebsd.org (localhost [127.0.0.1]) by nwww.freebsd.org (8.12.2/8.12.2) with ESMTP id g5JF7dhG096491 for ; Wed, 19 Jun 2002 08:07:39 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.2/8.12.2/Submit) id g5JF7dYU096490; Wed, 19 Jun 2002 08:07:39 -0700 (PDT) Message-Id: <200206191507.g5JF7dYU096490@www.freebsd.org> Date: Wed, 19 Jun 2002 08:07:39 -0700 (PDT) From: Robert Jan To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: kern/39527: getcwd() and unreadable parent directory Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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