-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/build/cmd/relui: reproducibility diffs in darwin signed tar generation #61513
Comments
https://go-review.googlesource.com/c/go/+/511977 is the distpack change to fix the file sort order to match what a system tar or fs.WalkDir would use. |
Change https://go.dev/cl/511977 mentions this issue: |
One more issue - the mtimes on signed binaries are different from the mtime used on all the other files in the archive. Updated list in top comment. |
Change https://go.dev/cl/511759 mentions this issue: |
When we get the signed binaries back, the signing process has modified the tarball somewhat. We want the files to match as much as possible, so undo those changes. (And avoid making one change ourselves.) - Don't add a directory entry for the go/ root dir. It's unnecessary and not included in distpacks. This will affect non-distpack builds, but nobody is scrutinizing those. - Remove all other the directory entries too, which were inserted by the signing process. - Set the timestamps back to the distribution's timestamps. - Clear the user information on the modified files. For golang/go#61513 Change-Id: I0b3508bc2547364e2a2b49e1c6ea7be8fe92b308 Reviewed-on: https://go-review.googlesource.com/c/build/+/511759 Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Heschi Kreinick <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
Replied on the submitted CL, but since it is merged I will comment here too: distpack does not set AccessTime and ChangeTime, so I think those should be zeroed, not set to the mtime. |
Change https://go.dev/cl/512437 mentions this issue: |
Trying to predict the format of the distpack archives was probably not a good idea. Use the same approach we use for the module zips: tweak the contents of the files, and leave the metadata untouched. For golang/go#61513 Change-Id: I6e498b573eade71ec907590af05e7d3c0f25eb57 Reviewed-on: https://go-review.googlesource.com/c/build/+/512437 Auto-Submit: Heschi Kreinick <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
The code was sorting files in the archives entirely by path string, but that's not what fs.WalkDir would do. In a directory with subdirectory foo/bar and file foo/bar.go, foo/bar gets visited first, so foo/bar/baz appears before foo/bar.go, even though "foo/bar/baz" > "foo/bar.go". This CL replaces the string comparison with a path-aware comparison that places foo/bar/baz before foo/bar.go, so that if the tar file is extracted and then repacked using fs.WalkDir, the files will remain in the same order. This will make it easier to compare the pristine distpack-produced tgz for darwin against the rebuilt tgz with signed binaries. Before: % tar tzvf /tmp/cmddist.tgz | grep -C1 runtime/cgo.go -rw-r--r-- 0 0 0 11122 Jul 13 15:00 go/src/runtime/callers_test.go -rw-r--r-- 0 0 0 2416 Jul 13 15:00 go/src/runtime/cgo.go -rw-r--r-- 0 0 0 2795 Jul 13 15:00 go/src/runtime/cgo/abi_amd64.h After: % tar tzvf pkg/distpack/go1.21rsc.src.tar.gz | grep -C1 runtime/cgo.go -rw-r--r-- 0 0 0 1848 Dec 31 1969 go/src/runtime/cgo/signal_ios_arm64.s -rw-r--r-- 0 0 0 2416 Dec 31 1969 go/src/runtime/cgo.go -rw-r--r-- 0 0 0 2479 Dec 31 1969 go/src/runtime/cgo_mmap.go For #24904. For #61513. Change-Id: Ib7374bc0d6324377f81c561bef57fd87b2111b98 Reviewed-on: https://go-review.googlesource.com/c/go/+/511977 Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> Run-TryBot: Russ Cox <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
I've pushed relui and I believe we're done here. Let me know if I'm wrong. |
Change https://go.dev/cl/515415 mentions this issue: |
Issue 61513 is resolved so this path can be turned on now. Confirmed to still pass now that go1.21rc4 is out. It was the first release built using improvements from CL 512437. For golang/go#57120. For golang/go#58884. For golang/go#61513. Change-Id: Ie39765f8c7ba514dea2bfccf7c8ef8acc5822a22 Reviewed-on: https://go-review.googlesource.com/c/build/+/515415 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Russ Cox <[email protected]> Auto-Submit: Russ Cox <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]>
Change https://go.dev/cl/552015 mentions this issue: |
Caught while working on go.dev/issue/63147. For golang/go#61513. Change-Id: Ied9d3a6716759dfe40bf224f6b60bf733e07dc13 Cq-Include-Trybots: luci.golang.try:x_build-gotip-linux-amd64-longtest-race Reviewed-on: https://go-review.googlesource.com/c/build/+/552015 Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
The Darwin tar files that get rebuilt to put in the signed binaries
are different from the cmd/dist-generated ones in a few ways.
For now I can teach the reproduction checker I'm working on to ignore
these differences, but could these divergences be corrected in relui?
It seems like they should be straightforward
(perhaps it requires packing the tar file in Go code instead of invoking the system tar though).
The standard cmd/dist-generated tar files have no uid/gid/uname/gname - they're 0/0/""/"".
The signed ones say 501/0/gopher/wheel.
Let's clear the signed ones too (or preserve the cmd/dist-provided metadata, either way).
The standard cmd/dist-generated tar files have no entries for directories.
The signed ones add entries for directories, with semi-random time stamps, like go/ and go/api/ below (and more).
Let's remove the tar entries for directories.
The mtime on signed binaries is changed to be different from the mtime used consistently in the rest of the archive.
Let's keep the mtime the same on all files.
There is also an inconsistency in the file order but I think that one is cmd/distpack's fault and I will fix it there.
Thanks!
The text was updated successfully, but these errors were encountered: