-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
Build id seems to prevent stdlib from being reproducible #1391
Comments
Relevant source code seems to live at: Although one quick fix would be to overwrite the build id in the objects files, kind of like what we do with |
If the build id is a hash of the inputs, it should be reproducible. I suspect that it's hashing absolute paths that vary across different runs. If that's the case, we can try to build it at a deterministic location. Modifying the .a files may be difficult to support. They don't have a stable format across Go releases. |
And golang/go#22491 |
Reading buildid.go, it seems the build is divided into several parts by a 37,38c37,38
< 00000240 49 69 78 62 6e 54 46 35 61 53 30 4e 61 59 50 45 |IixbnTF5aS0NaYPE|
< 00000250 49 53 78 73 2f 73 71 38 38 4e 51 53 47 58 6a 6b |ISxs/sq88NQSGXjk|
---
> 00000240 58 59 7a 63 77 6e 63 4e 4f 4b 4e 59 7a 35 57 53 |XYzcwncNOKNYz5WS|
> 00000250 44 70 43 44 2f 73 71 38 38 4e 51 53 47 58 6a 6b |DpCD/sq88NQSGXjk| We can see that the second part is the same, only the first changes, which is, according to https://github.com/golang/go/blob/master/src/cmd/go/internal/work/buildid.go#L23-L31, the |
My guess is that the compile action id is calculated at https://github.com/golang/go/blob/ad0ebc3994fc7f74434d922b80401e680162c7d1/src/cmd/go/internal/work/exec.go#L177 |
If we could print the value of the input buffer at https://github.com/golang/go/blob/ad0ebc3994fc7f74434d922b80401e680162c7d1/src/cmd/go/internal/work/exec.go#L295 we could see what changes, I guess. |
It seems to be using |
It's also using the cgo flags as well: https://github.com/golang/go/blob/ad0ebc3994fc7f74434d922b80401e680162c7d1/src/cmd/go/internal/work/exec.go#L198-L209 Which pretty much kills setting absolute paths as CGO flags. |
Perhaps we can leverage
|
Here is the list of packages that have build ids that don't match after two builds on linux:
|
The common attribute between those packages is that they are using assembly or cgo, for instance: |
For assembly files, this seems to the cause: |
After removing the |
The weird thing is that the |
I think we can close this |
Original comment by @steeve #1357 (comment)
The text was updated successfully, but these errors were encountered: