This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients hynek, jcea, ncoghlan, neologix, pitrou, rosslagerwall, tarek
Date 2012-01-10.23:06:21
SpamBayes Score 2.30248e-06
Marked as misclassified No
Message-id <>
In-reply-to <>
Here's a patch with tests and documentation.
I noticed something surprising:
walk() with followlinks=False returns links to directories as
directories (in dirnames).
I find this surprising, since if you don't follow symlinks, those are
just files (and you don't recurse into it). Also, it's a pain when you
want to remove dirnames, since you have to distinguish between a link
and a directory (unlink()/rmdir() or unlinkat() without/with
To be consistent with this behavior, I had to change fdwalk() (I
renamed it to be consistent with fdlistdir()) to perform a call to
fstatat() without AT_SYMLINK_NOFOLLOW, since otherwise it would report
such links as files.
So the bottom line is that because of this, you can have up to 3
stat() calls per entry:
- fstatat(rootfd, name)
- fstatat(rootfd, name, AT_SYMLINK_NOFOLLOW) right before opening the directory
- fstat(dirfd) right after open to check that we're dealing with the same file
(walk() currently uses two stat() per entry, so it's not too bad).
File name Uploaded
fdwalk.diff neologix, 2012-01-10.23:06:20
Date User Action Args
2012-01-10 23:06:23neologixsetrecipients: + neologix, jcea, ncoghlan, pitrou, tarek, rosslagerwall, hynek
2012-01-10 23:06:21neologixlinkissue13734 messages
2012-01-10 23:06:21neologixcreate