--- id: "bug-1616" status: "fixed" status_updated: "2026-09-24" status_note: "" component: "build" severity: "unknown" timestamp: "2026-08-21T00:00:00Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 1 files: ["src/tools/test-dirty-fingerprint-nix-production-path.sh"] tags: ["bash", "set-u", "local", "unbound-variable", "dirty-content-fingerprint", "task-6.3", "src/tools", "recurring-pattern"] related: ["bug-1615"] legacy: true --- # bug-1616: src/tools/test-dirty-fingerprint-nix-production-path.sh: line 191: flag: unbound variable ## Description src/tools/test-dirty-fingerprint-nix-production-path.sh: line 191: flag: unbound variable ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause extract_flag_from_json()'s `local json="$1" flag="$2" needle="-D${flag}="` recurred the exact same-statement `local` cross-reference gotcha already documented as bug-1615 (test-dirty-fingerprint-distinguishability.sh's capture_version()): bash expands every word of a single `local` command before any of that command's own assignments take effect, so `${flag}` in the third word's value expanded against the not-yet-declared `flag`, an unbound-variable error under `set -u`. ## Fix Split into two separate `local` statements (`local json="$1" flag="$2"` then `local needle="-D${flag}="` on its own line), with an inline comment citing bug-1615 explicitly so a future reader recognizes the pattern immediately instead of re-discovering it. Confirmed via `bash -n` plus a full real end-to-end script run (exit 0). ## Verification _Not recorded (migrated from buglog.json)._ ## References - Related: bug-1615