From a00c76de794e44530a6668eb9b58032f2e3e0ae0 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 Oct 2026 10:58:16 -0700 Subject: [PATCH 1/2] Document cronic's bash 3.2 requirement; fix the tense of a test comment --- cronic | 2 ++ tests/cronic-test/cronic-test.sh | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cronic b/cronic index b26d786..8d964ab 100755 --- a/cronic +++ b/cronic @@ -14,6 +14,8 @@ # --duplicate-stderr options, which may be given in any order. # The options and the treatment of execution traces are documented in function # `cronic_help`; run `cronic --help`. +# This script runs under bash 3.2, which is /bin/bash on macOS, so it uses a +# feature of a later bash only after checking the version. # Exit if a command exits with a non-zero status, and treat unset variables # as an error. diff --git a/tests/cronic-test/cronic-test.sh b/tests/cronic-test/cronic-test.sh index 7b62509..a0ca67e 100755 --- a/tests/cronic-test/cronic-test.sh +++ b/tests/cronic-test/cronic-test.sh @@ -6,9 +6,9 @@ # # `cronic` filters trace lines out of stderr with `grep -v`, which exits with # status 1 when it selects no lines. `cronic` runs under `set -e`, so an -# unguarded `grep -v` aborted the script at that point: no report was printed, -# the exit status was grep's 1 rather than the wrapped command's, and all of -# the temporary files under /tmp were left behind. +# unguarded `grep -v` would abort the script at that point: no report would be +# printed, the exit status would be grep's 1 rather than the wrapped command's, +# and the temporary files would be left behind. set -eu From 74832afe34a13b333f7523308eefae8f227ae749 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 Oct 2026 11:57:59 -0700 Subject: [PATCH 2/2] State correctly that cronic's EXIT trap removes its temporary files after a set -e abort --- cronic | 4 ++-- tests/cronic-test/cronic-test.sh | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cronic b/cronic index 8d964ab..34f5294 100755 --- a/cronic +++ b/cronic @@ -202,8 +202,8 @@ cronic_pattern=$(cronic_trace_pattern) if [ -n "$cronic_pattern" ] && grep -q "$cronic_pattern" "$cronic_trace"; then # `|| true` because `grep -v` exits with status 1 when it selects no lines, # which happens whenever stderr consists only of trace lines. Without it, - # `set -e` would abort the script here, before it produces its report, - # exits with the wrapped command's status, and removes its temporary files. + # `set -e` would abort the script here, before it produces its report, and + # it would exit with status 1 rather than with the wrapped command's status. grep -v "$cronic_pattern" "$cronic_trace" > "$cronic_err" || true else cronic_err=$cronic_trace diff --git a/tests/cronic-test/cronic-test.sh b/tests/cronic-test/cronic-test.sh index a0ca67e..2b91289 100755 --- a/tests/cronic-test/cronic-test.sh +++ b/tests/cronic-test/cronic-test.sh @@ -7,8 +7,9 @@ # `cronic` filters trace lines out of stderr with `grep -v`, which exits with # status 1 when it selects no lines. `cronic` runs under `set -e`, so an # unguarded `grep -v` would abort the script at that point: no report would be -# printed, the exit status would be grep's 1 rather than the wrapped command's, -# and the temporary files would be left behind. +# printed, and the exit status would be grep's 1 rather than the wrapped +# command's. (The temporary files would still be removed, by `cronic`'s EXIT +# trap, so the left-behind-files check in `check` does not detect that bug.) set -eu