interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / check / receipt.sh

22 lines · 1195 bytes Raw Blame History
1#!/bin/sh
2# receipt.sh OUT REC [FILE...] -- compare a gate run's results (OUT, under build/) with the recorded receipt
3# (REC, under evidence/). REC is only read: a rerun never writes a recorded receipt (evidence/ is additions
4# only, OMEGA-EVIDENCE-IMMUTABLE). Each file in OUT whose name REC also holds is compared byte for byte,
5# except *.log (a log carries the run's date and commit). Each FILE, a recorded copy kept outside REC
6# (seed/rung4/om4.audit), is compared with OUT/<its name>. Prints one line. Exit 0: all the same;
7# 1: some differ; 2: no receipt (REC empty or missing), nothing compared.
8set -eu
9out=$1; rec=$2; shift 2
10if [ -z "$rec" ] || [ ! -d "$rec" ]; then echo "receipt ${rec:-(none)}: none recorded, nothing compared"; exit 2; fi
11n=0; d=""
12for f in "$out"/*; do
13 b=${f##*/}
14 case $b in *.log) continue ;; esac
15 [ -f "$f" ] && [ -f "$rec/$b" ] || continue
16 n=$((n + 1)); cmp -s "$f" "$rec/$b" || d="$d $b"
17done
18for r in "$@"; do
19 n=$((n + 1)); cmp -s "$out/${r##*/}" "$r" || d="$d $r"
20done
21if [ -z "$d" ]; then echo "receipt $rec: $n files compared, all the same (not rewritten)"; exit 0; fi
22echo "receipt $rec: $n files compared, differ (not rewritten):$d"; exit 1