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

noreply@sourceforge.net noreply@sourceforge.net
Mon, 20 Aug 2001 14:39:44 -0700


Bugs item #453515, was opened at 2001-08-20 14:39
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=453515&group_id=5470

Category: Python Library
Group: Python 2.1.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Rik Kabel (ving)
Assigned to: Nobody/Anonymous (nobody)
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


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

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