Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 227168 - pwd fails to traverse unreadable directory
Summary: pwd fails to traverse unreadable directory
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 6
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
: 243120 (view as bug list)
Depends On:
Blocks: FC7Target
TreeView+ depends on / blocked
 
Reported: 2007-02-02 21:35 UTC by Dmitry V. Levin
Modified: 2008-12-11 18:13 UTC (History)
3 users (show)

Fixed In Version: 6.9-2.fc7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-05-09 16:08:51 UTC


Attachments (Terms of Use)

Description Dmitry V. Levin 2007-02-02 21:35:19 UTC
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-03 00:38:05 UTC
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 11:36:17 UTC
The fix works, thanks.

Comment 3 Tim Waugh 2007-06-07 13:02:48 UTC
*** Bug 243120 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.