From e6da720e6b4148b364fe760716ca9dad81482be0 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 20 Aug 2026 20:20:58 -0400 Subject: [PATCH] packaging: drop assets that aren't there, instead of trusting nullglob MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `d77a798` added the Android client to publish-release.sh's asset list and broke the desktop lane's publish, which had been working (run 4094, curl exit 26 — "couldn't read local file"). The Android lane published fine, which is what made the shape of the mistake clear. `shopt -s nullglob` drops PATTERNS that match nothing. The two entries I added — `android/dist/thoughtsync.apk` and its sidecar — contain no wildcard, so they are not patterns at all: globbing leaves them in the array verbatim and curl is handed a path to a file that does not exist. In the Android job those files are there, so it worked; in the desktop job they never are, so it did not. Every entry is now filtered on existence, which is what the array has always meant. That covers the literal paths and the globs alike, rather than relying on each future entry containing a `*` to be safe — the trap that just cost a run. Verified both ways before pushing: a literal missing path survives nullglob and is removed by the filter, and an all-empty result still exits cleanly under `set -u`. --- desktop/packaging/publish-release.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/desktop/packaging/publish-release.sh b/desktop/packaging/publish-release.sh index f3b18f2..ae27987 100755 --- a/desktop/packaging/publish-release.sh +++ b/desktop/packaging/publish-release.sh @@ -74,6 +74,18 @@ ASSETS=( "$REPO_ROOT"/android/dist/thoughtsync.apk "$REPO_ROOT"/android/dist/thoughtsync-android.json ) +# nullglob drops PATTERNS that match nothing — it does nothing for a path with no +# wildcard in it, which stays in the array as a literal and reaches curl as a file +# that isn't there (exit 26). The Android entries above are exactly that shape, and +# adding them broke the desktop publish that had been working. Filter on existence +# instead, which is what the array actually means and covers every entry rather +# than only the ones that happen to contain a `*`. +present=() +for a in "${ASSETS[@]}"; do + [ -f "$a" ] && present+=("$a") +done +ASSETS=("${present[@]}") + if [ ${#ASSETS[@]} -eq 0 ]; then echo "ERROR: nothing to publish — no desktop bundles under $BUNDLE_ROOT and no APK under $REPO_ROOT/android/dist." >&2 exit 1