From dbe1db4b03cd1b9cdfcc1d91ca6ce2a5f042d873 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 12 Aug 2026 04:59:22 -0700 Subject: [PATCH] Read the remote database without depending on bsdtar The partial-tree guard parsed omarchy.db with bsdtar, which is not installed on the repository host. Every sync there aborted with "the remote database exists but could not be read" -- a guard meant to catch a partial tree instead blocked a complete one, stopping a publish after sign, promote and update had already succeeded. GNU tar reads the database fine when it is a seekable file; the pipe was what defeated it originally, and that is already downloaded to a temp file. tar now leads, with bsdtar as a fallback for a tar too old to detect zstd. Co-Authored-By: Claude Opus 5 (1M context) --- bin/sync-repo | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bin/sync-repo b/bin/sync-repo index fc8394f..b0574c1 100755 --- a/bin/sync-repo +++ b/bin/sync-repo @@ -141,14 +141,24 @@ if grep -qx 'omarchy\.db' <<<"$REMOTE_LISTING"; then REMOTE_DB_FILE=$(mktemp) trap 'rm -f "$REMOTE_DB_FILE"' EXIT rclone cat "$REMOTE/$DESTINATION_DIRECTORY/omarchy.db" --s3-no-head >"$REMOTE_DB_FILE" 2>/dev/null - REMOTE_NAMES=$(bsdtar -tf "$REMOTE_DB_FILE" 2>/dev/null | sed 's|/.*||' | - sed -E 's/-[^-]+-[^-]+$//' | sort -u) + + # Download to a file rather than piping: GNU tar detects the compression from + # a seekable archive but not from a pipe, and the database has been both gzip + # and zstd over its life. bsdtar reads either too, but it is not present on + # every host, so tar leads and bsdtar covers a tar too old for zstd. + REMOTE_ENTRIES=$(tar -tf "$REMOTE_DB_FILE" 2>/dev/null) + if [[ -z "$REMOTE_ENTRIES" ]] && command -v bsdtar >/dev/null 2>&1; then + REMOTE_ENTRIES=$(bsdtar -tf "$REMOTE_DB_FILE" 2>/dev/null) + fi + + REMOTE_NAMES=$(printf '%s\n' "$REMOTE_ENTRIES" | sed 's|/.*||' | + sed -E 's/-[^-]+-[^-]+$//' | sort -u | grep -v '^$') if [[ -z "$REMOTE_NAMES" ]]; then print_error "The remote database exists but could not be read" echo "" echo "Refusing to sync rather than assume the remote is empty. Check that" - echo "bsdtar is installed and that omarchy.db is not corrupt." + echo "omarchy.db is not corrupt: rclone cat $REMOTE/$DESTINATION_DIRECTORY/omarchy.db | tar -t" exit 1 fi