summaryrefslogtreecommitdiff
path: root/Lib/shutil.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-01-29 20:19:34 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2009-01-29 20:19:34 +0000
commit707c593761930016d00e7dbeb828e6f8c973622d (patch)
tree03960703f6c016656e44ec5bd1bc6a3d02f90a5c /Lib/shutil.py
parent6ed1cb001416d6704a5af0f7d8c00ce3e5413d96 (diff)
downloadcpython-git-707c593761930016d00e7dbeb828e6f8c973622d.tar.gz
Issue #2047: shutil.move() could believe that its destination path was
inside its source path if it began with the same letters (e.g. "src" vs. "src.new").
Diffstat (limited to 'Lib/shutil.py')
-rw-r--r--Lib/shutil.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py
index ae2c66cef1..cfb6646ad6 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -265,4 +265,10 @@ def move(src, dst):
os.unlink(src)
def destinsrc(src, dst):
- return abspath(dst).startswith(abspath(src))
+ src = abspath(src)
+ dst = abspath(dst)
+ if not src.endswith(os.path.sep):
+ src += os.path.sep
+ if not dst.endswith(os.path.sep):
+ dst += os.path.sep
+ return dst.startswith(src)