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

[WIP] perl: build deterministically #45064

Closed
wants to merge 1 commit into from

Conversation

CrystalGamma
Copy link
Contributor

@CrystalGamma CrystalGamma commented Aug 15, 2018

  • removes a uname, username and date mention in the output
  • resets the hash seed for the build
  • sets configuration date to $SOURCE_DATE_EPOCH
Motivation for this change

As it is, Perl does not build deterministically because some information about the build system as well as the build date is written to the output. This patch seeks to remedy this situation.

Things done
  • Tested using sandboxing
  • Built on platform(s)
    • NixOS (x86-64 and ppc64le)
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip" (I have no time to rebuild all of nixpkgs)
  • Tested execution of all binary files (only those used in the build of further packages, e. g. the bootstrap files or a NixOS system)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@timokau
Copy link
Member

timokau commented Aug 15, 2018

Nice, thank you for working on this! Please add comments to your changes, explaining the reasons. It would be ideal to propose upstream changes that make patches unnecessary.

Also you shouldn't put the details in the commit headline, they should be in the description text.

@CrystalGamma
Copy link
Contributor Author

CrystalGamma commented Aug 15, 2018

Added a comment in the Nix expression and reformatted the commit message.

How would I go about contacting Perl upstream maintainers? I'm afraid I am not used to contributing to such long-established projects (or open-source projects in general to some extent) …

@timokau
Copy link
Member

timokau commented Aug 15, 2018

Yeah it can be a bit intimidating. You usually start by looking at the meta homepage attribute and go from there. In this case that leads to https://www.perl.org/community.html. Maybe just ask on their IRC if this is an issue they'd consider fixing and how best to go about it?

@xeji
Copy link
Contributor

xeji commented Aug 15, 2018

cc @volth

@CrystalGamma
Copy link
Contributor Author

CrystalGamma commented Aug 15, 2018

The idea is that since the bootstrap files are pulled in as trusted binaries, they (and everything on the path to building them) should at least be reproducible. With a second patch to make-bootstrap-tools.nix I have everything (in that dependency graph) except GCC building deterministically and idempotently on my machines (and, on my as of yet unpublished ppc64le port, all of it). So this is one step to making this critical piece of infrastructure reproducible.

Re: fontforge building fixed-output derivations: those don't result in the same file on ppc64le BTW.

* replace configuration time with $SOURCE_DATE_EPOCH
* set configuration user to 'nixpkgs'
* set configuration host to 'nixpkgs'
* replace uname and OS version with more reproducible values on Linux
@CrystalGamma
Copy link
Contributor Author

After talking to some perl packagers and looking into how Debian package their perl, I've rewritten the PR to use some config overrides instead of using a patch to rip out offending lines. I don't have the time to test it in any real capacity today, I'll write back tomorrow.

@timokau
Copy link
Member

timokau commented Aug 15, 2018

LGTM, but it would be nice to see the rationale
.
I see that we gave up the neurotic goal of total reproducibility keeping it only for the packages which really need it (for example, fontforge which builds fixed-output-derivations of fonts and leaks own compilation time/user into the font metadata)

Did we give that up? I think it is a very practical goal with big advantages. Everything is not practical, but I'm happy about every additional reproducible package. I see that the effort has stalled a bit, but I would be sad if we actually gave that up.

@CrystalGamma nice, keep us updated when you tested it.

@timokau
Copy link
Member

timokau commented Aug 15, 2018

And you even found a place to report it upstream, awesome :)

@CrystalGamma
Copy link
Contributor Author

CrystalGamma commented Aug 16, 2018

I've run the test suite, and it seems to produce one more failure than staging, which is weird since it seems to be a part of the language itself rather than anything interacting with the system (specifically it is t/op/each). I'll investigate it some more …

@timokau timokau changed the title perl: build deterministically [WIP] perl: build deterministically Aug 16, 2018
@mmahut
Copy link
Member

mmahut commented Aug 25, 2019

Are there any updates on this pull request, please?

@siraben
Copy link
Member

siraben commented Nov 30, 2020

Any updates?

@stigtsp
Copy link
Member

stigtsp commented Dec 4, 2020

@stigtsp
Copy link
Member

stigtsp commented Dec 4, 2020

Rebased this PR against master in stigtsp@ebfa253, and did a build (with --check) of perldevel on two separate NixOS machines.

The both return:

$ nix-hash --type sha256 /nix/store/ysmbh64nhzjhjkvjh0cl5pv6ikc7njqk-perl-5.33.4
f8fc41bb8faafc5e644caf71d3ef18ca1cc103c424c9b254e4364fd225d78280

Both outputs give the same hash, appears to be reproducible.

@siraben
Copy link
Member

siraben commented Dec 5, 2020

Running NixOS on my MacBook Pro 11,1:

$ git remote add -f stigtsp git\@github.com\:stigtsp/nixpkgs
$ git checkout ebfa2534e97fb3e8150deed2618f0a862aae8af6
$ nix-hash --type sha256 $(nix-build -A perldevel)
# -- snip --
f8fc41bb8faafc5e644caf71d3ef18ca1cc103c424c9b254e4364fd225d78280

@stigtsp
Copy link
Member

stigtsp commented Dec 9, 2020

@CrystalGamma Sorry, this has taken a while. But are you available to continue this PR? If not, I'm happy to move your contributions to a new PR and work on finishing it.

@bmwiedemann
Copy link

@stale
Copy link

stale bot commented Jul 11, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 11, 2021
@Artturin Artturin mentioned this pull request Oct 26, 2021
12 tasks
@Artturin
Copy link
Member

#142942

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet