Skip to content

os: the identity file must be TRUE, not merely present (it shipped cycle 26's engine in c32 and c33) - #1482

Merged
bong-water-water-bong merged 1 commit into
mainfrom
1bit/release-check-identity-consistency
Nov 8, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
1bit/release-check-identity-consistency

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

What

identity in os/mini/release-check.sh did this:

pass identity "$(tr '\n' ' ' < /etc/1bit/release-identity)"

It printed the file and called it a PASS. It never compared the file's statements with the bytes that shipped.

On 8 Nov it was false — in c32 and c33:

payload=lemonade-onebit-rc-2026-11-05-c26c        <- cycle 26's payload name
engine_sha256=89a6c386425a853ad28d945e1f8de9c446…  <- cycle 26's launcher
libhsa_sha256=f6ef689d163b42ded68cb99ffa4f9103251f05ba91fc3ca70f4a1d1909d9c34a
built=2026-11-05T16:47:32Z
artifact claimed engine_sha256 actual payload launcher
c32 shipped SFS 4731efd6 89a6c386… 80aceca152a909d5…
c33 a2cbb914 (embedded SFS deed1b19) 89a6c386… 7ba21108ae2a8b99…

So for at least two cycles the artifact has told its own console, this row and anyone reading the file the wrong engine — a false statement inside the thing being shipped, which is what made it invisible: every row that "saw" it was asking whether the file exists and is shaped right.

Why it happened

The writers are per-path:

  • os/v3/puppy/container-build.sh:343-353 writes this schema when it builds a base SFS;
  • os/mini/mkimage.sh:460-471 writes a different schema (tag:/lemonade:/engine:/hrx-system:/kernel:);
  • os/v3/puppy/mkimage.sh — what a payload roll like c33 runs — writes neither, so a cut that reuses a base SFS inherits whatever that SFS was born with.

The change

The row compares both sha256 claims with the shipped bytes:

  • engine_sha256 vs sha256 of ${PAYLOAD_DIR:-/opt/1bit-package}/1bit/1bit;
  • libhsa_sha256 vs sha256 of the runtime /etc/1bit/libhsa.env puts on LD_LIBRARY_PATH.

Malformed field, mismatch, or a claim with nothing to check it against = FAIL (an uncheckable claim is not evidence). payload= and built= stay in the message as information. Seams RELEASE_IDENTITY, LIBHSA_ENV, PAYLOAD_DIR so a harness can drive it.

Verification

  • Real bytes, not fixtures: c32's shipped tree → FAIL the identity file says engine_sha256=89a6c386425a853a but the payload's launcher is 80aceca152a909d5 — this cut does not write the file (os/v3/puppy/mkimage.sh writes it not at all), so it is an inherited base-SFS value naming an older engine. Same tree with the file rewritten to the true shas → PASS consistent: engine_sha256=80aceca152a909d5 and libhsa_sha256=f6ef689d163b42de.
  • release-check.sh --self-test PASS, with five new cases: match, engine mismatch, libhsa mismatch, malformed, uncheckable.

Scope, honestly

This is the guard, not the fix. The fix is the cut writing the file with the cycle's real values (pi-os3, in progress). Until a cut does, this row reds — which is the correct reading of a false identity, and is exactly what would have caught cycle 26's values in c32.

Not in this PR: puppy-check.sh (the board checker, this lane's local tool) had the same class one line deep — mident=$(cat /etc/1bit/release-identity) put a four-line file where a one-line payload name belonged, so that branch could never match and every bare-dd medium fell through to the rc-tag case. Fixed locally to read the payload= line; its rowproof-u2menu.sh proof stays 35/35.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT: READY at 323d19dd5ec58ed7ad933d707024358923fb842c.

This is the most consequential row fix I have reviewed today, because the failure it fixes is the one class this lane exists for: a check that printed and passed without comparing anything.

$ bash os/mini/release-check.sh --self-test   -> 98 ok, release-check self-test PASS
- pass identity "$(tr '\n' ' ' < /etc/1bit/release-identity)"
+ compares the claims with the shipped bytes: <claimed engine> <actual launcher> <claimed libhsa> <actual libhsa>

The evidence in the body is the part that makes it a fix rather than a refactor: on 8 Nov the file was false in c32 and c33 — both claimed payload=lemonade-onebit-rc-2026-11-05-c26c and engine_sha256=89a6c386…, i.e. cycle 26's payload and launcher, on a cycle-32/33 image. A provenance row that reports what a file says while the artifact differs is worse than no row: it is a green light on the wrong bytes.

Two details show it was thought through rather than patched:

  • malformed is distinguished from old: a engine_sha256 that is not hex, or not 64 characters, is refused as malformed rather than compared-and-diffed, because "your identity file is corrupt" and "your identity file is stale" send a reader to different places.
  • libhsa_sha256=none is a claim, not a pass by absence: it is true only if nothing /etc/1bit/libhsa.env names on the loader path actually exists — so the escape value cannot be used to skip the check.

Nothing asked for. If the c32/c33 images are still candidates, this row finding them false is itself the strongest argument that the row belongs in the gate.

…cle 26's engine in c32 and c33)

`/etc/1bit/release-identity` says which payload and which engine the image carries. The row printed the file and called it a PASS -
`pass identity "$(tr '\n' ' ' < $ID)"` - so nothing compared the statement with the bytes, and on 8 Nov it was false:

    payload=lemonade-onebit-rc-2026-11-05-c26c         <- cycle 26's payload name
    engine_sha256=89a6c386425a853ad28d945e1f8de9c446…   <- cycle 26's launcher
    built=2026-11-05T16:47:32Z

c32's payload launcher is `80aceca152a909d5…` and c33's is `7ba21108ae2a8b99…`, and c32's shipped SFS (`4731efd6`) carries that
same stale file, so for at least two cycles the artifact told its own console, this row and anyone reading it the wrong engine.

Cause is per-path writers: `os/v3/puppy/container-build.sh:343-353` writes this schema when it builds a base SFS,
`os/mini/mkimage.sh:460-471` writes a *different* one, and `os/v3/puppy/mkimage.sh` - what a payload roll like c33 runs - writes
**neither**, so a cut that reuses a base SFS inherits whatever the SFS was born with.

The row now compares both sha256 claims with the shipped bytes: `engine_sha256` against the payload's `1bit/1bit`, and
`libhsa_sha256` against the runtime `/etc/1bit/libhsa.env` puts on the loader path. Malformed, mismatched, and uncheckable are all
**FAIL** - an uncheckable claim is not evidence. `libhsa_sha256=none` is accepted as a claim and checked: true only if nothing
libhsa.env names exists here, so `none` against a runtime the image actually loads is a FAIL naming both (the board's `u5-hrxenv`
row pins its comparison to this same field, so a wrong `none` would have failed the owner's boot with a message blaming the
runtime).

Verified on real bytes, not fixtures: c32's shipped tree -> `FAIL the identity file says engine_sha256=89a6c386425a853a but the
payload's launcher is 80aceca152a909d5 - this cut does not write the file (os/v3/puppy/mkimage.sh writes it not at all), so it is an
inherited base-SFS value naming an older engine`; the same tree with the file rewritten to the true shas -> PASS.
`--self-test` PASS with seven new cases; `rowproof-payload-modes.sh` 13/13 on the same file (the two rows share it).

Rebuilt on main after #1473 landed (both changes edit this file's self-test area, so this branch was rebuilt rather than
hand-merged).
@bong-water-water-bong
bong-water-water-bong force-pushed the 1bit/release-check-identity-consistency branch from 323d19d to 60bf319 Compare November 8, 2026 14:42

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT: READY at 60bf319591883c3cce89ae0c0790007236e02321

This head is a rebase onto main (209b4dc8) of 323d19dd, which was reviewed READY. Compared line by line, the changes to os/mini/release-check.sh are identical except that one self-test row (identity_verdict … '' …, "nothing to check the claim against") moved two lines up. That changes neither the set of cases nor the logic.

At this head:

  • bash -n os/mini/release-check.sh passes;
  • sh os/mini/release-check.sh --self-test → release-check self-test PASS, including the five identity cases (match, engine mismatch, libhsa mismatch, malformed, uncheckable).

The row now compares the file's engine_sha256 and libhsa_sha256 claims with the shipped bytes instead of printing them, so a cut that inherits a base SFS's identity reds rather than passes. That's the guard #1482 set out to be.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT: READY at 60bf319591883c3cce89ae0c0790007236e02321

This is the right fix for a real lie, and the lie is documented in the code: the row used to pass identity "$(tr '\n' ' ' < $ID)" — it printed the identity file's claims and called the printing a PASS. c32 and c33 both shipped payload=lemonade-onebit-rc-2026-11-05-c26c with engine_sha256=89a6c386… while the payloads carried 80aceca1… and 7ba21108…, so the row was green on two consecutive wrong releases.

identity_verdict() is the correct shape for it: a value derived from the shipped bytes cannot be satisfied by a typed string. Four inputs, pure, so --self-test drives it — and the arms cover the cases that matter:

PASS  matching 64-hex engine + matching libhsa
FAIL  engine_sha256=89a6c386… (short: "malformed, not merely old")
FAIL  the real c32 shape (claimed c26c launcher vs the payload's own)
FAIL  claimed libhsa vs the shipped library

The malformed-vs-stale distinction is the part I would have missed in review: a short sha is a different failure from an old one, and reporting them the same way ("identity is old") would send someone looking for a stale writer when the file is simply not the schema they think.

The cause is named and it is the important half: three writers — os/v3/puppy/container-build.sh (base SFS), os/mini/mkimage.sh (a different schema), and os/v3/puppy/mkimage.sh, "what a payload roll like c33 runs — writes neither", so a cut reusing a base SFS inherits whatever that SFS was born with. Fixing the reader without that sentence would leave the next reader rediscovering it.

One thing to sequence, not a defect here: #1486 edits the same region (@@ -1690,6 +1690,35 @@ vs this PR's @@ -1687,9 +1736,22 @@) and adds an identity-engine row below the pass identity line this PR replaces. So land this one first, and #1486 should then fold its two-schema reading (engine_sha256= vs engine: <short sha>, with the SKIP reason) into identity_verdict rather than adding a parallel row. Otherwise the report keeps the false PASS line and gains a contradicting one next to it.

--self-test arms are check-driven like the rest of the file. Not run: the row against a live image (needs a booted appliance; the pure arms are the logic).

@bong-water-water-bong
bong-water-water-bong merged commit dcfe1ee into main Nov 8, 2026
9 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/release-check-identity-consistency branch November 8, 2026 14:54
bong-water-water-bong pushed a commit that referenced this pull request Nov 8, 2026
… image is not falsely red

Took the review's order: #1482 landed `identity_verdict()` and deleted the `pass identity "payload=..."`
line that printed the stale claim as a PASS, and this now adds only the part that function cannot know -
which schema the file uses (engine#1481).

os/v3/puppy/container-build.sh writes `engine_sha256=<sha256 of the launcher>` (key=value) and is checkable
against the payload; os/mini/mkimage.sh writes `engine: <git short sha>` (key: value) and is not. Without
this branch the mini schema reaches identity_verdict with an empty claim and reds as "malformed, not merely
old", which is a false red on every mini image. A git short sha is not a file hash, so the honest answer
there is a SKIP that says why rather than a FAIL or a pass by absence.

Also tolerates whitespace around `=` in the engine_sha256 read, which the review asked for and which costs
nothing.

Four cases at the call site: v3-correct -> PASS; the c32 bytes from the issue (89a6c386...) ->
FAIL naming both shas; mini schema -> SKIP naming the git sha; no engine line -> FAIL. #1482's self-test
still prints "release-check self-test PASS".

Refs #1481
bong-water-water-bong added a commit that referenced this pull request Nov 8, 2026
… image is not falsely red (#1486)

Took the review's order: #1482 landed `identity_verdict()` and deleted the `pass identity "payload=..."`
line that printed the stale claim as a PASS, and this now adds only the part that function cannot know -
which schema the file uses (engine#1481).

os/v3/puppy/container-build.sh writes `engine_sha256=<sha256 of the launcher>` (key=value) and is checkable
against the payload; os/mini/mkimage.sh writes `engine: <git short sha>` (key: value) and is not. Without
this branch the mini schema reaches identity_verdict with an empty claim and reds as "malformed, not merely
old", which is a false red on every mini image. A git short sha is not a file hash, so the honest answer
there is a SKIP that says why rather than a FAIL or a pass by absence.

Also tolerates whitespace around `=` in the engine_sha256 read, which the review asked for and which costs
nothing.

Four cases at the call site: v3-correct -> PASS; the c32 bytes from the issue (89a6c386...) ->
FAIL naming both shas; mini schema -> SKIP naming the git sha; no engine line -> FAIL. #1482's self-test
still prints "release-check self-test PASS".

Refs #1481

Co-authored-by: bong-water-water-bong <[email protected]>
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Identity File Verification Logic

The new identity_verdict() function introduces comprehensive checks to ensure the /etc/1bit/release-identity file's claims match the actual shipped artifacts. It validates engine and libhsa SHA256 hashes against the payload launcher and runtime, respectively. This prevents false statements in the identity file from being accepted as valid, which was a known issue in cycles c32 and c33 where the file claimed one engine while the payload carried another. The change also adds proper handling for the case where libhsa_sha256=none is claimed but a runtime is actually present, ensuring consistency.

identity_verdict() {
    _ce=${1:-} _ae=${2:-} _ch=${3:-} _ah=${4:-}
    case "$_ce" in ''|*[!0-9a-f]*) printf 'FAIL the identity file'"'"'s engine_sha256 is not a hex digest (%s) - malformed, not merely old' "${_ce:-empty}"; return 0 ;; esac
    [ "${#_ce}" = 64 ] || { printf 'FAIL the identity file'"'"'s engine_sha256 is %s characters, not 64 - malformed, not merely old' "${#_ce}"; return 0; }
    # `libhsa_sha256=none` is a legitimate claim - "this image ships no runtime of its own" - and it is checkable, not a pass by
    # absence: it is true only if nothing /etc/1bit/libhsa.env names on the loader path is actually there. A cut that writes `none`
    # while libhsa.env still names a runtime has written a false statement, and the board's u5-hrxenv row pins its comparison to this
    # same field, so a `none` there fails that row too - with a message that blames the runtime instead of the file.
    case "$_ch" in
        none)
            if [ -n "$_ah" ]; then
                printf 'FAIL the identity file says libhsa_sha256=none but the image loads a runtime libhsa.env names, sha256 %.16s - either write that sha or say why the two disagree' "$_ah"
            else
                printf 'PASS consistent: engine_sha256=%.16s is the shipped launcher and libhsa_sha256=none is true (libhsa.env names no runtime that exists here)' "$_ce"
            fi
            return 0 ;;
        ''|*[!0-9a-f]*) printf 'FAIL the identity file'"'"'s libhsa_sha256 is neither a hex digest nor none (%s) - malformed, not merely old' "${_ch:-empty}"; return 0 ;;
    esac
    [ "${#_ch}" = 64 ] || { printf 'FAIL the identity file'"'"'s libhsa_sha256 is %s characters, not 64 - malformed, not merely old' "${_ch}"; return 0; }
    if [ -z "$_ae" ]; then
        printf 'FAIL the identity file claims engine_sha256=%.16s but there is no payload launcher to compare it with - an uncheckable claim is not evidence' "$_ce"
        return 0
    fi
    if [ "$_ce" != "$_ae" ]; then
        printf 'FAIL the identity file says engine_sha256=%.16s but the payload'"'"'s launcher is %.16s - this cut does not write the file (os/v3/puppy/mkimage.sh writes it not at all), so it is an inherited base-SFS value naming an older engine' "$_ce" "$_ae"
        return 0
    fi
    if [ -n "$_ah" ] && [ "$_ch" != "$_ah" ]; then
        printf 'FAIL the identity file says libhsa_sha256=%.16s but the shipped runtime is %.16s - the image would name a runtime it does not carry' "$_ch" "$_ah"
        return 0
    fi
    printf 'PASS consistent: engine_sha256=%.16s and libhsa_sha256=%.16s are the shipped bytes, read off the payload rather than out of the file' "$_ce" "$_ch"
}
Self-Test Coverage

The self-test section now includes specific test cases for the identity_verdict() function, covering various failure and success scenarios. These tests validate that the function correctly identifies malformed claims, mismatches between claimed and actual engine or libhsa hashes, and the proper handling of libhsa_sha256=none. This ensures the new verification logic is robust and behaves as expected under different conditions.

check PASS "$(identity_verdict aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)"
check FAIL "$(identity_verdict aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 7ba2110811111111111111111111111111111111111111111111111111111111 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)"       # the c26-in-a-c32-image shape: engine claim vs shipped launcher
check FAIL "$(identity_verdict aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc)"       # libhsa claim vs the runtime the image carries
check FAIL "$(identity_verdict 89a6c386 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)"    # malformed claim is FAIL, not unknown
check FAIL "$(identity_verdict aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa '' bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)"          # nothing to check the claim against
check PASS "$(identity_verdict aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa none '')"           # `none` and nothing on the loader path: consistent
check FAIL "$(identity_verdict aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa none bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)"        # `none` while the image loads a runtime: false statement
check PASS "$(payload_modes_verdict 0 0)"
Identity File Parsing and Validation

The code now parses the identity file to extract payload, built, engine_sha256, and libhsa_sha256 fields, and then uses these values along with actual file hashes to call identity_verdict(). It also correctly handles cases where the libhsa runtime path is defined in /etc/1bit/libhsa.env and computes the actual SHA256 of the runtime library. This ensures that the identity file's claims are validated against the actual shipped artifacts.

ID=${RELEASE_IDENTITY:-/etc/1bit/release-identity}
if [ -f "$ID" ]; then
    _id_name=$(sed -n 's/^payload=//p' "$ID" 2>/dev/null | head -1)
    _id_built=$(sed -n 's/^built=//p' "$ID" 2>/dev/null | head -1)
    _id_engine=$(sed -n 's/^engine_sha256=//p' "$ID" 2>/dev/null | head -1)
    _id_hsasha=$(sed -n 's/^libhsa_sha256=//p' "$ID" 2>/dev/null | head -1)
    _id_launcher="${PAYLOAD_DIR:-/opt/1bit-package}/1bit/1bit"
    _id_act_engine=; [ -f "$_id_launcher" ] && _id_act_engine=$(sha256sum "$_id_launcher" 2>/dev/null | cut -d' ' -f1)
    _id_hsadir=$(sed -n 's/^\(export \)\{0,1\}LD_LIBRARY_PATH=//p' "${LIBHSA_ENV:-/etc/1bit/libhsa.env}" 2>/dev/null | sed 's/\$.*//' | cut -d: -f1)
    _id_act_hsasha=; [ -n "$_id_hsadir" ] && [ -f "${_id_hsadir%/}/libhsa-runtime64.so.1" ] && _id_act_hsasha=$(sha256sum "${_id_hsadir%/}/libhsa-runtime64.so.1" 2>/dev/null | cut -d' ' -f1)
    _idv=$(identity_verdict "$_id_engine" "$_id_act_engine" "$_id_hsasha" "$_id_act_hsasha")
    _idinfo="payload=${_id_name:-?} built=${_id_built:-?}"
    case "$_idv" in
        PASS*) pass identity "${_idv#PASS } (${_idinfo})" ;;
        *)     fail identity "${_idv#FAIL } (${_idinfo})" ;;
    esac

bong-water-water-bong added a commit that referenced this pull request Nov 8, 2026
…ly runs (#1541's reader half) (#1542)

* os: the identity row checks a MINI image against the engine it actually runs

#1541 gives a mini image an `engine_sha256` - the bytes the image carries, hashed where the image carries them. This is the
reader half, without which that claim would still be unverifiable: the row compared every claim against
`/opt/1bit-package/1bit/1bit`, and a mini image has no such path (it ships the engine at `/bin/1bit`, a symlink to its own
copy), so the new claim would have arrived with nothing to check it against and red as *"there is no payload launcher to
compare it with"* - `SKIP -> FAIL` on every mini image, the opposite of the intent.

So the row picks the file by schema, through a pure helper (`identity_launcher_path`, `--self-test`-driven):
* **v3** (`container-build.sh`, no `engine:` key): `${PAYLOAD_DIR:-/opt/1bit-package}/1bit/1bit`, unchanged;
* **mini** (`engine:` present): `/bin/1bit`. Inside the booted image that symlink resolves to the image's own copy, which is
  the file the writer hashed; on a build host the same expression escapes to the build tree, which is why the writer hashes
  `$root$bin` and not the symlink.

Three things my own fixtures found while building it, each a false green or a false red:

1. **The two schemas use different separators.** v3 writes `engine_sha256=<sha>`; #1541's mini writer emits
   `engine_sha256: <sha>`. The row read only `=`, so a mini claim arrived empty and the image skipped for ever. Now
   `^engine_sha256 *[=:] *`, whitespace trimmed.
2. **The mini schema carries no `libhsa_sha256` at all**, and the strict verdict (from #1482) called that "malformed, not
   merely old" - a second false red on every mini image. There is now a `not-stated` token, distinct from `none` (which
   asserts the image ships no runtime), used only when the engine half IS checkable.
3. **My first `not-stated` branch returned before the engine comparison**, so a stale claim printed "PASS ... is the shipped
   engine". The engine claim is now verified first, and the libhsa case runs after it.

Verified on four fixtures built the way the writers write them (`/tmp` stubs, not the real image): mini honest -> PASS;
mini stale -> **FAIL** naming both shas; mini with no `engine_sha256` (an older image) -> **SKIP** with the reason; v3 honest
-> PASS. `--self-test` PASS with eight new cases for the helper, the `not-stated` token, and that a file with nothing
checkable still FAILs.

* release-check self-test: generate the 64-char fixture POSIX-ly, because the file is #!/bin/sh (fixes the CI build)

CI's `release_check_row` test failed with:

    FAIL want PASS, got: FAIL the identity file's engine_sha256 is 5 characters, not 64 - malformed, not merely old

The case is the mini-image PASS arm, and it built its 64-character digest with `aaaa$(printf 'a%.0s' {1..60})`. `{1..60}` is a
BASH brace expansion; this script is `#!/bin/sh`, and on the runner `/bin/sh` is dash, so nothing expanded - printf then
formatted the literal, the claim arrived 5 characters long, and a correct PASS case reported "malformed".

Reproduced here by running it the way ctest does:

    $ ./os/mini/release-check.sh --self-test      # shebang = dash
    FAIL want PASS, got: FAIL ... engine_sha256 is 5 characters ...
    rc=1

and it passed only when run as `bash os/mini/release-check.sh --self-test` - which is how I first tried it, i.e. with a shell
the consumer does not use. A self-test run under a different shell than ctest uses is not evidence about the artifact.

Now generated with `printf '%064s' '' | tr ' ' a`, which is POSIX and exact, and the two uses on that line take the variable:

    ./os/mini/release-check.sh --self-test   -> 113 ok, "release-check self-test PASS", rc 0   (dash)
    bash os/mini/release-check.sh --self-test -> 113 ok, rc 0                                  (bash)

`sh -n` and `bash -n` clean. This is the only `{1..` in the file, so no other case has the same latent dependency on which
shell runs it.

---------

Co-authored-by: bong-water-water-bong <[email protected]>
Co-authored-by: pi-os3 <pi-os3@1local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant