Issue 453515: filecmp.dircmp case sensitivity bug (original) (raw)

Created on 2001-08-20 21:39 by ving, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
filecmp.diff fdrake,2001-12-06 21:14 preliminary patch (untested)
Messages (6)
msg6093 - (view) Author: Rik Kabel (ving) Date: 2001-08-20 21:39
(warning: python newbie submission) Platforms: W2K w/Activestate 2.1.1 (same library source found in 2.0 and 2.11 on NetBSD). filecmp.dircmp performs incorrect filename comparisons when building lists of common and directory-unique files. In particular, it sets a dictionary key to the filename (and value to 1) for each file in the right-hand tree, and looks for matching names (has_key). This fails on case-insensitive platforms when the names are equivalent except for case. A simple workaround would be to use os.path.normcase() around the filenames before storing and comparing, but this is not case-preserving. Case preservation is to be preferred. A case-preserving workaround might use os.path.normcase() for the dictionary entry keys, but store the unchanged filename as the value, and use that value when constructing the list from the dictionary. -- Rik creating tomorrow's legacy systems, today
msg6094 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2001-08-28 15:34
Logged In: YES user_id=31392 Can you look at this, Paul?
msg6095 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-09-05 18:12
Logged In: YES user_id=6380 While this was reported as an ActivePython bug, the problem is the same with filecmp.py in CVS, so I'm unassigning this from Paul (it's not like Paul's track record of responding to bug reports is so great :-).
msg6096 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2001-12-06 21:14
Logged In: YES user_id=3066 I've attached a preliminary patch for this, completely untested. Problems: - We don't have any tests for the filecmp module. - Im not running Windows, so I can't test this in an environment similar to that for which the bug was reported. If someone can create a test case for this, and test the patch, that would really help.
msg6097 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2003-02-05 20:30
Logged In: YES user_id=11375 Snatching this bug. See bug #680494 for a test suite for filecmp.py. Once that's checked in, I'll look into this one.
msg6098 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-09-02 05:48
Logged In: YES user_id=80475 Fixed. See: Lib/filecmp.py 1.17 and 1.16.10.1 Lib/test/test_filecmp 1.3 and 1.2.8.1
History
Date User Action Args
2022-04-10 16:04:21 admin set github: 35015
2001-08-20 21:39:43 ving create