Repository navigation
Refresh Git version metadata when rebuilding an existing checkout - #778
Conversation
|
🤖 Automated first-pass review — a human maintainer's review is still required before merge. Thanks for this. The root cause matches #773, and I like that the regression drives the real configured One question on the install path. The new The rest looks good to me. I'd just like the (would file this as a comment, not a formal block) |
|
Updated in c790b1d. The hard-failure approach did break the four Debian container jobs and Alpine latest at the version.h rule, so it has been replaced with a warning and explicit unknown provenance ( The regression injects failures in ls-files, rev-parse and diff-index independently: each build succeeds with a warning and an unknown compiled consumer, repeated unknown metadata leaves timestamps unchanged, and restored Git access recovers the correct SHA. Ordinary dirty status remains distinct. Archives and no-Git builds retain their fallback. The standalone check is now named check_version_build.py to avoid RLTest discovery. AGENTS.md now explains that installation rechecks metadata and can rebuild consumers when the SHA, dirty state or Git access changes. The updated container CI is running; this is not cleared for merge until it passes and the independent reviews converge. |
|
Following the 09:46:49 edit: retaining an existing header was considered, but the rule runs for every build, not only install. After a checkout change, unavailable Git plus a retained header would recreate the original defect: newly compiled source claiming an older SHA. The regression now explicitly rejects that mutation. Warning plus unknown provenance is the selected compromise: builds continue and the binary makes no unverifiable revision claim. A repeated unknown state does not recompile; recovering access restores the SHA. The statement that ordinary sudo necessarily triggers this is too broad: Git documents that root also trusts the UID in SUDO_UID on supported non-Windows sudo platforms. I did not claim a privileged local sudo test; the actual refusal was reproduced using Git's ownership-test environment. Container failures are established independently, and the new container jobs are running. The install-time rebuild when metadata changes is intentional and documented, including changed Git access. Local final-head direct/no-op checks and distcheck (15 unit programs, archive install/uninstall) pass. BUILD and TEST independently approve the final policy; remaining reviews and CI still gate merge. |
Problem
After an incremental rebuild, the binary can include new source while
--versionstill reports the previous commit. The same generated SHA supplies crash reports and Prometheus build information.Root cause
version.hhad no prerequisites, so an existing header was not reconsidered when HEAD or tracked-file state changed. The generator also queried Git in the build directory, which could be outside the source checkout or inside an unrelated repository.Fix
Recheck metadata on each build through a phony prerequisite, preserving the existing compare-before-replace behavior so unchanged metadata does not rebuild consumers. Add explicit header dependencies for both consuming objects, covering first/direct parallel binary builds. Query the source checkout and use unknown provenance for source archives, including archives unpacked beneath another repository. On a Git metadata error, warn and use explicit unknown provenance, preserving build compatibility without retaining a potentially stale SHA. Update the release guide, including installation-triggered rebuilds.
Tests
make -j8 memtier_benchmarksucceeds. Repeating normalmake -j8leaves the header, both consumer objects, and executable timestamps and hashes unchanged.make -j8 distcheck, including all 15 unit programs and archive build/install/uninstall checks. Actual Git ownership refusal warns and reports unknown; recovery restores the SHA. CI is running. Full CI and seven independent reviews remain required.Affected versions
Introduced by #328 (
4a8ac10on master,a399f1bon the 2.2 line). Release source 2.2.1–2.5.2 retains the dependencyless rule; current master is affected. Historical release binaries were not separately executed. Fresh clean builds avoid the original stale-header condition.Fixes #773
🤖 Generated with Claude Code