Author pitrou
Recipients eric.araujo, mrts, pitrou, rosslagerwall, tarek, teamnoir
Date 2011-01-05.15:21:16
SpamBayes Score 4.86201e-09
Marked as misclassified No
Message-id <1294240878.18.0.239867867805.issue4489@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for the patch.

There seems to be a race remaining here:

+        try:
+            if os.path.islink(path):
+                # symlinks to directories are forbidden, see bug #1669
+                raise OSError("Cannot call rmtree on a symbolic link")
+        except OSError:
+            onerror(os.path.islink, path, sys.exc_info())
+            # can't continue even if onerror hook returns
+            return
+        fd = os.open(path, os.O_RDONLY)

Someone could change `path` to be a symlink between the calls to islink() and open(). You probably need to stat the fd instead.

Some other things:
- if close() is meant to be a private helper, it should be named _close()
- instead of a bare "except" in close(), use "except EnvironmentError" or "except OSError"

I haven't looked at the tests yet.
History
Date User Action Args
2011-01-05 15:21:18pitrousetrecipients: + pitrou, tarek, eric.araujo, mrts, teamnoir, rosslagerwall
2011-01-05 15:21:18pitrousetmessageid: <1294240878.18.0.239867867805.issue4489@psf.upfronthosting.co.za>
2011-01-05 15:21:16pitroulinkissue4489 messages
2011-01-05 15:21:16pitroucreate