Skip to content
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/distpack: binary and source distributions make go_$GOOS_$GOARCH_exec programs non-executable #60843

Closed
dmitshur opened this issue Jun 16, 2023 · 1 comment
Assignees
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dmitshur
Copy link
Contributor

dmitshur commented Jun 16, 2023

Distpack produces 3 outputs as described here:

// - a binary distribution (tgz or zip) for the current GOOS and GOARCH
// - a source distribution that is independent of GOOS/GOARCH
// - the module mod, info, and zip files for a distribution in module form
// (as used by GOTOOLCHAIN support in the go command).

The first two include the two go_$GOOS_$GOARCH_exec programs in misc/wasm, but change their file mode to not have the executable bit set. This is contrast to their canonical source, and all other executable scripts like src/all.bash.

Changing mode to recognize filenames of this form (as done here) makes them executable.

For reference, the exact output of distpack's output before and after the change is:

diff
# distpack0 is produced at tip commit 3e7ec131 (go.dev/cl/502877) + VERSION file shown below
# distpack1 is produced at go.dev/cl/503975 + VERSION file shown below

$ cat ../VERSION
go1.21pre123
time 2023-06-16T11:11:11Z

$ diff -r distpack{0,1}
Binary files distpack0/go1.21pre123.darwin-arm64.tar.gz and distpack1/go1.21pre123.darwin-arm64.tar.gz differ
Binary files distpack0/go1.21pre123.src.tar.gz and distpack1/go1.21pre123.src.tar.gz differ
Binary files distpack0/v0.0.1-go1.21pre123.darwin-arm64.zip and distpack1/v0.0.1-go1.21pre123.darwin-arm64.zip differ

$ diff -U3 <(tar -tvf distpack0/go1.21pre123.src.tar.gz) <(tar -tvf distpack1/go1.21pre123.src.tar.gz)
--- /dev/fd/11	2023-06-16 00:43:58
+++ /dev/fd/13	2023-06-16 00:43:59
@@ -61,8 +61,8 @@
 -rw-r--r--  0 0      0        3292 16 Jun 07:11 go/misc/ios/detect.go
 -rw-r--r--  0 0      0       23969 16 Jun 07:11 go/misc/ios/go_ios_exec.go
 -rw-r--r--  0 0      0        3999 16 Jun 07:11 go/misc/linkcheck/linkcheck.go
--rw-r--r--  0 0      0         603 16 Jun 07:11 go/misc/wasm/go_js_wasm_exec
--rw-r--r--  0 0      0         799 16 Jun 07:11 go/misc/wasm/go_wasip1_wasm_exec
+-rwxr-xr-x  0 0      0         603 16 Jun 07:11 go/misc/wasm/go_js_wasm_exec
+-rwxr-xr-x  0 0      0         799 16 Jun 07:11 go/misc/wasm/go_wasip1_wasm_exec
 -rw-r--r--  0 0      0        1303 16 Jun 07:11 go/misc/wasm/wasm_exec.html
 -rw-r--r--  0 0      0       16687 16 Jun 07:11 go/misc/wasm/wasm_exec.js
 -rw-r--r--  0 0      0        1151 16 Jun 07:11 go/misc/wasm/wasm_exec_node.js
@@ -1375,7 +1375,7 @@
 -rw-r--r--  0 0      0         335 16 Jun 07:11 go/src/cmd/dist/vfp_default.s
 -rw-r--r--  0 0      0        5398 16 Jun 07:11 go/src/cmd/distpack/archive.go
 -rw-r--r--  0 0      0         938 16 Jun 07:11 go/src/cmd/distpack/archive_test.go
--rw-r--r--  0 0      0        9407 16 Jun 07:11 go/src/cmd/distpack/pack.go
+-rw-r--r--  0 0      0        9481 16 Jun 07:11 go/src/cmd/distpack/pack.go
 -rw-r--r--  0 0      0        5317 16 Jun 07:11 go/src/cmd/distpack/test.go
 -rw-r--r--  0 0      0        9232 16 Jun 07:11 go/src/cmd/doc/dirs.go
 -rw-r--r--  0 0      0       31940 16 Jun 07:11 go/src/cmd/doc/doc_test.go

$ diff -U3 <(tar -tvf distpack0/go1.21pre123.darwin-arm64.tar.gz) <(tar -tvf distpack1/go1.21pre123.darwin-arm64.tar.gz)
--- /dev/fd/11  2023-06-16 00:45:05
+++ /dev/fd/13  2023-06-16 00:45:05
@@ -63,8 +63,8 @@
 -rw-r--r--  0 0      0        3292 16 Jun 07:11 go/misc/ios/detect.go
 -rw-r--r--  0 0      0       23969 16 Jun 07:11 go/misc/ios/go_ios_exec.go
 -rw-r--r--  0 0      0        3999 16 Jun 07:11 go/misc/linkcheck/linkcheck.go
--rw-r--r--  0 0      0         603 16 Jun 07:11 go/misc/wasm/go_js_wasm_exec
--rw-r--r--  0 0      0         799 16 Jun 07:11 go/misc/wasm/go_wasip1_wasm_exec
+-rwxr-xr-x  0 0      0         603 16 Jun 07:11 go/misc/wasm/go_js_wasm_exec
+-rwxr-xr-x  0 0      0         799 16 Jun 07:11 go/misc/wasm/go_wasip1_wasm_exec
 -rw-r--r--  0 0      0        1303 16 Jun 07:11 go/misc/wasm/wasm_exec.html
 -rw-r--r--  0 0      0       16687 16 Jun 07:11 go/misc/wasm/wasm_exec.js
 -rw-r--r--  0 0      0        1151 16 Jun 07:11 go/misc/wasm/wasm_exec_node.js
@@ -1399,7 +1399,7 @@
 -rw-r--r--  0 0      0         335 16 Jun 07:11 go/src/cmd/dist/vfp_default.s
 -rw-r--r--  0 0      0        5398 16 Jun 07:11 go/src/cmd/distpack/archive.go
 -rw-r--r--  0 0      0         938 16 Jun 07:11 go/src/cmd/distpack/archive_test.go
--rw-r--r--  0 0      0        9407 16 Jun 07:11 go/src/cmd/distpack/pack.go
+-rw-r--r--  0 0      0        9481 16 Jun 07:11 go/src/cmd/distpack/pack.go
 -rw-r--r--  0 0      0        5317 16 Jun 07:11 go/src/cmd/distpack/test.go
 -rw-r--r--  0 0      0        9232 16 Jun 07:11 go/src/cmd/doc/dirs.go
 -rw-r--r--  0 0      0       31940 16 Jun 07:11 go/src/cmd/doc/doc_test.go

$ diff -U3 <(unzip -l distpack0/v0.0.1-go1.21pre123.darwin-arm64.zip) <(unzip -l distpack1/v0.0.1-go1.21pre123.darwin-arm64.zip)
--- /dev/fd/11  2023-06-16 00:51:16
+++ /dev/fd/13  2023-06-16 00:51:16
@@ -1,4 +1,4 @@
-Archive:  distpack0/v0.0.1-go1.21pre123.darwin-arm64.zip
+Archive:  distpack1/v0.0.1-go1.21pre123.darwin-arm64.zip
   Length      Date    Time    Name
 ---------  ---------- -----   ----
      1337  06-16-2023 07:11   golang.org/toolchain@v0.0.1-go1.21pre123.darwin-arm64/CONTRIBUTING.md
@@ -1346,7 +1346,7 @@
       335  06-16-2023 07:11   golang.org/toolchain@v0.0.1-go1.21pre123.darwin-arm64/src/cmd/dist/vfp_default.s
      5398  06-16-2023 07:11   golang.org/toolchain@v0.0.1-go1.21pre123.darwin-arm64/src/cmd/distpack/archive.go
       938  06-16-2023 07:11   golang.org/toolchain@v0.0.1-go1.21pre123.darwin-arm64/src/cmd/distpack/archive_test.go
-     9407  06-16-2023 07:11   golang.org/toolchain@v0.0.1-go1.21pre123.darwin-arm64/src/cmd/distpack/pack.go
+     9481  06-16-2023 07:11   golang.org/toolchain@v0.0.1-go1.21pre123.darwin-arm64/src/cmd/distpack/pack.go
      5317  06-16-2023 07:11   golang.org/toolchain@v0.0.1-go1.21pre123.darwin-arm64/src/cmd/distpack/test.go
      9232  06-16-2023 07:11   golang.org/toolchain@v0.0.1-go1.21pre123.darwin-arm64/src/cmd/doc/dirs.go
     31940  06-16-2023 07:11   golang.org/toolchain@v0.0.1-go1.21pre123.darwin-arm64/src/cmd/doc/doc_test.go
@@ -9236,4 +9236,4 @@
      1238  06-16-2023 07:11   golang.org/toolchain@v0.0.1-go1.21pre123.darwin-arm64/src/vendor/golang.org/x/text/unicode/norm/trie.go
       846  06-16-2023 07:11   golang.org/toolchain@v0.0.1-go1.21pre123.darwin-arm64/src/vendor/modules.txt
 ---------                     -------
-196481751                     9234 files
+196481825                     9234 files

Since the module zips do not include misc/wasm at all, there is no change. Which means changing mode doesn't affect previously generated module zips.

CC @rsc, @prattmic, @golang/release.

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 16, 2023
@dmitshur dmitshur added this to the Go1.21 milestone Jun 16, 2023
@gopherbot
Copy link

Change https://go.dev/cl/503975 mentions this issue: cmd/distpack: make go_$GOOS_$GOARCH_exec programs executable

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jun 16, 2023
@dmitshur dmitshur self-assigned this Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
Archived in project
Development

No branches or pull requests

2 participants