Commitae0e7fcaRecorded23 Aug 2026Repositorysigil-doc

test: printf %02d read 08 as octal and killed the suite before its control

Message

printf '%02d' 08 in bash is "invalid octal number". It prints 00 AND returns non-zero, so under set -e the sabotage suite died immediately after leg 8 emitted a mislabelled SD_P8_SABOTAGE_00 marker -- and leg 9, the positive control that is the only leg proving the gate can stand DOWN, never ran.

It worked for legs 01-07 because those are valid octal, and failed for exactly 08 and 09. A formatting call that is correct for seven of nine inputs and wrong for the two that matter most is not something reading it was ever going to find.

leg_red formats the label with %s, since callers already pass it padded. pass keeps %02d -- its markers are matched by name elsewhere -- but coerces with 10# so a future padded caller cannot reacquire the bug.

Legs 1-7 all red at the assertion their expectations name, run against the seven-arm gate:

  01 the base profile reverts to (chapter)      -> the pinned literals
  02 the genre profile is misnamed              -> arm 01
  03 the parser stops enforcing multiplicity    -> arm 04, a required red flips
  04 the model accepts kind book again          -> arm 02
  05 a migrated manuscript gains a word         -> UNEXPECTED minimal.sgd
  06 the normalization is disabled              -> the identical-floor, with 17
                                                   unexpected and ROOT-ONLY intact
  07 a probe case is deleted                    -> arm 04's denominator
Changed
 test/gate-sd-p8.sh     |  7 ++++++-
 test/sabotage-sd-p8.sh | 16 ++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)
Diff
test/gate-sd-p8.shmodified
@@ -59,7 +59,12 @@ gate_dir=$(mktemp -d "$repo_dir/build/sd-p8-gate.XXXXXX")
59
export SIGIL_REDIRECTS="$redirects"
60
export XDG_CACHE_HOME="$gate_dir/cache"
61
−62
pass() { printf 'SD_P8_GATE_%02d %s\n' "$1" "$2"; }
+62
# ZERO-PADDED OUTPUT, BASE-10 INPUT. `%02d` on a zero-padded argument is a trap:
+63
# bash reads `08` as octal, raises "invalid octal number", prints 00 and returns
+64
# NON-ZERO -- which under `set -e` killed the sabotage suite immediately after
+65
# leg 8 printed a mislabelled marker, so leg 9 (the positive control) never ran.
+66
# `10#` forces base 10, so the markers stay padded and a padded caller is safe.
+67
pass() { printf 'SD_P8_GATE_%02d %s\n' "$((10#$1))" "$2"; }
68
die() { echo "$*" >&2; exit 1; }
69
70
# An absent tool does not announce itself -- it impersonates a result. Every
test/sabotage-sd-p8.shmodified
@@ -162,12 +162,24 @@ run_suite() { # $1 = log
162
return $rc
163
}
164
−165
leg_red() { # $1 = leg number, $2 = log, $3 = required substring
+165
# `%s`, NOT `%02d`, AND THE REASON IS WORTH THE LINE.
+166
#
+167
# Callers pass ZERO-PADDED labels (`01` … `09`). `printf '%02d' 08` in bash is
+168
# "invalid octal number": it prints `00` and RETURNS NON-ZERO. Under `set -e`
+169
# that killed this suite immediately after leg 8 printed a MISLABELLED marker
+170
# (`SD_P8_SABOTAGE_00`), so leg 9 -- the positive control, the only leg that
+171
# proves the gate can stand DOWN -- never ran.
+172
#
+173
# The shape is worth more than the fix: the call worked for legs 01-07 because
+174
# those are valid octal, and failed for exactly 08 and 09. A formatting bug that
+175
# is correct for seven of nine inputs and wrong for the two that matter most is
+176
# not going to be found by reading it.
+177
leg_red() { # $1 = leg label, $2 = log, $3 = required substring
178
rg -qF -- "$3" "$2" || {
179
echo "LEG $1: expected a red naming '$3'; got:" >&2
180
tail -25 "$2" >&2
181
exit 1; }
−170
printf 'SD_P8_SABOTAGE_%02d RED %s\n' "$1" "$3"
+182
printf 'SD_P8_SABOTAGE_%s RED %s\n' "$1" "$3"
183
}
184
185
# ---------------------------------------------------------------- LEG 01