[Python-bugs-list] [ python-Bugs-453515 ] filecmp.dircmp case sensitivity bug

SourceForge.net noreply at sourceforge.net
Mon Sep 1 23:48:13 EDT 2003


Bugs item #453515, was opened at 2001-08-20 16:39
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=453515&group_id=5470

Category: Python Library
Group: Python 2.1.1
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Rik Kabel (ving)
Assigned to: Raymond Hettinger (rhettinger)
Summary: filecmp.dircmp case sensitivity bug

Initial Comment:
(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


----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-09-02 00:48

Message:
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

----------------------------------------------------------------------

Comment By: A.M. Kuchling (akuchling)
Date: 2003-02-05 15:30

Message:
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.


----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-12-06 16:14

Message:
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.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-05 13:12

Message:
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 :-).


----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2001-08-28 10:34

Message:
Logged In: YES 
user_id=31392

Can you look at this, Paul?


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=453515&group_id=5470



More information about the Python-bugs-list mailing list