lstat on FAT - Was: Problem with find on FAT drives

Volker Quetschke quetschke@scytek.de
Wed Mar 24 22:50:00 GMT 2004


Hi Corinna,

>>Looks pretty similar to me, but I was looking for the following:
>>
>>$ ls -ldin .\\tmp ./tmp
>>2919335057    drwxr-xr-x 4 1006   513         0 Mar 10 13:06 ./tmp/
>>2805415844195 drwxr-xr-x 4 1006   513         0 Mar 10 13:06 .\tmp/
>>
>>I came to that "program" by reducing the find soure to the bare
>>minimum to show that problem.
>>
>>So again, is this an expected/tolerated behaviour?
> 
> Yes, it's by design.  The answer is "don't use DOS paths".
It's nice to be mean, isn't it?

Well, have a look at path.cc, there is a lot of useless code
that deals with this useless DOS paths. I bet it would
be a nice speed up if we would remove this cruft.

But serious, I was hoping for some pointers where to start searching
for that problem, but it wasn't difficult to find.

In the absence of inodes they are calculated as the hash of the
normalized filename, but somehow the normalization of the DOS
paths fails and therefore the example gives different inodes.

Why? Because, despite of the comment for normalize_posix_path
that says:

/* Normalize a POSIX path.
    \'s are converted to /'s in the process.
    All duplicate /'s, except for 2 leading /'s, are deleted.
    The result is 0 for success, or an errno error value.  */

the \'s are not always converted to /'s. Some \ are not
recogized because isslash(c) only triggers for /. With the
attached patch I get:

$ ls -ldin .\\tmp ./tmp
2919335057 drwxr-xr-x 4 1006  513             0 Mar 10 13:06 ./tmp/
2919335057 drwxr-xr-x 4 1006  513             0 Mar 10 13:06 .\tmp/

This repairs my find problem.

I didn't make extensive tests with this patch, but if DOS paths
are not deprecated I'm willing to do more testing.

Volker

P.S.: Cygwin is just a great toolkit, don't shoot someone because
he sometimes uses a strange configuration where he gets DOS paths.

-- 
PGP/GPG key  (ID: 0x9F8A785D)  available  from  wwwkeys.de.pgp.net
key-fingerprint 550D F17E B082 A3E9 F913  9E53 3D35 C9BA 9F8A 785D
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: path.cc.diff
URL: <http://cygwin.com/pipermail/cygwin/attachments/20040324/6351d30c/attachment.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list