Issue 919012: shutil.move can destroy files (original) (raw)

Created on 2004-03-18 19:29 by jepler, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
shutil.diff akuchling,2004-06-05 15:10 Johannes's patch
shutil.diff tim.peters,2004-06-05 17:25 Patch from jlgijsbers
Messages (8)
msg20257 - (view) Author: Jeff Epler (jepler) Date: 2004-03-18 19:29
$ mkdir a; touch a/b; python2.3 -c 'import shutil; shutil.move("a", "a/c") $ ls -l a ls: a: no such file or directory The same problem exists on Windows, as reported by one "shagshag".
msg20258 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-06-05 15:08
Logged In: YES user_id=469548 Here's a patch (with tests) that disallows moving a directory inside itself altogether. I can't upload patches to SF, so here's a link to it on my homepage: http://home.student.uva.nl/johannes.gijsbers/shutil.diff.
msg20259 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2004-06-05 17:25
Logged In: YES user_id=31435 Attached Johannes's patch.
msg20260 - (view) Author: Jeff Epler (jepler) Date: 2004-06-05 17:46
Logged In: YES user_id=2772 I applied the attached patch, and got this exception: >>> shutil.move("a", "a/c") Traceback (most recent call last): File "", line 1, in ? File "/usr/src/cvs-src/python/dist/src/Lib/shutil.py", line 168, in move if is_destination_in_source(src, dst): TypeError: is_destination_in_source() takes exactly 3 arguments (2 given)
msg20261 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-06-07 11:32
Logged In: YES user_id=469548 Sorry, in my haste made a silly mistake. Removed 'self' from is_destination_in_source definition and uploaded new patch to previous location.
msg20262 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2004-06-19 00:03
Logged In: YES user_id=357491 I just checked the link to the diff, Johannes, and the diff says it was generated on June 5. Can you check to see if you did upload the newest version to the location?
msg20263 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-06-19 13:44
Logged In: YES user_id=469548 Yes, I did upload the newest version. The diff was generated on June 7, I just used the right copy of shutil.py this time (which I had already made on June 5).
msg20264 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2004-06-19 21:40
Logged In: YES user_id=357491 Tweaked the function name and made the test clean up the temp directory; checked in as rev. 1.29 for Lib/shutil.py and rev. 1.3 for Lib/ test/test_shutil.py on HEAD. Checked in on 2.3 as rev. 1.28.10.1 and rev. 1.2.8.1. Thanks, Johannes.
History
Date User Action Args
2022-04-11 14:56:03 admin set github: 40046
2004-03-18 19:29:00 jepler create