[New-bugs-announce] [issue2047] shutil.destinsrc returns wrong result when source path matches beginning of destination path

André Fritzsche report at bugs.python.org
Fri Feb 8 07:15:38 CET 2008


New submission from André Fritzsche:

shutil.destinsrc(src,dst)

Checks if 'dst' starts with 'src', which can return a wrong result if
'dst' even starts with 'scr' but isn't really a subdirector of it. E.g.
(src=r'C:\data', dst=r'C:\data.old') returned true, although dst isn't a
subdirectory of src.

I tried to fix this creating the absolute paths of 'dst' and 'src'
appended the path seperator, if there wasn't one. Then did the check
again and now the result is correct.

See the diff file I've appended (and hopefully created correctly)

----------
components: Library (Lib)
files: shutil.diff
messages: 62193
nosy: computercrustie
severity: normal
status: open
title: shutil.destinsrc returns wrong result when source path matches beginning of destination path
type: behavior
versions: Python 2.4
Added file: http://bugs.python.org/file9389/shutil.diff

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2047>
__________________________________


More information about the New-bugs-announce mailing list