This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: lstat on FAT - Was: Problem with find on FAT drives
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
Index: src/winsup/cygwin/path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.288
diff -u -r1.288 path.cc
--- src/winsup/cygwin/path.cc 21 Feb 2004 04:46:00 -0000 1.288
+++ src/winsup/cygwin/path.cc 24 Mar 2004 19:33:34 -0000
@@ -190,7 +190,7 @@
All duplicate /'s, except for 2 leading /'s, are deleted.
The result is 0 for success, or an errno error value. */
-#define isslash(c) ((c) == '/')
+#define isslash(c) ((c) == '/' || (c) == '\\' )
static int
normalize_posix_path (const char *src, char *dst)
--
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/