runPh5: make the downstream patch an explicit input, and record provenance - #318
Open
dcasota wants to merge 1 commit into
Open
runPh5: make the downstream patch an explicit input, and record provenance#318dcasota wants to merge 1 commit into
dcasota wants to merge 1 commit into
Conversation
…nance
Adapting these for an automated driver without giving up standalone use.
The problem is not that two copies of downstream-fixes.patch exist. It is
that the script DERIVES a critical input from its own location and then picks
silently among candidates, so three properties are missing: a caller cannot
say which patch it means, the choice is never announced, and divergence is
never detected. The two copies on this host have drifted 78 lines apart and
carry 8 vs 27 files; the build simply used whichever sat beside the script
that happened to be invoked, and the failure surfaced as
"patch does not apply" against SPECS/linux/linux.spec:77 - which reads like
a rebase problem rather than a path problem. The only workaround available to
a driver was to stage a fake script directory.
Three changes, all additive:
DOWNSTREAM_PATCH is now an input. Set it and it wins; leave it unset and
the historical search runs exactly as before, so the zero-argument
standalone path is byte-identical. A missing caller-specified file is a
hard error rather than a silent fallback.
The resolution is announced, with identity:
[runPh5_normal] downstream patch: /root/photonos-patches/... (27 files, sha 1a2b3c...)
A silent choice is how the two copies diverged unnoticed in the first place.
Ambiguity is refused. Two candidates with identical content are fine; two
that differ stop the build and print both paths, file counts and hashes,
because continuing would make the artefact a coin toss.
runPh5_normal.sh additionally writes <iso>.build-manifest.json next to the
ISO: image type, canister mode, tree HEAD, patch path and sha256, ISO sha256
and build time. An ISO with no record of what produced it cannot be
attributed to a patch set later, and a driver should not have to scrape
"Moved ISO to" out of a log to find its own artefact.
Verified by exercising the resolution block directly, since a full build was
running against the shared tree at the time:
caller-specified wins; caller-specified but missing refuses; two differing
copies refuse and print both hashes; two identical copies proceed and name
the winner; a single copy behaves as before; no copy stays silent.
Signed-off-by: Daniel Casota <dcasota@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adapting
run*.shso an automated driver can use them, without giving up standalone use.The actual defect
Not "two copies of a file exist". The script derives a critical input from its own location and then picks silently among candidates, so three properties are missing:
On this host the two copies have drifted 78 lines apart and carry 8 vs 27 files:
The build used whichever sat beside the script that happened to be invoked, and the failure surfaced as
patch does not applyagainstSPECS/linux/linux.spec:77— which reads like a rebase problem rather than a path problem. It cost two failed builds and two wrong diagnoses before I looked at the path. The only workaround available to a driver was to stage a fake script directory, which is a symptom, not a fix.Three changes, all additive
DOWNSTREAM_PATCHbecomes an input. Set it and it wins; leave it unset and the historical search runs exactly as before, so the zero-argument standalone path is byte-identical. A caller-specified file that does not exist is a hard error rather than a silent fallback to something else.The resolution is announced, with identity.
A silent choice is precisely how the two copies diverged unnoticed.
Ambiguity is refused. Two candidates with identical content are fine. Two that differ stop the build and print both paths, file counts and hashes:
Continuing would make the artefact a coin toss.
Provenance sidecar
runPh5_normal.shalso writes<iso>.build-manifest.jsonbeside the ISO: image type, canister mode, release branch, tree HEAD, patch path and sha256, ISO sha256, build time.An ISO with no record of what produced it cannot be attributed to a patch set later — and a driver should not have to scrape
Moved ISO toout of a log to find its own artefact.Verification
A full build was running against the shared tree at the time, so the resolution block was exercised directly rather than by running the script:
(caller-specified)sh -nclean on both scripts.Scope
Only
runPh5_normal.shandrunPh5_pinned90.shcarry the patch-search logic;runPh4.sh,runPh5_pinned91.shandrunPh6.shdo not apply a downstream patch at all and are untouched. The manifest is currently only inrunPh5_normal.sh— worth extending to the others if this shape is agreed.Two things deliberately not done here, as they are larger decisions:
$1..$6is at its practical limit;--img-type/--canister/--outputwould extend cleanly while keeping positional as the documented quick path.