[ python-Bugs-919012 ] shutil.move can destroy files
SourceForge.net
noreply at sourceforge.net
Sat Jun 19 17:40:23 EDT 2004
Bugs item #919012, was opened at 2004-03-18 11:29
Message generated for change (Comment added) made by bcannon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=919012&group_id=5470
Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Jeff Epler (jepler)
Assigned to: Brett Cannon (bcannon)
Summary: shutil.move can destroy files
Initial Comment:
$ 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".
----------------------------------------------------------------------
>Comment By: Brett Cannon (bcannon)
Date: 2004-06-19 14:40
Message:
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.
----------------------------------------------------------------------
Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-06-19 06:44
Message:
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).
----------------------------------------------------------------------
Comment By: Brett Cannon (bcannon)
Date: 2004-06-18 17:03
Message:
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?
----------------------------------------------------------------------
Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-06-07 04:32
Message:
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.
----------------------------------------------------------------------
Comment By: Jeff Epler (jepler)
Date: 2004-06-05 10:46
Message:
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 "<stdin>", 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)
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2004-06-05 10:25
Message:
Logged In: YES
user_id=31435
Attached Johannes's patch.
----------------------------------------------------------------------
Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-06-05 08:08
Message:
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.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=919012&group_id=5470
More information about the Python-bugs-list
mailing list