Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Thu, 12 Sep 2002 22:56:40 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com Subject: Re: Finding exact case of paths In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-684387517-1031885800=:19696" ---559023410-684387517-1031885800=:19696 Content-Type: TEXT/PLAIN; charset=US-ASCII On Thu, 12 Sep 2002, Igor Pechtchanski wrote: > On Fri, 13 Sep 2002, Paul Johnston wrote: > > > > Oh, I see, add a modifier similar to '-s', so that it verifies the case of > > > each element in the path... Yeah, that could work, something like: > > > -e, --exact-case print exact case of NAME > > > > Yep, exactly. Now, cygpath seems to generally not hit the filesystem - > > cygpath c:/complete/crap gives me /c/complete/crap so using that switch > > will necessarily involve a performance hit. Given that, I think I'm > > happy with my solution based on dirent/strcasecmp. I've attached a > > stand-alone utility that seems to work (just on cygwin paths), although > > it has the side effect of squishing down multiple slashes > > ///like////this//path down to /like/this/path. > > > > I think it would be ok to restrict --exact-case to cygwin paths. > > I don't think there's a need to search the directory yourself. Upon > browsing the cygpath code some more, I realized that it is doing exactly > what we need (i.e. convert to the exact path) when returning the system > directory (the '-S' flag). Quoting the code (cygpath.cc:396): > > case 'S': > GetSystemDirectory (buf, MAX_PATH); > FindFirstFile (buf, &w32_fd); > strcpy (strrchr (buf, '\\') + 1, w32_fd.cFileName); > break; > > So we can do the same trick with each filename when our option ('-e') is > in effect. I'm looking at a fix to cygpath now, and will submit a patch > as soon as I have it ready. > > On a separate note, I found that "cygpath -l -w " does not work on > my Win2k SP2 system, returning the same garbage (hex 20 FB 22 0a) > regardless of the path. Anyone else have that problem? Well, after further reading of the code and experimenting I've determined two things: 1) the '-l' option of cygpath works in the cvs HEAD, and 2) it does exactly what we need (thanks, Corinna). So we can use $(cygpath -u $(cygpath -l -w "$WINETC/$WFILE")) in the script. This would require people to upgrade to the new cygpath (which they would have to anyway, if they were to use the option we proposed), which means that this script can not be released before the next cygwin, but that is probably fine. New version and diff attached. Igor P.S. I'm racking my brain trying to figure out why -l didn't work for me in version 1.21 of cygpath, but did in version 1.22. As far as I could see, the only changes to cygpath were some added newlines... -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! It took the computational power of three Commodore 64s to fly to the moon. It takes a 486 to run Windows 95. Something is wrong here. -- SC sig file ---559023410-684387517-1031885800=:19696 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="make-etc-links.sh" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="make-etc-links.sh" IyEvYmluL3NoDQojLS0NCiMgQ3JlYXRlIHN5bWJvbGljIGxpbmtzIGZyb20g c29tZSAvZXRjIGZpbGVzIHRvIHRoZSBXaW5kb3dzIGVxdWl2YWxlbnRzDQoj LS0NCg0KRklMRVM9Imhvc3RzIHByb3RvY29scyBzZXJ2aWNlcyBuZXR3b3Jr cyINCg0KT1NOQU1FPWAvYmluL3VuYW1lIC1zYA0KV0lOSE9NRT1gL2Jpbi9j eWdwYXRoIC1XYA0KDQpjYXNlICIkT1NOQU1FIiBpbg0KICBDWUdXSU5fTlQq KSBXSU5FVEM9IiRXSU5IT01FL3N5c3RlbTMyL2RyaXZlcnMvZXRjIiA7Ow0K ICBDWUdXSU5fOSp8Q1lHV0lOX01FKikgV0lORVRDPSIkV0lOSE9NRSIgOzsN CiAgKikgDQogICAgZWNobyAiVW5rbm93biBzeXN0ZW0gdHlwZSAkT1NOQU1F OyBleGl0aW5nIiA+JjINCiAgICBleGl0IDANCiAgOzsNCmVzYWMNCg0KaWYg WyAhIC1kICIkV0lORVRDIiBdDQp0aGVuDQogIGVjaG8gIkRpcmVjdG9yeSAk V0lORVRDIGRvZXMgbm90IGV4aXN0OyBleGl0aW5nIiA+JjINCiAgZXhpdCAw DQpmaQ0KDQpmb3IgRklMRSBpbiAkRklMRVMNCmRvDQogIGlmIFsgISAtZSAi L2V0Yy8kRklMRSIgLWEgISAtTCAiL2V0Yy8kRklMRSIgXQ0KICB0aGVuDQog ICAgIyBXaW5kb3dzIG9ubHkgdXNlcyB0aGUgZmlyc3QgOCBjaGFyYWN0ZXJz DQogICAgV0ZJTEU9IiRXSU5FVEMvImBleHByIHN1YnN0ciAiJEZJTEUiIDEg OGANCiAgICBXRklMRT0kKGN5Z3BhdGggLXUgIiQoY3lncGF0aCAtdyAtbCAi JFdGSUxFIikiKQ0KICAgIC9iaW4vbG4gLXMgLXYgIiRXRklMRSIgIi9ldGMv JEZJTEUiDQogIGZpDQpkb25lDQoNCg0K ---559023410-684387517-1031885800=:19696 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="make-etc-links.sh-0.7-diff" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="make-etc-links.sh-0.7-diff" LS0tIG1ha2UtZXRjLWxpbmtzLnNoLTAuNwkyMDAyLTA5LTEyIDEzOjA1OjAy LjAwMDAwMDAwMCAtMDQwMA0KKysrIG1ha2UtZXRjLWxpbmtzLnNoCTIwMDIt MDktMTIgMjI6Mzc6MTYuMDAwMDAwMDAwIC0wNDAwDQpAQCAtMjgsOCArMjgs OSBAQCBkbw0KICAgaWYgWyAhIC1lICIvZXRjLyRGSUxFIiAtYSAhIC1MICIv ZXRjLyRGSUxFIiBdDQogICB0aGVuDQogICAgICMgV2luZG93cyBvbmx5IHVz ZXMgdGhlIGZpcnN0IDggY2hhcmFjdGVycw0KLSAgICBXRklMRT1gZXhwciBz dWJzdHIgIiRGSUxFIiAxIDhgDQotICAgIC9iaW4vbG4gLXMgLXYgIiRXSU5F VEMvJFdGSUxFIiAiL2V0Yy8kRklMRSINCisgICAgV0ZJTEU9IiRXSU5FVEMv ImBleHByIHN1YnN0ciAiJEZJTEUiIDEgOGANCisgICAgV0ZJTEU9JChjeWdw YXRoIC11ICIkKGN5Z3BhdGggLXcgLWwgIiRXRklMRSIpIikNCisgICAgL2Jp bi9sbiAtcyAtdiAiJFdGSUxFIiAiL2V0Yy8kRklMRSINCiAgIGZpDQogZG9u ZQ0KIA0K ---559023410-684387517-1031885800=:19696 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ---559023410-684387517-1031885800=:19696--