Skip to content

fix(monero-sys): make patch application idempotent across rebuilds - #1143

Merged
binarybaron merged 1 commit into
masterfrom
fix-monero-sys-patch-idempotency
Jun 25, 2026
Merged

binarybaron merged 1 commit into
masterfrom
fix-monero-sys-patch-idempotency

Conversation

@binarybaron

Copy link
Copy Markdown

No description provided.

build.rs detected an already-applied patch by reverse-applying it. When two
patches modify adjacent lines of the same file, applying one shifts the
other's hunk context, so the reverse check fails on later builds and the
forward apply then panics ('error applying hunk #1'). A fresh checkout works
but the second compile fails.

Instead, reconstruct each target file's expected content from its pristine
(committed) version plus every patch that touches it, and write only when the
working file differs. This is a byte-exact comparison rather than a fuzzy
reverse check, self-heals a partially-applied tree, and never rewrites an
already-correct file (which would change its mtime and force a full C++
rebuild). Pristine content is read via 'git show HEAD:<path>' from the
repository that owns each file, so targets in nested submodules (e.g.
external/randomx) resolve correctly.
@binarybaron
binarybaron merged commit 59bbd7a into master Jun 25, 2026
67 of 76 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.

1 participant