-
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: Stat on a symlink fails when path has a trailing slash #27225
Comments
Does this only happen on Windows? |
Yes, as far as I found. |
/cc @alexbrainman |
@AudriusButkevicius thank you for reporting the issue. I will investigate when I have time. Alex |
Change https://golang.org/cl/134195 mentions this issue: |
SameFile opens file to discover identifier and volume serial number that uniquely identify the file. SameFile uses Windows CreateFile API to open the file, and that works well for files and directories. But CreateFile always follows symlinks, so SameFile always opens symlink target instead of symlink itself. This CL uses FILE_FLAG_OPEN_REPARSE_POINT flag to adjust CreateFile behavior when handling symlinks. As per https://docs.microsoft.com/en-us/windows/desktop/FileIO/symbolic-link-effects-on-file-systems-functions#createfile-and-createfiletransacted "... If FILE_FLAG_OPEN_REPARSE_POINT is specified and: If an existing file is opened and it is a symbolic link, the handle returned is a handle to the symbolic link. ...". I also added new tests for both issue #21854 and #27225. Issue #27225 is still to be fixed, so skipping the test on windows for the moment. Fixes #21854 Updates #27225 Change-Id: I8aaa13ad66ce3b4074991bb50994d2aeeeaa7c95 Reviewed-on: https://go-review.googlesource.com/134195 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change https://golang.org/cl/143578 mentions this issue: |
@AudriusButkevicius please try https://go-review.googlesource.com/c/go/+/143578 Does it fixes your problem? Thank you. Alex |
Never mind that. You will try when you can. Alex |
What version of Go are you using (
go version
)?go version go1.11 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Windows 10 with Developer mode enabled (allowing to create symlinks for unprivileged users)
What did you do?
Same issue between Stat and Lstat
What did you expect to see?
Stat to succeed, like it did in Go 1.10.4
What did you see instead?
Stat failed
The text was updated successfully, but these errors were encountered: