golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.17k stars 17.69k forks source link

cmd/dist: check that builds are reproducible #58884

Open rsc opened 1 year ago

rsc commented 1 year ago

For #24904, we have made changes to Go 1.21 to make the Go distribution builds trivially reproducible: given the source archive and a Go bootstrap toolchain that is new enough (Go 1.21 requires Go 1.17 or later), running make.bash or make.bat should produce the same binaries no matter the details of the host system, and adding the -distpack flag should produce the same archives no matter the details of the host system. Setting GOOS and GOARCH during this command cross-compiles a distribution for another system, and those should also be the same archives no matter the details of the host system. For example, building a linux/amd64 distribution should produce the same archive no matter whether the build happens on Linux, macOS, or Windows; no matter whether the host system is an x86 or an arm64; no matter where the archive is extracted; and so on.

The source archive https://swtch.com/tmp/go1.21repro4.src.tar.gz holds the source tree for a Go release claming to be go1.21repro4. The first 64 bits of its SHA256 hash are 0322e4c62dd8d770 (use openssl sha256 go1.21repro4.src.tar.gz on Unix or certutil -hashfile go1.21repro4.src.tar.gz sha256 on Windows).

If you expand that source archive and cd into go/src and run ./repro.bash (or repro.bat on Windows), it will run for quite a while building distribution archives for various systems. If you save the output and pipe it through grep distpack:, the output should match the canonical hashes here. For example:

curl -O https://swtch.com/tmp/go1.21repro4.src.tar.gz
tar xzf go1.21repro4.src.tar.gz
cd go/src
./repro.bash 2>&1 | tee ../../repro.txt  # DO NOT WRITE TO LOCAL DIRECTORY
cd ../..
grep distpack: repro.txt >distpack.txt
curl -O https://swtch.com/tmp/distpack-golden.txt
diff distpack-golden.txt distpack.txt

or on Windows:

curl -O https://swtch.com/tmp/go1.21repro4.src.tar.gz
tar xzf go1.21repro4.src.tar.gz
cd go\src
repro.bat >..\..\repro.txt  ;; DO NOT WRITE TO LOCAL DIRECTORY
cd ..\..
find "distpack:" repro.txt >distpack.txt
curl -O https://swtch.com/tmp/distpack-golden-crlf.txt
fc distpack-golden-crlf.txt distpack.txt

As noted in the comments, do not write repro.txt into the current directory, or else it will be included in the archives and affect their hashes.

You can test a single build using

cd go/src
GOOS=<goos> GOARCH=<goarch> ./make.bash -distpack

Omit GOOS and GOARCH to test the build for the local system. Note that the canonical linux-arm build also sets GOARM=6. Other variables like CC and CGO_ENABLED should be unset.

If you find a system configuration where the script runs a build successfully but produces a different archive hash than the canonical ones, please check what is different by comparing against the reference archives. Good ways to identify differences include:

Sometimes the difference will be in your environment configuration, such as setting CC or CGO_ENABLED causing changes in the defaults baked into the toolchain. Those kinds of differences due to configuration are expected. If you find a difference that's not caused by Go configuration, please file an issue with subject cmd/distpack: reproducibility bug for GOOS/GOARCH (filling in GOOS and GOARCH) along with details of which files are different, and then mention the issue in a comment on this issue as well.

I have already tested repro.bash on darwin/amd64, darwin/arm64, linux/amd64, and windows/arm64 systems, and I've tested every possible Go release from Go 1.17 onward as bootstrap toolchain when building on darwin/amd64. Of course, there may well still be bugs in Go setups I have not thought to test, and if so we want to find them. If there are any remaining, the first person to identify each new reproducibility bug root cause wins a gopher.

qmuntal commented 1 year ago

Tested on windows/amd64, result is OK. Tested on windows/amd64 with GOHOSTARCH=386, result is NO OK:

fc distpack-golden-crlf.txt distpack.txt Output
$ fc distpack-golden-crlf.txt distpack.txt
Comparing files distpack-golden-crlf.txt and DISTPACK.TXT
***** distpack-golden-crlf.txt
---------- REPRO.TXT
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: 484fa7a7ebd21976 go1.21repro4.darwin-amd64.tar.gz
distpack: 2c14b67b0c3b5528 v0.0.1-go1.21repro4.darwin-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.darwin-amd64.mod
***** DISTPACK.TXT
---------- REPRO.TXT
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: a0a4fe31a7ad946e go1.21repro4.darwin-amd64.tar.gz
distpack: aadbe5f10d5f345c v0.0.1-go1.21repro4.darwin-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.darwin-amd64.mod
*****

***** distpack-golden-crlf.txt
distpack: 41abee8115a736b7 v0.0.1-go1.21repro4.darwin-amd64.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: b90718ad21d985d4 go1.21repro4.darwin-arm64.tar.gz
distpack: 6f2aae6215381fb3 v0.0.1-go1.21repro4.darwin-arm64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.darwin-arm64.mod
***** DISTPACK.TXT
distpack: 41abee8115a736b7 v0.0.1-go1.21repro4.darwin-amd64.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: 3139158d8fa612c7 go1.21repro4.darwin-arm64.tar.gz
distpack: 95fdc0dd94f7bdb5 v0.0.1-go1.21repro4.darwin-arm64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.darwin-arm64.mod
*****

***** distpack-golden-crlf.txt
distpack: 30cb65f1a4248c33 v0.0.1-go1.21repro4.darwin-arm64.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: 298c9539c6e57d5d go1.21repro4.freebsd-386.tar.gz
distpack: e67fbaada9dfefe7 v0.0.1-go1.21repro4.freebsd-386.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.freebsd-386.mod
***** DISTPACK.TXT
distpack: 30cb65f1a4248c33 v0.0.1-go1.21repro4.darwin-arm64.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: 39ea3b51474d8440 go1.21repro4.freebsd-386.tar.gz
distpack: 57a12c7609d883e2 v0.0.1-go1.21repro4.freebsd-386.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.freebsd-386.mod
*****

***** distpack-golden-crlf.txt
distpack: 7e5d92a57aaf6869 v0.0.1-go1.21repro4.freebsd-386.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: 4d0d5c44e1991f94 go1.21repro4.freebsd-amd64.tar.gz
distpack: 900caa1228711fdc v0.0.1-go1.21repro4.freebsd-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.freebsd-amd64.mod
***** DISTPACK.TXT
distpack: 7e5d92a57aaf6869 v0.0.1-go1.21repro4.freebsd-386.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: b897b1f62fd87aa2 go1.21repro4.freebsd-amd64.tar.gz
distpack: cd85dd2a14c388cd v0.0.1-go1.21repro4.freebsd-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.freebsd-amd64.mod
*****

***** distpack-golden-crlf.txt
distpack: cd488e8c0b33b769 v0.0.1-go1.21repro4.freebsd-amd64.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: 611b06d29a13428a go1.21repro4.linux-386.tar.gz
distpack: 030b34aa95d62c72 v0.0.1-go1.21repro4.linux-386.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-386.mod
***** DISTPACK.TXT
distpack: cd488e8c0b33b769 v0.0.1-go1.21repro4.freebsd-amd64.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: 208bce0d751cb8e2 go1.21repro4.linux-386.tar.gz
distpack: 216f2728364ad7d3 v0.0.1-go1.21repro4.linux-386.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-386.mod
*****

***** distpack-golden-crlf.txt
distpack: b9de174fbf29e484 v0.0.1-go1.21repro4.linux-386.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: e308cdc4cd99c9bd go1.21repro4.linux-amd64.tar.gz
distpack: 1ee3de4569e69cc8 v0.0.1-go1.21repro4.linux-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-amd64.mod
***** DISTPACK.TXT
distpack: b9de174fbf29e484 v0.0.1-go1.21repro4.linux-386.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: 8bea2e49ae57b5cb go1.21repro4.linux-amd64.tar.gz
distpack: 0cfdf9d1f694cc7f v0.0.1-go1.21repro4.linux-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-amd64.mod
*****

***** distpack-golden-crlf.txt
distpack: 7e10f23c7a60fca2 v0.0.1-go1.21repro4.linux-amd64.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: f3f70b2baae60c7a go1.21repro4.linux-arm.tar.gz
distpack: ad10c0aa8d52147c v0.0.1-go1.21repro4.linux-arm.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-arm.mod
***** DISTPACK.TXT
distpack: 7e10f23c7a60fca2 v0.0.1-go1.21repro4.linux-amd64.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: 1f669eb300e0a739 go1.21repro4.linux-arm.tar.gz
distpack: f5598628b25eee13 v0.0.1-go1.21repro4.linux-arm.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-arm.mod
*****

***** distpack-golden-crlf.txt
distpack: 2d434700965a8330 v0.0.1-go1.21repro4.linux-arm.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: 09a55f9780f82372 go1.21repro4.linux-arm64.tar.gz
distpack: 9e8e57659edb190a v0.0.1-go1.21repro4.linux-arm64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-arm64.mod
***** DISTPACK.TXT
distpack: 2d434700965a8330 v0.0.1-go1.21repro4.linux-arm.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: b24db37fe752c1cc go1.21repro4.linux-arm64.tar.gz
distpack: e51f3bb916054c53 v0.0.1-go1.21repro4.linux-arm64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-arm64.mod
*****

***** distpack-golden-crlf.txt
distpack: 50558c15d16d42b9 v0.0.1-go1.21repro4.linux-arm64.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: 3fb5fdad90c3d351 go1.21repro4.linux-ppc64le.tar.gz
distpack: 46e9ed75a66fa46d v0.0.1-go1.21repro4.linux-ppc64le.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-ppc64le.mod
***** DISTPACK.TXT
distpack: 50558c15d16d42b9 v0.0.1-go1.21repro4.linux-arm64.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: a0eecd2bbd16d1de go1.21repro4.linux-ppc64le.tar.gz
distpack: 615e12fa30e3b09e v0.0.1-go1.21repro4.linux-ppc64le.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-ppc64le.mod
*****

***** distpack-golden-crlf.txt
distpack: 2b0ad7b76105a26f v0.0.1-go1.21repro4.linux-ppc64le.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: f1a351c65aa7fa67 go1.21repro4.linux-s390x.tar.gz
distpack: ec9728fba49e3dd5 v0.0.1-go1.21repro4.linux-s390x.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-s390x.mod
***** DISTPACK.TXT
distpack: 2b0ad7b76105a26f v0.0.1-go1.21repro4.linux-ppc64le.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: 160ccb3d15901590 go1.21repro4.linux-s390x.tar.gz
distpack: 9a80ab74aaa6b5cf v0.0.1-go1.21repro4.linux-s390x.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.linux-s390x.mod
*****

***** distpack-golden-crlf.txt
distpack: c6b273199341dbec v0.0.1-go1.21repro4.linux-s390x.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: d32952a2af5498b3 go1.21repro4.windows-386.zip
distpack: 46064d32b4bc712c v0.0.1-go1.21repro4.windows-386.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.windows-386.mod
***** DISTPACK.TXT
distpack: c6b273199341dbec v0.0.1-go1.21repro4.linux-s390x.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: 5e99b0922d9a71db go1.21repro4.windows-386.zip
distpack: 451ae3b36cb55249 v0.0.1-go1.21repro4.windows-386.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.windows-386.mod
*****

***** distpack-golden-crlf.txt
distpack: 1c26b9471ca17a48 v0.0.1-go1.21repro4.windows-386.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: e1e7a4ccb7f69e8a go1.21repro4.windows-amd64.zip
distpack: 0139e4dcdd6bae59 v0.0.1-go1.21repro4.windows-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.windows-amd64.mod
***** DISTPACK.TXT
distpack: 1c26b9471ca17a48 v0.0.1-go1.21repro4.windows-386.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: de06ef113a474306 go1.21repro4.windows-amd64.zip
distpack: aa202007886136e2 v0.0.1-go1.21repro4.windows-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.windows-amd64.mod
*****

***** distpack-golden-crlf.txt
distpack: c1f96f09986a7bbf v0.0.1-go1.21repro4.windows-amd64.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: 8bc26d12432cb7a4 go1.21repro4.windows-arm64.zip
distpack: a8561ce01182f327 v0.0.1-go1.21repro4.windows-arm64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.windows-arm64.mod
***** DISTPACK.TXT
distpack: c1f96f09986a7bbf v0.0.1-go1.21repro4.windows-amd64.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: 465f62e7c7009c38 go1.21repro4.windows-arm64.zip
distpack: b97444e2b949c4e2 v0.0.1-go1.21repro4.windows-arm64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.windows-arm64.mod
*****

***** distpack-golden-crlf.txt
distpack: e59b083dbb941f44 v0.0.1-go1.21repro4.windows-arm64.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: eee042687beba643 go1.21repro4.openbsd-amd64.tar.gz
distpack: aa487ebcc53745d2 v0.0.1-go1.21repro4.openbsd-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.openbsd-amd64.mod
***** DISTPACK.TXT
distpack: e59b083dbb941f44 v0.0.1-go1.21repro4.windows-arm64.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: c129a21460f2b6e0 go1.21repro4.openbsd-amd64.tar.gz
distpack: fa58d41357e2082d v0.0.1-go1.21repro4.openbsd-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.openbsd-amd64.mod
*****

***** distpack-golden-crlf.txt
distpack: bb6fa2ecd0fad553 v0.0.1-go1.21repro4.openbsd-amd64.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: 494d4b4c09a8fa39 go1.21repro4.netbsd-amd64.tar.gz
distpack: 80d5b1610733c3ee v0.0.1-go1.21repro4.netbsd-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.netbsd-amd64.mod
***** DISTPACK.TXT
distpack: bb6fa2ecd0fad553 v0.0.1-go1.21repro4.openbsd-amd64.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: 8b0da82e9c9f20a4 go1.21repro4.netbsd-amd64.tar.gz
distpack: 9da91d7f114248cc v0.0.1-go1.21repro4.netbsd-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.netbsd-amd64.mod
*****

***** distpack-golden-crlf.txt
distpack: f28ecfbefb8042e2 v0.0.1-go1.21repro4.netbsd-amd64.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: 4a95f5a53e2bfab6 go1.21repro4.dragonfly-amd64.tar.gz
distpack: 05bc9f79e2ac4584 v0.0.1-go1.21repro4.dragonfly-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.dragonfly-amd64.mod
***** DISTPACK.TXT
distpack: f28ecfbefb8042e2 v0.0.1-go1.21repro4.netbsd-amd64.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: 5654b9ad89098e92 go1.21repro4.dragonfly-amd64.tar.gz
distpack: 0b14b0fa5ae63406 v0.0.1-go1.21repro4.dragonfly-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.dragonfly-amd64.mod
*****

***** distpack-golden-crlf.txt
distpack: 89202c8aec5fdcd0 v0.0.1-go1.21repro4.dragonfly-amd64.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: 4b25fabe7d974d3c go1.21repro4.illumos-amd64.tar.gz
distpack: b31ebb742fa0cfa6 v0.0.1-go1.21repro4.illumos-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.illumos-amd64.mod
***** DISTPACK.TXT
distpack: 89202c8aec5fdcd0 v0.0.1-go1.21repro4.dragonfly-amd64.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: 39dfe0c3836b6fc5 go1.21repro4.illumos-amd64.tar.gz
distpack: df9a400456559829 v0.0.1-go1.21repro4.illumos-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.illumos-amd64.mod
*****

***** distpack-golden-crlf.txt
distpack: b7051e86ce944cff v0.0.1-go1.21repro4.illumos-amd64.info
distpack: 0322e4c62dd8d770 go1.21repro4.src.tar.gz
distpack: b676dafe53cffcca go1.21repro4.solaris-amd64.tar.gz
distpack: b3b0f15f262c4c37 v0.0.1-go1.21repro4.solaris-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.solaris-amd64.mod
***** DISTPACK.TXT
distpack: b7051e86ce944cff v0.0.1-go1.21repro4.illumos-amd64.info
distpack: 88b6cf652f99262a go1.21repro4.src.tar.gz
distpack: e5e501df7028b5bf go1.21repro4.solaris-amd64.tar.gz
distpack: afdd72a0ef6114d1 v0.0.1-go1.21repro4.solaris-amd64.zip
distpack: 58528cce1848ddf4 v0.0.1-go1.21repro4.solaris-amd64.mod
*****

Still haven't investigated which are the offending files, will do that during this week and submit an issue if it is really a reproducibility bug (rather than something wrong on my side).

rsc commented 1 year ago

Thanks @qmuntal. The go1.21repro4.src.tar.gz came out different. Usually that means either (1) generated files got generated differently, or (2) extra files were included unexpectedly, either because they existed locally or because the filtering in distpack needs revision. Diffing the outputs of tar tzvf on both source archives should make it clear.

Edit: There shouldn't be generated files in the source archive so it should be (2).

qmuntal commented 1 year ago

I've tried again in a clean environment and it didn't have me any diff. The first time I ran GOHOSTARCH=386 repro.bat >..\..\repro.txt was just after running the whole test without GOHOSTARCH, which left some dangling autogenerated files that leaked to the GOHOSTARCH=386 test:

fc golden.txt solaris.txt Output
Comparing files golden.txt and SOLARIS.TXT
***** golden.txt
-rw-r--r--  0 0      0          50 Mar 05 01:00 go/api/next/57708.txt
-rw-r--r--  0 0      0          15 Mar 05 01:00 go/codereview.cfg
***** SOLARIS.TXT
-rw-r--r--  0 0      0          50 Mar 05 01:00 go/api/next/57708.txt
-rwxr-xr-x  0 0      0    15696487 Mar 05 01:00 go/bin/go
-rwxr-xr-x  0 0      0     3341227 Mar 05 01:00 go/bin/gofmt
-rw-r--r--  0 0      0          15 Mar 05 01:00 go/codereview.cfg
*****

***** golden.txt
-rw-r--r--  0 0      0        1151 Mar 05 01:00 go/misc/wasm/wasm_exec_node.js
-rw-r--r--  0 0      0         553 Mar 05 01:00 go/src/Make.dist
***** SOLARIS.TXT
-rw-r--r--  0 0      0        1151 Mar 05 01:00 go/misc/wasm/wasm_exec_node.js
-rw-r--r--  0 0      0         572 Mar 05 01:00 go/pkg/include/asm_amd64.h
-rw-r--r--  0 0      0        1023 Mar 05 01:00 go/pkg/include/asm_ppc64x.h
-rw-r--r--  0 0      0        2612 Mar 05 01:00 go/pkg/include/funcdata.h
-rw-r--r--  0 0      0        1501 Mar 05 01:00 go/pkg/include/textflag.h
-rwxr-xr-x  0 0      0     2808673 Mar 05 01:00 go/pkg/tool/solaris_amd64/addr2line
-rwxr-xr-x  0 0      0     4919960 Mar 05 01:00 go/pkg/tool/solaris_amd64/asm
-rwxr-xr-x  0 0      0     2509245 Mar 05 01:00 go/pkg/tool/solaris_amd64/buildid
-rwxr-xr-x  0 0      0     4668260 Mar 05 01:00 go/pkg/tool/solaris_amd64/cgo
-rwxr-xr-x  0 0      0    23860203 Mar 05 01:00 go/pkg/tool/solaris_amd64/compile
-rwxr-xr-x  0 0      0     3199656 Mar 05 01:00 go/pkg/tool/solaris_amd64/covdata
-rwxr-xr-x  0 0      0     4887336 Mar 05 01:00 go/pkg/tool/solaris_amd64/cover
-rwxr-xr-x  0 0      0     3963196 Mar 05 01:00 go/pkg/tool/solaris_amd64/doc
-rwxr-xr-x  0 0      0     3316297 Mar 05 01:00 go/pkg/tool/solaris_amd64/fix
-rwxr-xr-x  0 0      0     6803058 Mar 05 01:00 go/pkg/tool/solaris_amd64/link
-rwxr-xr-x  0 0      0     2732655 Mar 05 01:00 go/pkg/tool/solaris_amd64/nm
-rwxr-xr-x  0 0      0     4135767 Mar 05 01:00 go/pkg/tool/solaris_amd64/objdump
-rwxr-xr-x  0 0      0     2218294 Mar 05 01:00 go/pkg/tool/solaris_amd64/pack
-rwxr-xr-x  0 0      0    14445883 Mar 05 01:00 go/pkg/tool/solaris_amd64/pprof
-rwxr-xr-x  0 0      0     2579143 Mar 05 01:00 go/pkg/tool/solaris_amd64/test2json
-rwxr-xr-x  0 0      0    13712044 Mar 05 01:00 go/pkg/tool/solaris_amd64/trace
-rwxr-xr-x  0 0      0     7596898 Mar 05 01:00 go/pkg/tool/solaris_amd64/vet
-rw-r--r--  0 0      0         553 Mar 05 01:00 go/src/Make.dist
*****

***** golden.txt
-rw-r--r--  0 0      0        3052 Mar 05 01:00 go/src/cmd/cgo/util.go
-rw-r--r--  0 0      0        7076 Mar 05 01:00 go/src/cmd/compile/README.md
***** SOLARIS.TXT
-rw-r--r--  0 0      0        3052 Mar 05 01:00 go/src/cmd/cgo/util.go
-rw-r--r--  0 0      0         444 Mar 05 01:00 go/src/cmd/cgo/zdefaultcc.go
-rw-r--r--  0 0      0        7076 Mar 05 01:00 go/src/cmd/compile/README.md
*****

***** golden.txt
-rw-r--r--  0 0      0       17083 Mar 05 01:00 go/src/cmd/go/internal/cfg/cfg.go
-rw-r--r--  0 0      0       11226 Mar 05 01:00 go/src/cmd/go/internal/clean/clean.go
***** SOLARIS.TXT
-rw-r--r--  0 0      0       17083 Mar 05 01:00 go/src/cmd/go/internal/cfg/cfg.go
-rw-r--r--  0 0      0         443 Mar 05 01:00 go/src/cmd/go/internal/cfg/zdefaultcc.go
-rw-r--r--  0 0      0        1194 Mar 05 01:00 go/src/cmd/go/internal/cfg/zosarch.go
-rw-r--r--  0 0      0       11226 Mar 05 01:00 go/src/cmd/go/internal/clean/clean.go
*****

***** golden.txt
-rw-r--r--  0 0      0         961 Mar 05 01:00 go/src/cmd/internal/objabi/util.go
-rw-r--r--  0 0      0       10767 Mar 05 01:00 go/src/cmd/internal/objfile/disasm.go
***** SOLARIS.TXT
-rw-r--r--  0 0      0         961 Mar 05 01:00 go/src/cmd/internal/objabi/util.go
-rw-r--r--  0 0      0          64 Mar 05 01:00 go/src/cmd/internal/objabi/zbootstrap.go
-rw-r--r--  0 0      0       10767 Mar 05 01:00 go/src/cmd/internal/objfile/disasm.go
*****

***** golden.txt
-rw-r--r--  0 0      0          80 Mar 05 01:00 go/src/debug/plan9obj/testdata/hello.c
-rw-r--r--  0 0      0       13649 Mar 05 01:00 go/src/embed/embed.go
***** SOLARIS.TXT
-rw-r--r--  0 0      0          80 Mar 05 01:00 go/src/debug/plan9obj/testdata/hello.c
-rw-r--r--  0 0      0           0 Mar 05 01:00 go/src/distpack.txt
-rw-r--r--  0 0      0       13649 Mar 05 01:00 go/src/embed/embed.go
*****

***** golden.txt
-rw-r--r--  0 0      0          10 Mar 05 01:00 go/src/go/build/testdata/withvendor/src/a/vendor/c/d/d.go
-rw-r--r--  0 0      0        3572 Mar 05 01:00 go/src/go/constant/example_test.go
***** SOLARIS.TXT
-rw-r--r--  0 0      0          10 Mar 05 01:00 go/src/go/build/testdata/withvendor/src/a/vendor/c/d/d.go
-rw-r--r--  0 0      0        1090 Mar 05 01:00 go/src/go/build/zcgo.go
-rw-r--r--  0 0      0        3572 Mar 05 01:00 go/src/go/constant/example_test.go
*****

***** golden.txt
-rw-r--r--  0 0      0        5562 Mar 05 01:00 go/src/internal/buildcfg/exp.go
-rw-r--r--  0 0      0        3987 Mar 05 01:00 go/src/internal/bytealg/bytealg.go
***** SOLARIS.TXT
-rw-r--r--  0 0      0        5562 Mar 05 01:00 go/src/internal/buildcfg/exp.go
-rw-r--r--  0 0      0         463 Mar 05 01:00 go/src/internal/buildcfg/zbootstrap.go
-rw-r--r--  0 0      0        3987 Mar 05 01:00 go/src/internal/bytealg/bytealg.go
*****

***** golden.txt
-rw-r--r--  0 0      0         283 Mar 05 01:00 go/src/runtime/internal/sys/sys.go
-rw-r--r--  0 0      0         861 Mar 05 01:00 go/src/runtime/internal/syscall/asm_linux_386.s
***** SOLARIS.TXT
-rw-r--r--  0 0      0         283 Mar 05 01:00 go/src/runtime/internal/sys/sys.go
-rw-r--r--  0 0      0          61 Mar 05 01:00 go/src/runtime/internal/sys/zversion.go
-rw-r--r--  0 0      0         861 Mar 05 01:00 go/src/runtime/internal/syscall/asm_linux_386.s
*****

***** golden.txt
-rw-r--r--  0 0      0        3040 Mar 05 01:00 go/src/time/tzdata/tzdata.go
-rw-r--r--  0 0      0        2515 Mar 05 01:00 go/src/time/tzdata_test.go
***** SOLARIS.TXT
-rw-r--r--  0 0      0        3040 Mar 05 01:00 go/src/time/tzdata/tzdata.go
-rw-r--r--  0 0      0     1336131 Mar 05 01:00 go/src/time/tzdata/zzipdata.go
-rw-r--r--  0 0      0        2515 Mar 05 01:00 go/src/time/tzdata_test.go
*****
rsc commented 1 year ago

Thanks @qmuntal. What is golden.txt and solaris.txt in the fc output? The golden.txt looks like maybe the listing for go1.21repro4.src.tar.gz (the source distribution) while the solaris.txt looks like maybe the listing for go1.21repro4.solaris-amd64.tar.gz (the solaris binary distribution). I expect those would be different.

qmuntal commented 1 year ago

What is golden.txt and solaris.txt in the fc output? The golden.txt looks like maybe the listing for go1.21repro4.src.tar.gz (the source distribution) while the solaris.txt looks like maybe the listing for go1.21repro4.solaris-amd64.tar.gz (the solaris binary distribution

That's the right file name mapping. Do you need any other test?

rsc commented 1 year ago

@qmuntal, if you can reproduce the mismatch, then the next step would be to diff the content of your generated source archive (../pkg/distpack/go1.21repro4.src.tar.gz) against the original https://swtch.com/tmp/go1.21repro4.src.tar.gz that you started with. Something is different between those. Don't worry about binary archives like the solaris distribution until the source archive comes out right: if the source is different, the binaries will be different. The difference in the source is the root cause. Thanks!

gopherbot commented 1 year ago

Change https://go.dev/cl/483695 mentions this issue: cmd/dist: rework generated cgo-support logic

bcmills commented 1 year ago

@qmuntal, did you have any luck tracking down the differences?

There was one recent reproducibility fix in https://go.dev/cl/502755, but it's not clear to me that that would account for your observations.

qmuntal commented 1 year ago

@rsc @bcmills sorry for late response, I forgot about this issue. As I said in my previous comment, I ran the GOHOSTARCH=386 repro.bat >..\..\repro.txt test using the same source folder I previously used to test just repro.bat >..\..\repro.txt. The first run autogenerated a couple of files, which where inherited by the second run (aka GOHOSTARCH=386), therefore the second run was already "corrupted" before even running repro.bat. This probably invalidates the experiment. If I run GOHOSTARCH=386 repro.bat >..\..\repro.txt on a clean env, then the checksums matches.

gopherbot commented 1 year ago

Change https://go.dev/cl/513975 mentions this issue: cmd/gorebuild: add tool to reproduce posted Go binaries

gopherbot commented 1 year ago

Change https://go.dev/cl/513700 mentions this issue: _content: add rebuild page with reproducible build information

gopherbot commented 1 year ago

Change https://go.dev/cl/514415 mentions this issue: [release-branch.go1.4] all: fixes for modern compilers

gopherbot commented 1 year ago

Change https://go.dev/cl/515415 mentions this issue: cmd/gorebuild: check uid/gid/uname/gname/mtime fields in tgz files

gopherbot commented 1 year ago

Change https://go.dev/cl/515455 mentions this issue: cmd/golangorg: fix CachedURL, update rebuild template

gopherbot commented 10 months ago

Change https://go.dev/cl/556075 mentions this issue: cmd/rebuild: report files missing from posted archive better