From 00284c5faa57b80cf0fe29294e5dac479fdf40f8 Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Mon, 12 Oct 2026 18:46:32 -0500 Subject: [PATCH 1/4] Fix `make pgtle` ignoring failures for all but the last extension The `pgtle` recipe joined its per-extension `pgtle.sh` calls with `;`, so the target's exit status was that of the last call only. Chain them with `&&` (ending in `true`) so a failure for any extension fails the target. Fixes #140 Co-Authored-By: Claude Haiku 5.5 --- HISTORY.asc | 11 +++++++++++ base.mk | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/HISTORY.asc b/HISTORY.asc index 3d588c0..77ec00e 100644 --- a/HISTORY.asc +++ b/HISTORY.asc @@ -1,3 +1,14 @@ +STABLE +------ +== Bug fixes + +=== Fix `make pgtle` ignoring failures for all but the last extension +In a project with more than one extension, `make pgtle` exited 0 if +`pgtle.sh` failed for any extension other than the last one. It now fails +as soon as any extension fails. + +Issues fixed in this release: #140 + 2.4.0 ----- == Breaking changes diff --git a/base.mk b/base.mk index 36c7e79..31cbe68 100644 --- a/base.mk +++ b/base.mk @@ -604,9 +604,11 @@ _PGXNTOOL_EXTENSIONS = $(basename $(_PGXNTOOL_CONTROL_FILES)) # "which pg_tle to test against" env var (see issue #78) -- that collided # with this variable silently instead of erroring. .PHONY: pgtle +# Chained with && so a failure for any extension, not just the last, fails +# the target. pgtle: all control.mk $(_PGXNTOOL_CONTROL_FILES) @$(foreach ext,$(_PGXNTOOL_EXTENSIONS),\ - $(PGXNTOOL_DIR)/pgtle.sh --extension $(ext) $(if $(PGXNTOOL_PGTLE_VERSION),--pgtle-version $(PGXNTOOL_PGTLE_VERSION));) + $(PGXNTOOL_DIR)/pgtle.sh --extension $(ext) $(if $(PGXNTOOL_PGTLE_VERSION),--pgtle-version $(PGXNTOOL_PGTLE_VERSION)) &&) true # # pg_tle installation support From 2cb513505a8ccda781d97b79d8b573cb840504ca Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Wed, 14 Oct 2026 14:11:37 -0500 Subject: [PATCH 2/4] Fix recipe loops ignoring failures before the last iteration `results`, `results-build`, `print-pgtle` and the test/install schedule rule each run one command per file or extension inside a shell loop. A loop's status is only its last command's, so a failure partway through was ignored. `results-build` also discarded the last copy's status, behind its trailing skipped-file check. Each command now ends in `|| exit 1`, matching the `make pgtle` fix. The HISTORY.asc entry for #140 now covers every affected target. --- HISTORY.asc | 20 ++++++++++++++++---- base.mk | 8 ++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/HISTORY.asc b/HISTORY.asc index 77ec00e..79ddf83 100644 --- a/HISTORY.asc +++ b/HISTORY.asc @@ -2,10 +2,22 @@ STABLE ------ == Bug fixes -=== Fix `make pgtle` ignoring failures for all but the last extension -In a project with more than one extension, `make pgtle` exited 0 if -`pgtle.sh` failed for any extension other than the last one. It now fails -as soon as any extension fails. +=== Fix targets that ignored a failure partway through a loop +Several targets run one command per file or per extension, and a failure +of any command but the last was ignored. They now fail as soon as any one +command fails: + +* `make pgtle` exited 0 if `pgtle.sh` failed for any extension other than + the last one. +* `make results` exited 0 if copying any `test/results/*.out` file other + than the last one into `test/expected/` failed. +* `make results-build` exited 0 if copying any file into + `test/build/expected/` failed, including the last one. +* `make print-pgtle` exited 0 if reading the generated SQL for any + extension other than the last one failed. +* With `PGXNTOOL_ENABLE_TEST_INSTALL=yes`, a failed write to + `test/install/schedule` for any file other than the last one left an + incomplete schedule without an error. Issues fixed in this release: #140 diff --git a/base.mk b/base.mk index 31cbe68..40fc5d3 100644 --- a/base.mk +++ b/base.mk @@ -423,7 +423,7 @@ REGRESS_OPTS += --schedule=$(_PGXNTOOL_INSTALL_SCHEDULE) $(_PGXNTOOL_INSTALL_SCHEDULE): @echo "# Auto-generated - DO NOT EDIT" > $@ @for f in $(notdir $(basename $(TEST_INSTALL_SQL_FILES))); do \ - echo "test: ../install/$$f" >> $@; \ + echo "test: ../install/$$f" >> $@ || exit 1; \ done installcheck: $(_PGXNTOOL_INSTALL_SCHEDULE) @@ -579,7 +579,7 @@ endif @mkdir -p $(TESTDIR)/expected @for f in $(TESTOUT)/results/*.out; do \ [ -f "$$f" ] || continue; \ - cp "$$f" $(TESTDIR)/expected/$$(basename "$$f"); \ + cp "$$f" $(TESTDIR)/expected/$$(basename "$$f") || exit 1; \ done # testdeps is a generic dependency target that you can add targets to @@ -672,7 +672,7 @@ print-pgtle: pgtle echo "ERROR: $$f does not exist (run 'make pgtle' first)" >&2; \ exit 1; \ fi; \ - cat "$$f";) + cat "$$f" || exit 1;) # These targets ensure all the relevant directories exist $(TESTDIR)/sql/ $(TESTDIR)/expected/ $(TESTOUT)/results/: @@ -781,7 +781,7 @@ results-build: echo " cp $$f $(TESTDIR)/build/expected/$$(basename "$$f")" >&2; \ skipped=1; continue; \ fi; \ - cp "$$f" $(TESTDIR)/build/expected/$$(basename "$$f"); \ + cp "$$f" $(TESTDIR)/build/expected/$$(basename "$$f") || exit 1; \ done; \ [ "$$skipped" = 0 ] || exit 1 endif From 3e33b4a725b96774ecd3697ed7755a736d9f303d Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Wed, 14 Oct 2026 15:02:50 -0500 Subject: [PATCH 3/4] HISTORY: correct lead sentence for partway-through failures The lead sentence said a failure of any command but the last was ignored, but the results-build entry covers the last command too. --- HISTORY.asc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.asc b/HISTORY.asc index 79ddf83..8ebcb06 100644 --- a/HISTORY.asc +++ b/HISTORY.asc @@ -4,7 +4,7 @@ STABLE === Fix targets that ignored a failure partway through a loop Several targets run one command per file or per extension, and a failure -of any command but the last was ignored. They now fail as soon as any one +partway through was ignored. They now fail as soon as any one command fails: * `make pgtle` exited 0 if `pgtle.sh` failed for any extension other than From a634a26fcd9e5cf2463c9ec66c29176072fce698 Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Wed, 14 Oct 2026 15:15:01 -0500 Subject: [PATCH 4/4] Run the `make pgtle` calls in a shell loop with `|| exit 1` `pgtle` now calls `pgtle.sh` once per extension inside a shell `for` loop, with `|| exit 1` on each call. That is the form the `results`, `results-build` and test/install schedule loops already use. It still stops at the first extension that fails. The calls, their arguments and order, and make's exit status are unchanged. --- base.mk | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/base.mk b/base.mk index 40fc5d3..f990b92 100644 --- a/base.mk +++ b/base.mk @@ -604,11 +604,10 @@ _PGXNTOOL_EXTENSIONS = $(basename $(_PGXNTOOL_CONTROL_FILES)) # "which pg_tle to test against" env var (see issue #78) -- that collided # with this variable silently instead of erroring. .PHONY: pgtle -# Chained with && so a failure for any extension, not just the last, fails -# the target. pgtle: all control.mk $(_PGXNTOOL_CONTROL_FILES) - @$(foreach ext,$(_PGXNTOOL_EXTENSIONS),\ - $(PGXNTOOL_DIR)/pgtle.sh --extension $(ext) $(if $(PGXNTOOL_PGTLE_VERSION),--pgtle-version $(PGXNTOOL_PGTLE_VERSION)) &&) true + @for ext in $(_PGXNTOOL_EXTENSIONS); do \ + $(PGXNTOOL_DIR)/pgtle.sh --extension $$ext $(if $(PGXNTOOL_PGTLE_VERSION),--pgtle-version $(PGXNTOOL_PGTLE_VERSION)) || exit 1; \ + done # # pg_tle installation support