-
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
os: SameFile doesn't handle invalid file IDs on Windows #62042
Comments
The root cause is the following: even if the file system supports file IDs, there are some files which, for whatever reason, don't have one assigned. MS-FSCC 2.1.7 specify how to handle this cases:
Fixing this is not as straightforward as it seems, because we still want, for example, that
|
Change https://go.dev/cl/543815 mentions this issue: |
Change https://go.dev/cl/543835 mentions this issue: |
Change https://go.dev/cl/574155 mentions this issue: |
On Windows, File.readdir currently fails if the volume information can't be retrieved via GetVolumeInformationByHandle and if the directory path is relative and can't be converted to an absolute path. This change makes readdir more robust by not failing in these cases, as these steps are just necessary to support a potential call to os.SameFile, but not for the actual readdir operation. os.SameFile will still fail in these cases, but that's a separate issue tracked in #62042. Change-Id: I8d98d8379bdac4b2832fa433432a5f027756abaa Reviewed-on: https://go-review.googlesource.com/c/go/+/574155 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
On Windows, File.readdir currently fails if the volume information can't be retrieved via GetVolumeInformationByHandle and if the directory path is relative and can't be converted to an absolute path. This change makes readdir more robust by not failing in these cases, as these steps are just necessary to support a potential call to os.SameFile, but not for the actual readdir operation. os.SameFile will still fail in these cases, but that's a separate issue tracked in golang#62042. Change-Id: I8d98d8379bdac4b2832fa433432a5f027756abaa Reviewed-on: https://go-review.googlesource.com/c/go/+/574155 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
os.SameFile
does not report \.\pipe\ and NUL as the same fileWhat did you see instead?
os.SameFile
reports \.\pipe\ and NUL as the same file@golang/windows
The text was updated successfully, but these errors were encountered: