Artifact 5de7f7f0fcf59a0ed8295b6e058497b788da6e72f0b3d9cf5baf8852a77ece33:
- File
tools/filc.sh
— part of check-in
[2f274ce15b]
at
2026-11-12 22:28:09
on branch trunk
— Phase 2: the store, a working copy that is never half written
The store is a working copy of a wardrobe, kept through libfossil's C API with suit's own file writer: every file is written beside itself and renamed, so a reader sees the old file or the new one.
suit store open, status and update, suit commit and suit back. An update refuses when there are local changes, runs as a dry run first, and changes nothing if any file would conflict.
Proven here: the store is byte-identical to fossil's own checkout of a 600-file wardrobe at each version; a reader hashing files during a slowed update saw only old or new contents; an update that fails at any call leaves the old bytes and no temporary file. 100% of functions, lines, regions and branches in all ten source files.
Vendored, unedited: libfossil trunk f2983dcd78, SQLite 3.55.0, zlib 1.3.1. The release binary links only the system library.
Speed: with everything linked, suit costs 0.82 ms over an empty program quiet and up to 1.38 ms under load, which is over budget. The timer's entry point is now suit-run, a 35 KB program built from the no-change path alone, at 0.40 ms quiet and about 0.5 ms loaded. It runs suit only when something changed. The budget test is on suit-run.
Known limits, recorded in docs/decisions.md: libfossil's checkout writes symlinks as regular files, so wardrobes may not hold them; suit back undoes an update and not a check-in; and a store left half updated by a double failure has no repair command yet.
Not yet run: Fil-C and the Linux build of this phase. (user: dmestas, size: 2043) [annotate] [blame] [check-ins using]
#!/bin/sh # Builds suit with Fil-C and runs the unit tests, the shell suite and every # fuzz seed and saved corpus file under it. Fil-C runs on Linux x86_64 and # aarch64 only; elsewhere this says so and exits 0. # # The toolchain is pinned by version and SHA-256 and kept in FILC_HOME # (default ~/.cache/suit-filc). A warm cache downloads nothing: the tarball is # verified against its SHA-256 once, when it is unpacked, and a marker file # records that. SQLite, libfossil and zlib are vendored and compiled with Fil-C # by `make filc-run` along with suit, so there is no separate zlib to build. set -eu VER=0.687 case "$(uname -s)-$(uname -m)" in Linux-x86_64) ARCH=x86_64 SHA=aab538401f78a47ab261ee79afed8c6b99e1d4848e263ae159a75b03c1288da1 ;; Linux-aarch64) ARCH=aarch64 SHA=f1337799051664f93c7712141deaebe78571ae96ffcf05563d517b89440bcbc0 ;; *) echo "filc: Fil-C does not run on $(uname -s) $(uname -m); skipped"; exit 0 ;; esac H=${FILC_HOME:-$HOME/.cache/suit-filc} F=$H/filc-$VER-linux-$ARCH TARBALL=$H/filc-$VER-$ARCH.tar.xz READY=$F/.suit-verified-$SHA mkdir -p "$H" # download URL FILE: wget, or python3 if there is no wget. download() { if command -v wget >/dev/null 2>&1; then wget -q -O "$2" "$1" else python3 -I - "$1" "$2" <<'PY' import sys, urllib.request urllib.request.urlretrieve(sys.argv[1], sys.argv[2]) PY fi } verified() { # sha file [ -f "$2" ] && echo "$1 $2" | sha256sum -c --quiet 2>/dev/null } if [ ! -f "$READY" ] || [ ! -x "$F/build/bin/clang" ]; then if ! verified "$SHA" "$TARBALL"; then echo "filc: fetching Fil-C $VER for $ARCH" download "https://github.com/pizlonator/fil-c/releases/download/v$VER/filc-$VER-linux-$ARCH.tar.xz" "$TARBALL.part" verified "$SHA" "$TARBALL.part" || { rm -f "$TARBALL.part"; echo "filc: checksum mismatch for the Fil-C $VER download" >&2; exit 1; } mv "$TARBALL.part" "$TARBALL" fi rm -rf "$F" && tar xJf "$TARBALL" -C "$H" (cd "$F" && ./setup.sh >/dev/null) : > "$READY" fi exec make filc-run FILCC="$F/build/bin/clang"