-
Notifications
You must be signed in to change notification settings - Fork 17.3k
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
cmd/go,x/mod/module: missing exclusion for COM0, LPT0 for embedded file names #66625
Comments
we expect modules to be usable cross platform, so file name restrictions apply everywhere |
Change https://go.dev/cl/583836 mentions this issue: |
They have been added to the list of file names that are disallowed on Windows that's referenced in the comment to badWindowsNames, so add them to badWindowsNames. For golang/go#67238 For golang/go#66625 Change-Id: I82e5d70f33330f746783fd22090a3ebaf9408dfc Reviewed-on: https://go-review.googlesource.com/c/mod/+/583836 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Change https://go.dev/cl/584335 mentions this issue: |
To pull in CL 583836 Commands run go get golang.org/x/mod@6686f416970d4b8e2f54f521955dee89e6763c4b go mod tidy go mod vendor For #67238 For #66625 Change-Id: I77e49706481e068d27072a38d0d2464aa40d2dd0 Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/584335 Reviewed-by: Sam Thanawalla <samthanawalla@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Because it's not clear if those filenames were intender to be excluded in the Microsoft documentation, I will revert this change in x/mod and revendor x/mod. If we get more conclusive evidence that the filenames are indeed excluded, we'll redo for 1.24. |
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: