Looking at case insensitivity - question
Jens Alfke
jens at mooseyard.com
Sun Apr 13 17:10:45 CDT 2008
On 13 Apr '08, at 1:51 PM, Paul Moore wrote:
> I can write a function to do this, but I think it needs to be
> expensive (walk up the filename, doing os.listdir at each level, to
> get the correct case for the name).
It's possible that on Mac OS X the standard system call realpath will
upper/lower-case the filename to match what's on disk. I'm not sure,
but it wouldn't be hard to write a little test program. Then it's a
question of whether there's a wrapper for realpath in the Python
library.
> 3. Is there a way I can check for a case-sensitive filesystem (I can't
> just check the system type - think of Windows filesystems mounted on
> Unix over Samba) to avoid the cost in this case?
I'm not an expert on this, but what I've gleaned is that it's
generally not possible for the file-sharing client to get all the
information. It doesn't just depend on the network protocol, but also
on the server's OS and the type of local filesystem on the volume
being served. (For example, an OS X box might be using NFS to serve
both case-sensitive and case-insensitive filesystems.
(For the same reason, you can't find out the restrictions on filename
lengths or character sets, because you can't tell whether the server's
local volume is formatted HFS, FAT, zfs, ext3, ISO9660 or whatever.)
I believe the best you can do is run some experiments on the
filesystem. For example, to test case-sensitivity, create a temporary
file .hg/xxx and then try to read .hg/XXX. (Obviously a robust check
will have to be more careful than that, but you get the idea.)
—Jens
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1875 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial/attachments/20080413/c48523cf/attachment.bin
More information about the Mercurial
mailing list