stat casefolding problem

Andrei Vermel avermel at mail.ru
Sat Aug 2 16:55:00 CDT 2008


> XP Home SP2. For what it's worth, my console code page is 850.
> Can you confirm that your hg command isn't using cygwin? 
> If it is, that may affect things - I find cygwin too bizarre to 
> follow at times... :-)
Yes, my hg is not cygwin. Python is 2.4 - could this be the reason?

> I wonder if this is something to do with codepage differences
Hm. Mine is 866, but change to 850 didn't help.

> I can't see how your patch affects the results at all as all 
> you're altering is the caching - util.fspath should give the 
> same results either way.
Following happens on my kit.
_foldmap originally is set to {'bbb.txt': 'BBB.txt', 'aaa.txt': 'aaa.txt'}
When _normalize() is called with 'bbb.txt', this key is found and 'BBB.txt'
is returned, which then matched the manifest and bbb.txt appears unchanged
in stat output.
The same for 'AAA.txt' causes util.fspath() to get called. It correctly
returns 'AAA.txt', because that's what is on disk. This differs from
manifest, and stat displays '? AAA.txt'.

My patch causes 'AAA.txt' to be changed to 'aaa.txt' - that's what normcase
does on windows - and it is found in the _foldmap, so util.fspath() doesn't
get called, but 'aaa.txt' is returned. This matches the manifest.

Note that os.path.normcase(os.path.normpath(path)) is applied to map keys
when _foldmap is originally filled. When _foldmap is indexed in
_normalize(), apparently the same needs to be done.

Andrei



More information about the Mercurial-devel mailing list