fleetd #545: fix mktemp -t templates for GNU coreutils, split unclear-supervisor detail #548

Merged
ltms merged 1 commits from worker/545-mktemp-linux-3df50f-8 into main 2026-09-12 09:30:30 +02:00
Member

Fixes fleetd #545.

1. mktemp -t templates. All six mktemp -t NAME calls in scripts/redeploy-fleetd.sh lacked an X placeholder. BSD mktemp (macOS) tolerates that and appends its own suffix; GNU mktemp (every Linux distribution) refuses it and exits non-zero — mktemp: too few X's in template. All six sites now use .XXXXXX.

2. Split the unclear-supervisor detail. detect_supervisor's unclear detail used to cover two different facts with one message that always named 'systemctl exited non-zero and reported an error on stderr' — even when systemctl was never run, because the mktemp call above failed first. SYSTEMD_LOADED_ERRORED/SYSTEMD_INSTALLED_ERRORED now carry a third value (2 = the probe's own mktemp setup failed) alongside the existing 1 (systemctl ran and answered badly on stderr), and detect_supervisor gives each its own detail text. kind stays unclear in both cases; require_drivable_supervisor is unchanged.

Tests added to scripts/test-redeploy-fleetd.sh:

  • test_mktemp_dash_t_templates_have_x_placeholders: source-text check, fails if any mktemp -t template lacks an X.
  • test_detect_supervisor_systemd_probe_setup_failure_is_unclear: proves the SET-UP-FAILED detail fires when mktemp itself fails (systemctl never runs).
  • test_detect_supervisor_systemd_probe_error_is_unclear: extended with assertions that the PROBE-ANSWERED-WITH-STDERR detail is present and the SET-UP-FAILED wording is absent, so swapping the two messages fails a test in both directions.

Verification (shell only, no Java changes):

  • bash scripts/test-redeploy-fleetd.sh: exit 0, anchored grep -c '^FAIL:' = 0 (unanchored count = 3, the suite's own pre-existing internal mutation-cell fixture lines).
  • bash -n clean on both scripts under /bin/bash 3.2.57(1)-release and env bash 5.3.9(1)-release.
  • Test functions defined vs invoked: 67/67, empty comm -3 (was 65/65 before this change).
  • Each of the 3 new/extended tests proven individually: applied a targeted mutation, confirmed the pristine tree read 0 occurrences of the mutated text beforehand, ran the suite and got exit 1 with that test's exact FAIL message, restored the file and confirmed shasum -a 256 matched the pre-mutation hash, then ran a green control (exit 0, 0 anchored FAILs).
  • scripts/redeploy-fleetd.sh itself was never executed, with any flag — verification is bash -n plus the sourced test suite only.

Out of scope, reported not fixed: searched the whole repo for other mktemp uses outside these two files; found only scripts/test-probe-member-credentials.sh:8, which already uses mktemp -d ... .XXXXXX and is not affected.

Fixes fleetd #545. **1. mktemp -t templates.** All six `mktemp -t NAME` calls in `scripts/redeploy-fleetd.sh` lacked an `X` placeholder. BSD mktemp (macOS) tolerates that and appends its own suffix; GNU mktemp (every Linux distribution) refuses it and exits non-zero — `mktemp: too few X's in template`. All six sites now use `.XXXXXX`. **2. Split the unclear-supervisor detail.** `detect_supervisor`'s `unclear` detail used to cover two different facts with one message that always named 'systemctl exited non-zero and reported an error on stderr' — even when systemctl was never run, because the mktemp call above failed first. `SYSTEMD_LOADED_ERRORED`/`SYSTEMD_INSTALLED_ERRORED` now carry a third value (2 = the probe's own mktemp setup failed) alongside the existing 1 (systemctl ran and answered badly on stderr), and `detect_supervisor` gives each its own detail text. `kind` stays `unclear` in both cases; `require_drivable_supervisor` is unchanged. **Tests added** to `scripts/test-redeploy-fleetd.sh`: - `test_mktemp_dash_t_templates_have_x_placeholders`: source-text check, fails if any `mktemp -t` template lacks an X. - `test_detect_supervisor_systemd_probe_setup_failure_is_unclear`: proves the SET-UP-FAILED detail fires when mktemp itself fails (systemctl never runs). - `test_detect_supervisor_systemd_probe_error_is_unclear`: extended with assertions that the PROBE-ANSWERED-WITH-STDERR detail is present and the SET-UP-FAILED wording is absent, so swapping the two messages fails a test in both directions. **Verification (shell only, no Java changes):** - `bash scripts/test-redeploy-fleetd.sh`: exit 0, anchored `grep -c '^FAIL:'` = 0 (unanchored count = 3, the suite's own pre-existing internal mutation-cell fixture lines). - `bash -n` clean on both scripts under `/bin/bash` 3.2.57(1)-release and `env bash` 5.3.9(1)-release. - Test functions defined vs invoked: 67/67, empty `comm -3` (was 65/65 before this change). - Each of the 3 new/extended tests proven individually: applied a targeted mutation, confirmed the pristine tree read 0 occurrences of the mutated text beforehand, ran the suite and got exit 1 with that test's exact FAIL message, restored the file and confirmed `shasum -a 256` matched the pre-mutation hash, then ran a green control (exit 0, 0 anchored FAILs). - `scripts/redeploy-fleetd.sh` itself was never executed, with any flag — verification is `bash -n` plus the sourced test suite only. **Out of scope, reported not fixed:** searched the whole repo for other `mktemp` uses outside these two files; found only `scripts/test-probe-member-credentials.sh:8`, which already uses `mktemp -d ... .XXXXXX` and is not affected.
agent added 1 commit 2026-09-12 09:23:23 +02:00
fleetd #545: fix mktemp -t templates for GNU coreutils, split unclear-supervisor detail
CI / contract (pull_request) Successful in 1m16s
CI / build (pull_request) Successful in 2m28s
a476a14f1c
Every mktemp -t template in redeploy-fleetd.sh lacked an X placeholder. BSD mktemp
(macOS) tolerates that and appends its own suffix; GNU mktemp (every Linux
distribution) refuses it and exits non-zero. All six sites now use .XXXXXX.

detect_supervisor's 'unclear' detail used to cover two different facts with one
message that always named 'systemctl exited non-zero and reported an error on
stderr' — even when systemctl was never run, because mktemp failed first. The
SYSTEMD_LOADED_ERRORED/SYSTEMD_INSTALLED_ERRORED flags now carry a third value
(2 = the probe's own mktemp setup failed) alongside the existing 1 (systemctl ran
and answered badly on stderr), and detect_supervisor gives each its own detail
text. kind stays 'unclear' in both cases; require_drivable_supervisor is unchanged.

Tests added to scripts/test-redeploy-fleetd.sh:
- test_mktemp_dash_t_templates_have_x_placeholders: source-text check, fails if
  any mktemp -t template lacks an X.
- test_detect_supervisor_systemd_probe_setup_failure_is_unclear: proves the
  SET-UP-FAILED detail when mktemp itself fails (systemctl never runs).
- test_detect_supervisor_systemd_probe_error_is_unclear: extended with assertions
  that the PROBE-ANSWERED-WITH-STDERR detail is present and the SET-UP-FAILED
  wording is absent, so swapping the two messages fails a test in both
  directions.
ltms merged commit 0b032f5a1a into main 2026-09-12 09:30:30 +02:00
ltms deleted branch worker/545-mktemp-linux-3df50f-8 2026-09-12 09:30:30 +02:00
Sign in to join this conversation.