diff --git a/docs/os-v3.md b/docs/os-v3.md index ebf7d9972..1c900eb3d 100644 --- a/docs/os-v3.md +++ b/docs/os-v3.md @@ -143,7 +143,24 @@ SFS with one added file): the update reports `UPDATED`, the machine comes back o the new set's marker file present and the marker written before the update still there; `--rollback` brings it back to `psubdir=1bit` with the previous appliance intact and the state unchanged. -### The server-shaped rest, present or named +#### What `/etc/1bit/release-identity` says, and which of it is checked + +The file is written by the builder, printed by the console's header and read by `1bit-release-check`'s identity rows. Its +fields are not the same kind of thing, and the rows say so: + +| field | what it is | checked how | +|---|---|---| +| `engine_sha256` | the sha256 of the payload's launcher, **computed from the bytes** at build time | compared against the launcher present in the image | +| `payload_lemond` | the version string the payload's own `lemond-onebit --version` prints, computed from the payload at build time | compared against what that launcher says **on the machine** (`payload-identity` row) | +| `libhsa_sha256` | the sha256 of the shipped HSA runtime | compared against the runtime the image actually loads | +| `payload` | a **label**: the release tarball's stem | printed, **not** asserted — no fact inside an image can equal a tarball's name, and a check that pretended otherwise would red a correct image | +| `built` | the build timestamp | informational | + +The `payload=` label is what the console shows because a person wants the date in it; the verified field is +`payload_lemond=`, which is a fact about the payload's bytes. An image built before engine#1557 has no `payload_lemond=` and +the row **SKIPs with that reason** rather than passing by absence. + +## The server-shaped rest, present or named An installed 1bit OS is a headless server, so the things a server is expected to have are either there and measured, or named here as what they are: diff --git a/os/mini/release-check.sh b/os/mini/release-check.sh index d1f35b7ad..3411bbfd1 100755 --- a/os/mini/release-check.sh +++ b/os/mini/release-check.sh @@ -591,6 +591,30 @@ identity_launcher_path() { else printf '%s\n' "${PAYLOAD_DIR:-/opt/1bit-package}/1bit/1bit"; fi } +# The payload's own identity (engine#1557). `payload=` in release-identity is a LABEL - the tarball stem, which the console +# shows and which no fact inside the image can equal (the payload directory is /opt/1bit-package, and nothing in the payload +# records the stem) - so it is printed and NOT asserted. What IS checkable is the version string the payload's own launcher +# reports; the writer reads it from the payload's bytes at build time and stores it as `payload_lemond=`, and this row +# compares the claim with what the payload on this machine says about itself. Two different claims, never mixed: the label is +# presented as a label, and the version is a real check. Pure, so --self-test drives it: +payload_identity_verdict() { # + _pc=${1:-} _pa=${2:-} + if [ -z "$_pc" ]; then + printf 'SKIP this image'"'"'s identity carries no payload_lemond=, so the payload it names cannot be checked (engine#1557: only images built after this row have it)' + return 0 + fi + if [ -z "$_pa" ]; then + printf 'FAIL the payload'"'"'s launcher reported no version, so the identity'"'"'s claim (%s) cannot be checked against it' "$_pc" + return 0 + fi + if [ "$_pc" = "$_pa" ]; then + printf 'PASS the payload on this machine is the one the identity names: its own launcher reports %s, and the identity claims the same' "$_pa" + else + printf 'FAIL the identity claims payload_lemond=%s but the payload here reports %s - the name is stale or the payload is not the one that was packed (engine#1557)' \ + "$_pc" "$_pa" + fi +} + 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 @@ -790,6 +814,12 @@ if [ "${1:-}" = --self-test ]; then check FAIL "$(payload_modes_verdict '' 0)" check FAIL "$(payload_modes_verdict 0 '')" check FAIL "$(payload_modes_verdict x 0)" + # engine#1557: the payload's own identity - a claim that matches is a PASS, a stale one is a FAIL, and an image without + # the field is a SKIP that says why rather than a pass by absence + check PASS "$(payload_identity_verdict '2026.47.0~8.f44ff953' '2026.47.0~8.f44ff953')" + check FAIL "$(payload_identity_verdict '2026.47.0~8.f44ff953' '2026.48.0~1.aaaaaaaa')" + check SKIP "$(payload_identity_verdict '' '2026.47.0~8.f44ff953')" + check FAIL "$(payload_identity_verdict '2026.47.0~8.f44ff953' '')" # engine #1474: the base layer's row - clean only when the count is 0 AND a keep-list was read check PASS "$(base_modes_verdict 0 11)" # 11: the entry count in os/v3/puppy/base-modes-keep today check FAIL "$(base_modes_verdict 2166 10 'drwxrwxr-x usr/share')" # c33's base layer, the shape this closes @@ -1868,6 +1898,19 @@ if [ -f "$ID" ]; then *) fail identity "${_idv#FAIL } (${_idinfo})" ;; esac fi + # engine#1557: the label is printed, the payload's own version is CHECKED. `payload=` stays the human label (the tarball + # stem, which no in-image fact equals) and payload_lemond= is the claim the launcher on this machine can settle. + _pl_claim=$(sed -n 's/^payload_lemond=//p' "$ID" 2>/dev/null | head -1) + _pl_actual= + if [ -x "${PAYLOAD_DIR:-/opt/1bit-package}/lemond-onebit" ]; then + _pl_actual=$("${PAYLOAD_DIR:-/opt/1bit-package}/lemond-onebit" --version 2> /dev/null | sed -n 's/^lemond version //p' | head -1) + fi + PLV=$(payload_identity_verdict "$_pl_claim" "$_pl_actual") + case "$PLV" in + PASS*) pass payload-identity "${PLV#PASS } (label: ${_id_name:-?})" ;; + SKIP*) skip payload-identity "${PLV#SKIP }" ;; + *) fail payload-identity "${PLV#FAIL } (label: ${_id_name:-?})" ;; + esac if [ -f /data/SHA256SUMS ]; then if (cd /data && sha256sum -c SHA256SUMS >/dev/null 2>&1); then pass sha256sums "/data/SHA256SUMS verifies" else fail sha256sums "/data/SHA256SUMS does not verify (cd /data && sha256sum -c SHA256SUMS)"; fi diff --git a/os/v3/puppy/container-build.sh b/os/v3/puppy/container-build.sh index 25cffedd0..e61ead490 100644 --- a/os/v3/puppy/container-build.sh +++ b/os/v3/puppy/container-build.sh @@ -350,7 +350,16 @@ if [ -n "${PAYLOAD:-}" ]; then "$skeleton/etc/1bit/onebit-models.txt" || { echo "build: REFUSED: could not write /etc/1bit/onebit-models.txt from the payload catalogue" >&2 exit 1; } + # engine#1557: `payload=` is a LABEL (the tarball stem, which the console shows and no in-image fact can equal), so the + # identity also carries one fact about the payload that a machine CAN check: the version string the payload's own + # launcher reports. It is read from the bytes here, not from the environment, and the build refuses if it cannot be read - + # a payload that cannot say what it is has no business claiming a name. + payload_lemond=$("$PAYLOAD/lemond-onebit" --version 2> /dev/null | sed -n 's/^lemond version //p' | head -1) + [ -n "$payload_lemond" ] || { + echo "build: REFUSED: $PAYLOAD/lemond-onebit --version printed no version, so the identity cannot state which payload this is (engine#1557)" >&2 + exit 1; } { echo "payload=${PAYLOAD_NAME:-unknown}" + echo "payload_lemond=$payload_lemond" echo "engine_sha256=$(sha256sum /payload/1bit/1bit | cut -c1-64)" if [ -n "${LIBHSA_DIR:-}" ]; then echo "libhsa_sha256=$(sha256sum /libhsa-runtime/libhsa-runtime64.so.1 | cut -c1-64)"