os: Stat returns error with 'nul' on Windows #24482
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
OS-Windows
Milestone
What version of Go are you using (
go version
)?go version go1.10 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOOS=windows GOARCH=amd64
What did you do?
Tried to use os.Stat on "nul":
os.Stat("nul")
What did you expect to see?
A valid FileInfo with no error, as is the case with:
os.Stat("NUL")
.What did you see instead?
An
os.PathError
error.Additional
Other
os
operations, such asos.Create
, succeed with either "nul" or "NUL".Windows will discard any data written to any variation of the filename "NUL", not just uppercase.
os/stat_windows.go
checks againstOS.DevNull
which is a constant"NUL"
.Something like this (with or without the short-circuit) would resolve this.
However, I don't know if introducing the
strings
dependency into the Windowsos
pkg is reasonable.If it is I can submit a PR for this. The only other thing I can think of is duplicating the functionality of
ToUpper
into/os/internal/
to handle this.The text was updated successfully, but these errors were encountered: