-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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: Open("file/.") does not produce an error on wasip1 #69509
Comments
Hmm, the problem seems to be that wasip1 is performing path cleaning in general prior to opening files, which is going to affect more than just a trailing "/.". This produces incorrect results in a variety of situations, or at least results inconsistent with the usual behavior of Unix filesystems.
Testing with wasmtime, the WASI file API functions all seem to behave as I'd expect here (modulo what seems to be one bug: bytecodealliance/wasmtime#9272). The additional path-cleaning behavior is being added in the Go runtime, and I don't believe it's correct. |
I sent a patch that fixes |
Change https://go.dev/cl/614083 mentions this issue: |
Go version
master
Output of
go env
in your module/workspace:What did you do?
What did you see happen?
When built with GOOS=wasip1, the os package performs some path cleaning on filenames which results in a terminal "/." being removed. This causes opening a non-directory file to unexpectedly succeed.
What did you expect to see?
An error opening "file/.", because "file" is not a directory.
The text was updated successfully, but these errors were encountered: