-
Notifications
You must be signed in to change notification settings - Fork 18k
path/filepath: can not handle files on windows that end with a . #69801
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
Comments
CC @golang/windows |
Related to #54040. |
Windows file naming rules says that files and directories should not contain trailing spaces or periods:
In #54040 we agreed to not special case trailing spaces and periods, as it is not possible to (easily) fully support them using Win32 API calls. If someone really needs to operate with these non-compliant file paths, then Windows already provide an escape hatch: prepend the path with @sweharris, in your example you can change the main function to do the following: func main() {
abs, err := filepath.Abs("TEST")
if err != nil {
panic(err)
}
filepath.Walk(`\\?\`+abs, find_walk)
} |
Go version
go version go1.23.2 windows/amd64
Output of
go env
in your module/workspace:What did you do?
Windows typically doesn't allow for files or directories ending in a "." and attempts to do so will result in the final "." being removed. But not all subsystems obey this, so we can use cygwin
If we try to do a "walk" on this then errors are passed to the walk function, the
info
field isn't populated, and the tree isn't fully recursed.I suspect this is
os.Lstat()
failing on Windows by calling the Win32 handler which can't support these files, even though the files can be created!What did you see happen?
What did you expect to see?
The directory "b." should be recursed into but it's not because the
Lstat()
is failing and so the function doesn't know it's a directory.I'm not sure this is easily fixable!
The text was updated successfully, but these errors were encountered: