case sensitivity on Windows

John Arbash Meinel john at arbash-meinel.com
Wed Oct 8 14:34:20 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark Hammond wrote:
> Alex's recent post reminded me of some other case-sensitivity issues on
> Windows I've struck.  Consider:
> 

...

> I'm fairly sure this is a bug, but I've no real idea where!  Maybe a bug in
> 'add'?  Is there a document which describes how bzr is supposed to work in a
> Windows file-system, or any other reference point for working out if this is
> considered a problem, and if so, where that problem lies?
> 
> Thanks,
> 
> Mark

So the basic issue is that "add" takes user-arguments, and doesn't have
a way to "canonicalize" them. I believe if we dropped down into Win32
API calls, we might be able to.

Specifically, what we do right now for "bzr add foo" is something like:

st = os.lstat(user_path)
if is_dir(st):
  add_dir(user_path)
...

What we would *like* is something like:

st = os.lstat(user_path)
real_name = st.name
if is_dir(st):
  add_dir(real_name)


I'm guessing that the FindFiles api actually *does* have a way to give
you the real name. Because it actually is doing a search, rather than
just returning a single entry.

However, we run into this on Mac as well, and there isn't a win32 api there.

There is a pretty well defined area in 'add' where we could do this sort
of work, when we validate the user's arguments.

bzrlib/mutabletree.py around line 343:

# validate user file paths and convert all paths to tree
# relative : it's cheaper to make a tree relative path an abspath
# than to convert an abspath to tree relative.
for filepath in file_list:
    rf = _FastPath(self.relpath(filepath))

^- If at that point, we could turn "filepath" into the real name on
disk, we would prevent bogus data later.

On a side point, 'commit' also needs to be fixed, because it will probe
for the state of "foo" and Windows is perfectly happy returning the
information for "Foo" at that time.

See the other discussion thread with Alexander about "iter_changes". The
best way *I* can see to fix commit, is to work in terms of "list_dir()"
which gives the real paths, rather than poking at things directly with
"lstat()".

Note that we'll probably run into some small issues wrt unversioned
files, but it should be a step in the right direction.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjsttwACgkQJdeBCYSNAAN6MQCfU1n85RfzM1zBNL7muSKXMC/d
6JcAn1PvhFRYiJrmjxw+l9e6UxP+EiRd
=yXMv
-----END PGP SIGNATURE-----



More information about the bazaar mailing list