From 7bb6a4e6e62889325879a465475f144d6b24978b Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Mon, 26 Oct 2026 19:00:41 +0100 Subject: [PATCH] Stop the refresh when a step inside a command substitution fails refresh-binding.sh, provision-meos.sh and ecosystem-generate.sh run each command substitution with errexit (shopt -s inherit_errexit), so a step that fails inside one stops the script as it does outside one. resolve_repo, which refresh-binding.sh calls inside a substitution, stops at a fetch of a ref the remote does not have instead of checking out the commit fetched before it and answering its path. Every substitution whose failure the scripts expect keeps its own fallback (`|| echo unknown`), and missing_python_reqs answers the missing requirements with status 0. Witness: on master, `refresh-binding.sh --jmeos-ref 88e7ef03` over a work dir whose JMEOS clone holds main prints `fatal: couldn't find remote ref 88e7ef03`, then builds the JMEOS jar from main and runs the binding's suite to `chain rc=0`, as if it had derived from the ref asked for. With this change the same refresh stops there with status 128 and builds no jar. bash -c 'set -euo pipefail; f(){ false; echo path; }; v="$(f)"; echo continued' prints `continued`; with inherit_errexit it exits 1. --- tools/ecosystem-generate.sh | 2 ++ tools/provision-meos.sh | 2 ++ tools/refresh-binding.sh | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/tools/ecosystem-generate.sh b/tools/ecosystem-generate.sh index 8c556fd..fc76b8c 100755 --- a/tools/ecosystem-generate.sh +++ b/tools/ecosystem-generate.sh @@ -12,6 +12,8 @@ # branch (recorded below + in each binding's compose-order.txt). WORKDIR defaults to a $HOME # path (NEVER /tmp — it is reaped). set -euo pipefail +# A command substitution runs with errexit too, as in refresh-binding.sh. +shopt -s inherit_errexit PIN_REF="${1:?usage: ecosystem-generate.sh [workdir]}" WORK="${2:-$HOME/ecosystem-gen}" diff --git a/tools/provision-meos.sh b/tools/provision-meos.sh index cb82b02..25e2626 100755 --- a/tools/provision-meos.sh +++ b/tools/provision-meos.sh @@ -39,6 +39,8 @@ # catalog-path= # libmeos-prefix= set -euo pipefail +# A command substitution runs with errexit too, as in refresh-binding.sh. +shopt -s inherit_errexit usage() { sed -n '2,/^set -euo/{/^set -euo/d;s/^# \{0,1\}//;p;}' "$0"; } diff --git a/tools/refresh-binding.sh b/tools/refresh-binding.sh index b20f149..4871eb0 100755 --- a/tools/refresh-binding.sh +++ b/tools/refresh-binding.sh @@ -45,6 +45,10 @@ # --force Rebuild libmeos even when the MobilityDB commit is unchanged. # -h, --help set -euo pipefail +# A command substitution runs with errexit too, so a step that fails inside one stops the +# refresh: resolve_repo's fetch of a ref the remote does not have would otherwise leave the +# earlier checkout in place and the refresh would derive from it. +shopt -s inherit_errexit usage() { sed -n '2,/^set -euo/{/^set -euo/d;s/^# \{0,1\}//;p;}' "$0"; }