[issue12464] tempfile.TemporaryDirectory.cleanup follows symbolic links
Charles-François Natali
report at bugs.python.org
Tue Jul 26 09:45:11 CEST 2011
Charles-François Natali <neologix at free.fr> added the comment:
> I agree with Antoine - it's a simple bug
Alright, in that case I agree (I thought this was considered as a
security issue).
Two comments on the patch:
Lib/tempfile.py:
# Don't recurse to symlinked directories (issue #12464)
Is it really necessary to indicate the issue reference here (there's
already version control, no need to tag the code itself)? It does make
sense in the test, though.
Lib/test/test_tempfile.py:
def test_cleanup_with_symlink_to_a_directory(self):
# cleanup() should not follow symlinks to directories (issue #12464)
[...]
# Symlink d1/foo -> d2
os.symlink(d2.name, os.path.join(d1.name, "foo"))
Does Windows have symlinks?
Looking at Modules/posixmodule.c, I'm not sure, and there seems to be
a version of os.symlink() that takes an argument indicating whether
the target is a directory or not.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12464>
_______________________________________
More information about the Python-bugs-list
mailing list