[ python-Bugs-919012 ] shutil.move can destroy files
SourceForge.net
noreply at sourceforge.net
Sat Jun 19 09:44:51 EDT 2004
Bugs item #919012, was opened at 2004-03-18 20:29
Message generated for change (Comment added) made by jlgijsbers
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: Open
Resolution: None
Priority: 5
Submitted By: Jeff Epler (jepler)
Assigned to: Nobody/Anonymous (nobody)
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: Johannes Gijsbers (jlgijsbers)
Date: 2004-06-19 15: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-19 02: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 13: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 19: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 19:25
Message:
Logged In: YES
user_id=31435
Attached Johannes's patch.
----------------------------------------------------------------------
Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-06-05 17: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