Skip to content

Reproducible builds: skip test time report if SOURCE_DATE_EPOCH set - #2970

Merged
lballabio merged 2 commits into
lballabio:masterfrom
eddelbuettel:feature/reproducible_builds
Oct 30, 2026
Merged

lballabio merged 2 commits into
lballabio:masterfrom
eddelbuettel:feature/reproducible_builds

Conversation

@eddelbuettel

Copy link
Copy Markdown
Contributor

The reproducible builds initiative aims for bit-by-bit identical rebuilds. This small patch suppresses the printout of the test time which, even when everything is numerically the same, may differ because of external factors such as machine load.

I have another 'open puzzle' related to this and will send you email about it.

The reproducible builds initiative (https://reproducible-builds.org/) aims
for bit-by-bit identical rebuilds. This small patch suppresses the printout
of the test time which, even when everything is numerically the same, may
differ because of external factors such as machine load.
// SOURCE_DATE_EPOCH is set by dpkg-buildpackage / the reproducible-builds
// infrastructure. The elapsed time is not deterministic, so skip the
// report to keep the packaged test-suite log bit-for-bit reproducible.
if (std::getenv("SOURCE_DATE_EPOCH") != nullptr)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Question: MSVC complains about this function being unsafe. Do we only need this to run on a Linux infrastructure (in which case I'll just skip this couple of lines for MSVC) or should this work with Windows as well (in which case we'll have to push and pop some pragma warning?)

@eddelbuettel eddelbuettel Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I think wrapping an #if for an appropriate Linux define / 'not MSVC define' is totally fine.

These reproducible builds are (to me anyway) in a very loose sense another layer of continuous integration and coverage-alike tests: "are we set up in a solid way so that repeated attempts produce identical outcomes". And it fetches leaving build paths behind, or slipping current date / time in (hello swaptions!!). But I do not think anybody does this anywhere but on Linux so excluding Windows seems like a totally fine step to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Test for _WIN32 should do. Do you want to quickly wrap that around?

Or maybe #if defined(__linux__) is cleaner. Can do either.

@eddelbuettel

Copy link
Copy Markdown
Contributor Author

This is interesting too:

https://www.google.com/search?q=why+does+MSVC+think+std%3A%3Agetenv()+is+unsafe%3F&oq=why+does+MSVC+think+std%3A%3Agetenv()+is+unsafe%3F&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIHCAEQIRiPAjIHCAIQIRiPAtIBCTE3NTg1ajBqN6gCALACAA&sourceid=chrome&source=chrome.ob&ie=UTF-8

So maybe b) or c) are attractive? Here c) tells MSVC to not worry, b) uses a stricter form. But as stated, I am fairly certain this is a leeenucks-only thing.

@coveralls

coveralls commented Oct 30, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 79.63% (+0.02%) from 79.609% — eddelbuettel:feature/reproducible_builds into lballabio:master

@lballabio

Copy link
Copy Markdown
Owner

Ok, let's go with your pushed change, thanks.

@lballabio
lballabio merged commit e429e9f into lballabio:master Oct 30, 2026
45 checks passed
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.

3 participants