-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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
archive on Darwin embed date #240014
Comments
cc @NixOS/darwin-maintainers |
Nice to know code I wrote 8 years ago is still relevant: https://github.com/facebook/buck/blob/9c7c421e49f4d92d67321f18c6d1cd90974c77c4/src/com/facebook/buck/cxx/toolchain/objectfile/ObjectFileScrubbers.java. The logic is pretty simple, do we have a pattern in nixpkgs for hooks that postprocess files to make them deterministic? |
I mean something more specific than just regular hooks. |
If not I guess we can add it as a hook on darwin stdenv. |
By the way I wrote a whole bunch of code to make outputs of darwin toolchains deterministic as part of Buck, feel free to cc me on any other relevant issues. I might not have time to do it myself but I can point you to the relevants part of the Buck source code / apple toolchain source code / various docs. |
I thought about a patch of ld so it store directly a null timestamp. Instead of postprocessing it (and maybe forget one place to call the hooks). Cool to see buck take care of such details. |
Darwin uses
|
If you only want that you can pass the But it's still possible to have non determinism because of the uid and gid, especially when using the nix daemon. I don't think non-determinism because of the file mode is an issue since we don't support nix store on weird filesystems that don't return sensible modes. Also if we use an old version of ar, we might have to work around a bug that was fixed back in Xcode 8, but I doubt even our oldest apple sdk / stdenvs are that old: facebook/buck@55d4678. |
|
I can’t speak to GNU |
I see llvm-ar also zeros out uid and gid: https://github.com/llvm/llvm-project/blob/00c27397dc63358bc7e5975c7af80efbf863d2c2/llvm/tools/llvm-ar/llvm-ar.cpp#L70-L71. |
Note that Darwin does not use |
Building this package twice does not produce the bit-by-bit identical result each time, making it harder to detect CI breaches. You can read more about this at https://reproducible-builds.org/ .
Fixing bit-by-bit reproducibility also has additional advantages, such as avoiding hard-to-reproduce bugs, making content-addressed storage more effective and reducing rebuilds in such systems.
Steps To Reproduce
You can see 1687814346 (date of when I run the command) appear in the resulting object. IIRC I have tried a similar example on x86_64-linux and it produced identical archive. So the Darwin ar tool should also be patched to not save the timestamp or respect DATE_SOURCE_EPOCH
The text was updated successfully, but these errors were encountered: