delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/24/14:54:34

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <4061E702.1040705@scytek.de>
Date: Wed, 24 Mar 2004 14:52:34 -0500
From: Volker Quetschke <quetschke AT scytek DOT de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: lstat on FAT - Was: Problem with find on FAT drives
References: <Pine DOT LNX DOT 4 DOT 44 DOT 0403231316380 DOT 32093-100000 AT ashi DOT FootPrints DOT net> <4060B627 DOT 8000400 AT scytek DOT de> <20040324155332 DOT GF17229 AT cygbert DOT vinschen DOT de>
In-Reply-To: <20040324155332.GF17229@cygbert.vinschen.de>
X-Scanned-By: MIMEDefang 2.39
X-IsSubscribed: yes

--------------070409000000010806040303
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------070409000000010806040303
Content-Type: text/plain;
 name="path.cc.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="path.cc.diff"

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)


--------------070409000000010806040303
Content-Type: text/plain; charset=us-ascii

--
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/
--------------070409000000010806040303--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019