Skip to content

Compile libgit2 deterministically by sorting read_dir #619

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

Merged
merged 1 commit into from
Sep 11, 2020

Conversation

kpcyrd
Copy link
Contributor

@kpcyrd kpcyrd commented Sep 11, 2020

It seems the order that C files are passed to build.file(&path); has impact on the binary. Right now build.rs is using a simple read_dir, so the final binary varies depending on the order the files are returned by the filesystem of the build machine. This patch collects into a Vec first and then sorts it to ensure the order of build.file(&path); calls is always deterministic.

Fixes #618

@alexcrichton
Copy link
Member

Thanks!

@alexcrichton alexcrichton merged commit 831faaf into rust-lang:master Sep 11, 2020
@kpcyrd kpcyrd deleted the sorted-add-c-files branch September 11, 2020 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

filesystem-related nondeterminism from libgit2-sys
2 participants