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

dont embed RUSTFLAGS in final binary #1396

Merged
merged 1 commit into from
Aug 7, 2024
Merged

Conversation

BoxyUwU
Copy link
Contributor

@BoxyUwU BoxyUwU commented Aug 7, 2024

Change Summary

Fixes #1365

Using option_env! produces a static str literal for the value of the env var, this necessarily results in it being stored in the final binary. In this case the entirety of RUSTFLAGS would be present which can include paths which causes issues for reproducible builds.

I'm not sure if we have any way to really test for this though, it seems unfortunate to just fix stuff like this then wait until someone complains if we break something 😅

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Copy link

codspeed-hq bot commented Aug 7, 2024

CodSpeed Performance Report

Merging #1396 will not alter performance

Comparing boxy/dont_embed_rustflags (add996a) with main (6e96b85)

Summary

✅ 155 untouched benchmarks

Copy link
Contributor

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@davidhewitt davidhewitt merged commit e07c41b into main Aug 7, 2024
29 checks passed
@davidhewitt davidhewitt deleted the boxy/dont_embed_rustflags branch August 7, 2024 16:11
@moto-timo
Copy link

Thank you!

@moto-timo
Copy link

I agree about test cases... not sure how to address that in e.g.. the GitHub workflow, but we do reproducible build testing in Yocto Project.

@davidhewitt
Copy link
Contributor

Have you got a standard pattern for testing reproducible builds in Yocto that we might be able to base something off?

@moto-timo
Copy link

https://docs.yoctoproject.org/test-manual/reproducible-builds.html

TL;DR
We build with two different build paths and compare the two with diffoscope.
In our case:

  1. the first build uses "shared state" which is cached binaries from the tasks already run
  2. the second build is from scratch with no prior caching.

@moto-timo
Copy link

Related rust-lang/cargo#5505

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.

Build directory (as a string) injected into _pydantic-core.*.so (which will cause non-reproducible builds)
3 participants