-
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
x/sys/windows/mkwinsyscall: IsStdRepo can be wrong when Go tree is inside a symlinked directory #44079
Comments
FWIW, that's #43862. |
I note that If propagating |
A more robust alternative might be to give |
Thank you for analyzing this Bryan. From local testing I've done earlier, I expect CL 287152 should be enough to fix the issue. |
That CL has been submitted, and I can confirm the reproduce steps I've provided in the original issue no longer reproduce it. However, I'm still running into this issue in a different context. I'll try to understand what's different and update this issue. |
Ok, removing WaitingForInfo, the problem was just that I was confused. This issue is now fixed (by the Closing because I don't see a need to do more at this point. (I agree that it would be more robust to give mkwinsyscall an explicit flag to indicate whether the package is in std, but we can defer that until there is a new reproducible problem and this needs more attention.) |
Change https://golang.org/cl/304449 mentions this issue: |
os.Getwd notes that if the current directory can be reached via multiple paths (due to symbolic links), Getwd may return any one of them. A way to ensure that the desired path is used is to set the PWD environment variable pointing to it. The go generate command has started to update the PWD environment variable as of CL 287152, which was the missing link previously resulting in mkwinsyscall misunderstanding whether it's inside the std lib when symbolic links are involved (issue 44079). Now all that's left is for us to also set the PWD environment variable when invoking the go command in the test, so that it too knows the intended working directory path to use. Fixes #44080. Updates #44079. Updates #43862. Change-Id: I65c9d19d0979f486800b9b328c9b45a1a3180e81 Reviewed-on: https://go-review.googlesource.com/c/go/+/304449 Trust: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
The
Source.IsStdRepo
method tries to report whether src is part of standard library. It can return an incorrect result when src is a part of standard library but the Go tree is inside a symlinked directory.To reproduce:
Filing this issue to determine if this can be fixed in the general case. There is a real possibility that it's infeasible due to the properties of symlinks.
It may also be relevant that
go generate
does not pass-through thePWD
env var to the process it invokes, which can help with preserving a consistentos.Getwd
result (but I haven't checked if changing that would be sufficient to handle the general case).CC @zx2c4, @alexbrainman, @bcmills.
The text was updated successfully, but these errors were encountered: