Bug 227168

Summary: pwd fails to traverse unreadable directory
Product: [Fedora] Fedora Reporter: Dmitry V. Levin <ldv>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6CC: jsuthan, meyering, psklenar
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 6.9-2.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-05-09 12:08:51 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 150225    

Description Dmitry V. Levin 2007-02-02 16:35:19 EST
Description of problem:
pwd and readlink (and probably others) fail to traverse unreadable directory.

Version-Release number of selected component (if applicable):
glibc-2.5-10.fc6
coreutils-5.97-12.3.fc6

Steps to Reproduce:
cd $TMPDIR && mkdir dir1 && cd dir1 && mkdir dir2 && cd dir2 && chmod a=x .. && { /bin/pwd; readlink -ev .; }

Actual results:
/bin/pwd: cannot open directory `..': Permission denied
readlink: .: Permission denied

Expected results:
$TMPDIR/dir1/dir2
$TMPDIR/dir1/dir2

Additional info:

$ strace -qe lstat,openat pwd  
lstat(".", {st_mode=S_IFDIR|0755, st_size=40, ...}) = 0
lstat("/", {st_mode=S_IFDIR|S_ISVTX|0755, st_size=460, ...}) = 0
openat(AT_FDCWD, "..", O_RDONLY)        = -1 EACCES (Permission denied)
lstat("/", {st_mode=S_IFDIR|S_ISVTX|0755, st_size=460, ...}) = 0
pwd: cannot open directory `..': Permission denied

$ strace -qe lstat,openat readlink -e .
lstat(".", {st_mode=S_IFDIR|0755, st_size=40, ...}) = 0
lstat("/", {st_mode=S_IFDIR|S_ISVTX|0755, st_size=460, ...}) = 0
openat(AT_FDCWD, "..", O_RDONLY)        = -1 EACCES (Permission denied)
Comment 1 Jim Meyering 2007-02-02 19:38:05 EST
Thanks again.
I've just fixed that upstream in gnulib:
  http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/9033
Comment 2 Dmitry V. Levin 2007-02-03 06:36:17 EST
The fix works, thanks.
Comment 3 Tim Waugh 2007-06-07 09:02:48 EDT
*** Bug 243120 has been marked as a duplicate of this bug. ***