-
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
path/filepath: COM0 and LPT0 are now reserved on Windows #67245
Comments
CC @golang/windows |
https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#win32-file-namespaces It seems very complex. Since these are aliases, on a computer without serial or parallel ports these file names can be created, but it is not portable. |
Huh. I wonder if the reference to COM0 is a typo in https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#win32-file-namespaces. I don't understand how any of this works under the hood, but there's some form of special consideration given to the names |
Maybe someone could test with a few USB to serial adapters and see what COM number gets assigned? Or even better , on a desktop with a serial PCI extension board? If COM0 never gets assigned in practice, we can keep this as it is now. |
Agree. This matches my experience.
I don't see
Same here. Perhaps other Windows developers know more. Alex |
True, LPT0 and COM0 were added two years ago (by a non-Microsoft contributor): MicrosoftDocs/win32@2274ec1. A more recent commit in that same file suggests that those names might be valid file names: MicrosoftDocs/win32@b4c2d78
I'm on leave now, so can't contact the owners to know the right answer. |
That's really strange. We might want to undo the change to x/mod to exclude those names until we get better information. It's pretty concerning that the change was made by a non-Microsoft contributor but doesn't have more information in the commit message. |
I think for I don't have an opinion on x/mod. |
https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file states that COM0 and LPT0 are reserved names. I believe that this page used to only list COM[1-9] and LPT[1-9] as reserved, and empirically these names are available for use on the Windows versions I've tested.
We need to decide whether
filepath.IsLocal
should consider these names local or not.In favor of
filepath.IsLocal("COM0")==false
: Current behavior, empirically you can create a file namedCOM0
.In favor of
filepath.IsLocal("COM0")==true
: Documented as a reserved name.The text was updated successfully, but these errors were encountered: