-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/go: lowercase package directory comparison is wrong #25878
Comments
CL in question is https://golang.org/cl/109235 . |
|
/cc @alexbrainman @bradfitz (from the CL) |
Change https://golang.org/cl/118738 mentions this issue: |
send reply to the issue:
Why CL 109235 is not correct behavior? Do you know of a setup where TestCDAndGOPATHAreDifferent fails? I did some experiment at home. I have Linux computer that runs Samba software, that allows some Linux directories accessible to Windows computers on the network. so I created directory with 2 sub-directories having same name, just different case, and have different contents. Just like:
And then I mounted that directory on my Windows computer. That is what I see:
cmd.exe uses same API as Go programs do, so Go programs will see exactly the same thing. Something https://blogs.msdn.microsoft.com/commandline/2018/02/28/per-directory-case-sensitivity-and-wsl/ I have found while googling for this issue. Perhaps it is related. Alex |
The original CL 109235 was addressing a real bug (in its commit message) but the problem is not that the pattern match algorithm was wrong. The problem is that the pattern going into the match was wrong. Bad inputs not bad outputs. I'll take a look at an alternate fix for that real issue. |
Change https://golang.org/cl/129059 mentions this issue: |
https://golang.org/cl/109235 changed the meaning of directory patterns to do case-insensitive matches on Windows. This is not correct behavior. Maybe it is slightly more correct than not, but it's still wrong. I believe that Windows can have case-sensitive file systems, and certainly there are other systems with case-insensitive file systems (most Macs, for example). The general solution can't be to use strings.EqualFold based on runtime.GOOS.
I suspect the answer is to do something like
but I am not sure whether os.SameFile works on directories on Windows.
Does anyone know?
The text was updated successfully, but these errors were encountered: