fleetd #550: portable hash256 helper for jar_id, Linux CI job for the shell suite #554
Reference in New Issue
Block a user
Delete Branch "worker/550-shasum-linux-196132-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes fleetd #550.
Item 1 (
scripts/redeploy-fleetd.sh):jar_idcalledshasumdirectly. On GNU coreutils Linux (noshasum), the command-not-found madecutsucceed on empty input; underpipefailthe pipeline still failed, and the caller's own|| echo "absent"then reported an existing jar as gone, with exit 0. Added ahash256helper (prefersha256sum, fall back toshasum -a 256, same idiom asprobe-member-credentials.sh:273-279) and pointedjar_idat it.jar_idnow has three distinct answers:absent(file really isn't there), a 12-char hash (hashed successfully), orunhashable(file is there but neither hasher is on PATH).absentis never returned for a file that exists.Item 2 (
scripts/test-redeploy-fleetd.sh:298-299): same directshasumcall in the suite's own reference-hash computation, which is why the suite died at exit 127 on Linux with zeroFAIL:lines printed — indistinguishable from a clean pass by that count alone. Now useshash256too.Item 3 (
.gitea/workflows/ci.yml): added ashell-testsjob onubuntu-latestthat runsbash scripts/test-redeploy-fleetd.sh. Gated on the step's own exit code, not aFAIL:count — item 2 is the proof that a count alone cannot be the gate.New tests in
scripts/test-redeploy-fleetd.sh:test_jar_id_reports_unhashable_when_no_hasher_on_path— drives the realjar_id/hash256through a stubbedPATHcontaining neither hasher (same stub-PATHtechnique astest_detect_supervisor_systemd_probe_setup_failure_is_unclear, but replacingPATHrather than prepending to it, since the point is to hide BOTH hashers).test_no_unguarded_macos_only_hasher_calls— a shape check across every script underscripts/, not named lines (per #545, this idiom already spread from 2 sites to 6 across 91 commits once).Verification (in the worker's own worktree, on macOS):
bash -nclean on both changed shell scripts, under both/bin/bash(3.2.57) andenv bash(5.3.9).^FAIL:lines, each time.comm -3(was 67/67 before this PR's two additions).shasum -a 256), each followed by a green control run.bash scripts/test-redeploy-fleetd.shon the real suite -> exit 0; on a deliberately broken copy (one assertion's expected value swapped) -> exit 1. Both exit codes shown, not just a comment.Never ran:
scripts/redeploy-fleetd.shitself, in any form — it restarts the live daemon.Caveat for review: the
hash256"neither hasher on PATH" branch was only exercised via a stubbedPATHon macOS (where both hashers exist for real); it has not been run on an actual Linux host with neithersha256sumnorshasuminstalled. The stub technique itself is the same one three existing tests in this suite already rely on.