cmd/go,x/mod/module: missing exclusion for COM0, LPT0 for embedded file names #66625
Labels
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Go version
go version go1.22.1 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I tried to embed a file called
aux.json.gz
on GNU/Linux:What did you see happen?
Trying to embed files on GNU/Linux systems that have
aux
, (orcon
,nul
,prn
,com*
,lpt*
) as a basename of the file cannot be embedded viago:embed
.The reason is a call to
isBadEmbedName()
in theresolveEmbed()
method ingo/internal/load/pkg.go
.The isBadEmbedName() method leads to
module.CheckFilePath(name)
which compares the basename of the file to thebadWindowsNames
slice in module/module.go.My questions are now the following:
go:embed
need valid filenames for go modules?go:embed
need valid filenames for Windows? Is it unpacked temporarily when the binary is executed later, similar to squashfs, behind the scenes? Why is this not behind a host-specific tag?COM0
andLPT0
are missing from that list. See the linked article from themodule.go
file.What did you expect to see?
I expected to be able to embed filenames when they conform to the POSIX filesystem requirements, so I think it should be possible to embed filenames with the basename of
con
,prn
,aux
,nul
,com*
,lpt*
etc.The text was updated successfully, but these errors were encountered: