-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
RocksDB does not build in a reproducible way #7035
Comments
@ottok Would you like to send a PR that addresses this? |
I looked at the code but I did not understand it well enough to be able to change it properly. I can help testing a patch if somebody creates one. |
Filed this downstream as http://bugs.debian.org/976985 to hopefully attract more eyes on this issue. You can at any time review the latest status at https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/diffoscope-results/mariadb-10.5.html |
I have some ideas on how we could potentially fix this issue. I will take a look. |
I have some ideas on how to fix this issue but need guidance on what the community wants. Currently, the build_version contains two strings:
The latter field is the one causing the non-reproducible builds. My suggestion is to do the following:
Additionally, we should add "rocksb_build_git_branch". This will be the name of the branch being built ( |
Personally I would always use the git commit ID and only it, and not allow builds that have uncommitted changes, as they cannot be tracked in any way. Also, if you want traceability, supporting reproducible builds should be a priority for you :) But if you want to support these other options as well and find value in branch names and dates too, then what you suggested is OK. |
If you do not allow builds with uncommitted changes, there will have to be some switches so that developers can do a build to address issues and add features. Though I understand it would be nice for a "production build" to not allow uncommitted changes. |
@mrambacher I think all of your suggestions sound correct to me. I also like the general idea of adding |
Thanks @mrambacher. I will report back to you in a couple of weeks if RocksDB (and MariaDB) is really reproducible now with these changes. |
@ottok FWIW, I did not get the libraries to be identical on separate builds, but did not track down further what the issue was. Libraries are still different, even if the input source files are the same. Please let me know if there are any further issues. |
Summary: Closes facebook#7035 Changed how build_version.cc was generated: - Included the GIT tag/branch in the build_version file - Changed the "Build Date" to be: - If the GIT branch is "clean" (no changes), the date of the last git commit - If the branch is not clean, the current date - Added APIs to access the "build information", rather than accessing the strings directly. The build_version.cc file is now regenerated whenever the library objects are rebuilt. Verified that the built files remain the same size across builds on a "clean build" and the same information is reported by sst_dump --version Pull Request resolved: facebook#7866 Reviewed By: pdillinger Differential Revision: D26086565 Pulled By: mrambacher fbshipit-source-id: 6fcbe47f6033989d5cf26a0ccb6dfdd9dd239d7f
Expected behavior
All open source software should build in a reproducible manner. See https://reproducible-builds.org/
This improves security. This also makes builds faster for users of ccache and alike, since builds that are reproducible are also able to re-use previously built objects.
Actual behavior
RocksDB does not build in a reproducible manner. Two consecutive builds produce binaries with different contents, even though the code is exactly the same and the build environment is the same.
Steps to reproduce the behavior
Checkout a fresh RocksDB into directory "1" and build it. Checkout a fresh RocksDB into directory "2" and build it (in the same way). Run
diff -r -U 0 1 2
and notice that the directories differ and they did not produce identical things.This is what I see on my computer (I am building RocksDB in the MariaDB Server context):
Solution
Stop adding a timestamp into
build_version.cc
. Storing the git commit id should be enough. Storing a timestamp is useless since the code is always the same even though one set of files in the same commit is seconds or an hour older. Just remove this and it will be fixed.See also
This is related to #6276 which was closed without issue being solved.
The text was updated successfully, but these errors were encountered: