-
Notifications
You must be signed in to change notification settings - Fork 17.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
path/filepath: Glob is case-sensitive on Windows #5441
Comments
Comment 2 by me@conradz.com: See http://msdn.microsoft.com/en-us/library/ee681827%28v=vs.85%29.aspx for a summary of the different file systems on Windows, and which are case-sensitive. Also note that NTFS can be case-sensitive or insentive, depending on the global OS settings. UDF is the only common file system on Windows that is always case-sensitive. Making Windows case-insensitive would take care of 99.9% of cases, but there would be a few edge cases. |
I think Russ's argument does not fly here. Whe have an issue here where Go program cannot find file that is there. It is irrelevent what file system capabilities are, since win32 api (we use it to access os services) makes them all look case insensitive. From http://support.microsoft.com/kb/100625: "... The difference in behavior noted here applies only when an application needs to locate an existing file. POSIX takes advantage of the full case sensitive mode, while MS-DOS, WOW, and Win32 subsystems use the case insensitive mode. ..." I am yet to see a windows program that assumes case sensitive mode. Here is cmd.exe to demonstrate: C:\tmp\aaa>dir Volume in drive C has no label. Volume Serial Number is F582-OP83 Directory of C:\tmp\aaa 29/05/2013 09:16 AM <DIR> . 29/05/2013 09:16 AM <DIR> .. 0 File(s) 0 bytes 2 Dir(s) 115,812,872,192 bytes free C:\tmp\aaa>echo hello > a.txt C:\tmp\aaa>dir Volume in drive C has no label. Volume Serial Number is F582-OP83 Directory of C:\tmp\aaa 29/05/2013 09:16 AM <DIR> . 29/05/2013 09:16 AM <DIR> .. 29/05/2013 09:16 AM 8 a.txt 1 File(s) 8 bytes 2 Dir(s) 115,812,872,192 bytes free C:\tmp\aaa>echo hello2 > A.TXT C:\tmp\aaa>dir Volume in drive C has no label. Volume Serial Number is F582-OP83 Directory of C:\tmp\aaa 29/05/2013 09:16 AM <DIR> . 29/05/2013 09:16 AM <DIR> .. 29/05/2013 09:17 AM 9 a.txt 1 File(s) 9 bytes 2 Dir(s) 115,812,872,192 bytes free C:\tmp\aaa>dir *.txt Volume in drive C has no label. Volume Serial Number is F582-OP83 Directory of C:\tmp\aaa 29/05/2013 09:17 AM 9 a.txt 1 File(s) 9 bytes 0 Dir(s) 115,812,872,192 bytes free C:\tmp\aaa>dir *.TXT Volume in drive C has no label. Volume Serial Number is F582-OP83 Directory of C:\tmp\aaa 29/05/2013 09:17 AM 9 a.txt 1 File(s) 9 bytes 0 Dir(s) 115,812,872,192 bytes free C:\tmp\aaa>dir A.TXT Volume in drive C has no label. Volume Serial Number is F582-OP83 Directory of C:\tmp\aaa 29/05/2013 09:17 AM 9 a.txt 1 File(s) 9 bytes 0 Dir(s) 115,812,872,192 bytes free C:\tmp\aaa>dir a.txt Volume in drive C has no label. Volume Serial Number is F582-OP83 Directory of C:\tmp\aaa 29/05/2013 09:17 AM 9 a.txt 1 File(s) 9 bytes 0 Dir(s) 115,812,872,192 bytes free C:\tmp\aaa>type a.txt hello2 C:\tmp\aaa>type A.TXT hello2 C:\tmp\aaa>type A.txT hello2 C:\tmp\aaa>del a.txt C:\tmp\aaa>dir Volume in drive C has no label. Volume Serial Number is F483-CD2E Directory of C:\tmp\aaa 29/05/2013 09:24 AM <DIR> . 29/05/2013 09:24 AM <DIR> .. 0 File(s) 0 bytes 2 Dir(s) 115,812,839,424 bytes free C:\tmp\aaa>echo hello > A.TXT C:\tmp\aaa>dir Volume in drive C has no label. Volume Serial Number is F483-CD2E Directory of C:\tmp\aaa 29/05/2013 09:24 AM <DIR> . 29/05/2013 09:24 AM <DIR> .. 29/05/2013 09:24 AM 8 A.TXT 1 File(s) 8 bytes 2 Dir(s) 115,812,839,424 bytes free C:\tmp\aaa> IMO our current implementation behaives differently, and should be changed. Alex |
me@conradz.com, Can you see if https://golang.org/cl/9666048 fixes your problem, please? Thank you. Alex |
Comment 7 by me@conradz.com: Yes, the above change does work. Globs are case-insensitive on Windows with the change applied. |
I put some comments on https://golang.org/cl/9666048/ |
My proposed fix https://codereview.appspot.com/9666048 and all comments are lost now. The URL returns "No issue exists with that id (9666048)". As far as I remember my proposal was rejected and @rsc was going to send his own fix. I am not clear of rejection reason. As far as I recall I was not clear back then either. Perhaps it was to do with not wanting to import "unicode" package here. Alex |
Sorry about that. The transition to github was bumpy and lossy. |
You can find at least some of the info by searching for "9666048" on golang-dev and golang-codereviews. |
Yeah, it's still available in mailing list archives.
http://grokbase.com/t/gg/golang-dev/136n3jv86z/code-review-9666048-path-filepath-ignore-case-when-matching-on-windows-issue-9666048
|
Thank you for history search pointers. But, more importantly, I think we need to remove "Thinking" label off this issue. We need to decide what to do here. We might decide it is working as intended, then we should document that Glob search is case-sensitive. Or we might decide to change the code. Alex |
I just ran into this problem and wanted to ask if there is a decision for this? |
It seems too late to try to change this. It would require a lot of checking of whether a particular file system is case-sensitive. You'd have to check in every directory where you were evaluating wildcards, and I'm not even sure how to check. Do other languages attempt to do this? I know Python, Node, etc have globbing libraries. |
In the Python Each has their own implementation of It doesn't appear to take file system case sensitivity into account. |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
Is there any workaround for this? |
by me@conradz.com:
The text was updated successfully, but these errors were encountered: