cmd/go: go.mod and go.sum are written with mode 0600 #31871
Labels
FrozenDueToAge
GoCommand
cmd/go
modules
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
I noticed that the
go.mod
andgo.sum
files in my projects written with 0600 permissions (readable and writable only by the owner).This is a bit unusual; I would have expected them to be written with
0644
(also readable to group and others), like all the other regular files in my Git repo.I tracked this down to being a side-effect of the
cmd/go/internal/renameio
package, which first creates the files withioutil.TempFile
, which callsOpenFile
with mode0600
(a perfectly reasonable thing to do when creating a file in a system temporary directory).If this behavior is deemed undesirable (and that's my opinion) then I think the fix is to have
renameio
callChmod
on the file after moving it out of the temporary directory.cc @bcmills
The text was updated successfully, but these errors were encountered: