Repository navigation
Description
lib/sh/secrets.sh reads a file's mode and owner with GNU stat -c, at secret_shape_verdict (stat -c '%a' and stat -c '%U'). It also splits a path with readarray -d / in secret_state, which needs bash 4.4 or later. docs/host-setup.md lists macOS as a supported host-install platform. On a stock macOS host, BSD stat rejects -c and the system bash is 3.2. So every present secret file is refused with "the mode of ... could not be read", or the path walk fails, whatever the file's actual mode.
Why It Matters Now
The #3932 change, configure.sh apply's secrets group, is the first caller that puts the library on a hub-checkout path a macOS maintainer host runs. On macOS that group would refuse every secret, set nothing, and exit non-zero after every other group was applied. Before #3932, the library's only callers ran on Linux hosts carrying a host-secrets repository.
Reproduce
On macOS with no GNU coreutils on PATH, construct a private file and ask the library about it:
d="$(mktemp -d)"; printf 'x' > "$d/example"; chmod 600 "$d/example"
bash -c '. lib/sh/secrets.sh; secret_verdict "$1"' _ "$d/example"The expected answer is readable. The answer on BSD stat is a refused sentence about an unreadable mode.
Proposal
Read the mode and owner portably, choosing stat -f '%Lp'/%Su where stat -c is unavailable, or one probe chosen once. Replace readarray -d with a loop that runs on bash 3.2, or state a bash 4.4 floor that host_gate.py enforces on macOS. Then extend tests/test_secrets_sh.py to cover whichever probe is chosen. The library is carried byte-for-byte, so the fix lands here at its canonical source.
🤖 Generated with Claude Code
Activity
Provision a Repository's Secrets From the Host's Secrets Directory (#…
ptr727 commentedon Nov 24, 2026
The away-mode backlog-burndown run (2026-11-24, round 3) split this issue's one open choice, a bash 3.2 loop versus a bash 4.4 floor for
readarray -d, into decision #4408. This issue stays held for a macOS host, since the defect reproduces only there and no CI job runs on macOS. The portablestathalf needs no answer.ptr727 commentedon Nov 25, 2026
Decision #4408 is answered (2026-11-25): macOS gets a bash 4.4 floor, enforced by
scripts/host_gate.pythrough abashentry inspec/host-tools.json.lib/sh/secrets.shkeepsreadarray -d. The portablestathalf of this issue is unchanged.