-
Notifications
You must be signed in to change notification settings - Fork 18.1k
cmd/go,x/mod/module: missing exclusion for COM0, LPT0 for embedded file names #66625
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
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. |
@matloob Which Microsoft documentation are you referring to? The MSDN / Learn platform article about "Naming a file" that I linked in the initial issue description lists the missing filenames. That very same URL was referenced by the go implementation files, in the comments, added by the initial author(s).
|
@cookieengineer I neglected to link to the issue where the new information came up. I'm sorry about that. Take a look at #67245 (comment). @qmuntal works at Microsoft and pointed to the commit that added that file to the documentation. It seems like the commit was added by a non-microsoft contributor and it does not have a descriptive commit message which are both pretty concerning. He also suggests in the comment that another commit seems to conflict with that one. We're going to wait until we have more conclusive information from Microsoft that that change to the Windows documentation is correct before shipping the corresponding change in Go. |
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>
Uh oh!
There was an error while loading. Please reload this page.
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: