-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
os: Getwd doesn't return canonical case of current directory on macOS #20947
Comments
I cannot reproduce.
It's not clear from your bug report which output you expect from which directory. |
I've updated the original comment with a more straightforward example - https://play.golang.org/p/QmTFAiLcL4. I expect it to return the same actual filepath regardless of the way it is edit - I imagine there's a reason for it, but moving this block below the syscall one below it, should resolve this. For now, a workaround is to use |
Both answers are equally correct, osx's hfs+ is by default case preserving
case insensitive.
…On Sat, 8 Jul 2017, 05:01 Brad Fitzpatrick ***@***.***> wrote:
I cannot reproduce.
ward5k:foobar bradfitz$ mkdir /tmp/FooBar
ward5k:foobar bradfitz$ cd /tmp/FooBar/
ward5k:foobar bradfitz$ curl --silent https://play.golang.org/p/Yqk90j5ud5.go > getwd.go
ward5k:FooBar bradfitz$ go run getwd.go
/private/tmp/FooBar
/tmp/FooBar
ward5k:FooBar bradfitz$ cd /tmp/foobar
ward5k:foobar bradfitz$ go run getwd.go
/private/tmp/FooBar
/tmp/foobar
ward5k:foobar bradfitz$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.5
BuildVersion: 16F73
It's not clear from your bug report which output you expect from which
directory.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#20947 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA_dJFGgIfXeUFnOK7KDuG2xF2S-Hks5sLoCegaJpZM4ORTdj>
.
|
@glinton have you ran into a, possibly, edge case where this is an issue? |
@henvic (from the 'What did you do?' section of the original issue)
So we end up getting |
I have the same issue. I use Go version 1.9. |
I think this is enough of a special case that we aren't going to try to address it. Using |
What version of Go are you using (
go version
)?go version go1.8.3 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
This may very well be an issue for mac regarding the case sensitivity of their nfs server, but here goes. We have a utility that adds an entry to
/etc/exports
by grabbing the current directory:os.Getwd()
. Window's case insensitivity is handled becauseos.Getwd()
returnssyscall.Getwd()
on a mac, however, we get whatever the user typed on theircd
.On a darwin machine:
Build and run this code:
https://play.golang.org/p/Yqk90j5ud5https://play.golang.org/p/QmTFAiLcL4For the next two expect/result sections, this:
What did you expect to see?
Output of printing os.Getwd()
What did you see instead?
Output of printing os.Getwd()
The text was updated successfully, but these errors were encountered: