#!/bin/bash # Regenerate the committed number traces from a pinned SQLite. # # The amalgamation is fetched from sqlite.org and checked against its SHA-256, # so the oracle is content-addressed rather than whatever sqlite3 happens to be # on PATH. Only this script reaches the network, and only under # REGEN=1 dune build @traces: a normal build reads the traces as committed # source. # # The pin is the newest SQLite release. It is deliberately not "3.54.0", the # version these packages otherwise quote: there is no 3.54.0 release (the # release history goes 3.53.0 on 2026-04-09 to 3.53.4 on 2026-07-24, and # sqlite.org serves no sqlite-amalgamation-3540000.zip). The 3.54.0 in question # is what macOS reports for /usr/bin/sqlite3 -- source id # "2026-04-09 12:25:13 8fa8248e...aapl", Apple's build of trunk taken minutes # after the 3.53.0 release, when trunk already carried the next version number. # Pinning here follows the releases, which are archived and hashed; the CLI # stays the cross-check. set -euo pipefail VERSION=3.53.4 ZIP=sqlite-amalgamation-3530400 URL=https://sqlite.org/2026/$ZIP.zip SHA256=1e71ddf93849c6a6ecf58b827c0692073d2dd7ee40196158068f7b29f422e87d command -v curl >/dev/null || { echo "curl not on PATH" >&2; exit 1; } command -v cc >/dev/null || { echo "cc not on PATH" >&2; exit 1; } SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" TRACE_DIR="$(cd "${1:-$SCRIPT_DIR/../traces}" && pwd)" BUILD="${BUILD_DIR:-$SCRIPT_DIR/.gen}" mkdir -p "$BUILD" cd "$BUILD" if [ ! -f "$ZIP/sqlite3.c" ]; then curl -sSL -o "$ZIP.zip" "$URL" got=$(shasum -a 256 "$ZIP.zip" | cut -d' ' -f1) if [ "$got" != "$SHA256" ]; then echo "$ZIP.zip: sha256 $got, expected $SHA256" >&2 exit 1 fi unzip -oq "$ZIP.zip" fi cc -O2 -I "$ZIP" -o oracle "$SCRIPT_DIR/oracle.c" "$ZIP/sqlite3.c" -lm -lpthread ./oracle "$TRACE_DIR" echo "wrote $TRACE_DIR/{reals,subnormals,literals,sqlite-version}.txt" \ "from SQLite $VERSION"