Git guard: set -a / assignment shapes the reader misses (if/while/time/eval/\set/redirect, functions, read/printf -v/${:=}/for) let an exported GIT_DIR through #94

Open
opened 2026-11-23 07:22:01 +00:00 by mars · 1 comment
Member

Purpose (bug): the git guard's shell-line reader stops letting a push through from the worktree when bash would export GIT_DIR, through any of the shapes below.

Found by the fable review of #67 PR 90 r=1 (comment 1390). Every shape is also blind at aadf83c4, before PR 90, so it sits outside that package's diff. Supervisor ruling 2026-11-23: file it as its own issue, behind macula-fleet#8.

Shapes the reader does not see, while bash exports GIT_DIR

Proof for each: env -u GIT_DIR bash -c '<line>; env' | grep -c '^GIT_DIR=' prints 1 (bash 5.3.20). Through the full guard path, a following git push is judged at the worktree.

A set -a the reader misses, because it is not at a command position it knows:

  • if set -a; then GIT_DIR=/c/.git; fi
  • while set -a; do GIT_DIR=/c/.git; break; done
  • time set -a; GIT_DIR=/c/.git
  • eval set -a; GIT_DIR=/c/.git
  • \set -a; GIT_DIR=/c/.git
  • >/dev/null set -a; GIT_DIR=/c/.git

A function body:

  • f() { set -a; local GIT_DIR=/c/.git; env; }; f

An assignment the reader does not read as one, under set -a:

  • set -a; read GIT_DIR <<< /c/.git
  • set -a; printf -v GIT_DIR %s /c/.git
  • set -a; : "${GIT_DIR:=/c/.git}"
  • set -a; for GIT_DIR in /c/.git; do :; done

Noisy direction (the reader says exported, bash does not; notes only): set -a; export -n GIT_DIR=..., set - -a, set -e - -a, true | set -a.

Done when

  • Each shape above has a test, named after the shape, that fails on the current reader and passes on the fix.
  • A differential script runs the reader against real bash over every listed line, with 0 blind mismatches.

An option, not decided

A reader that approximates bash will keep finding holes like these. One option is that the guard refuses any set/declare/read/printf -v shape it cannot classify, instead of letting it through. That would be a new refusal, so it needs Raf's yes naming the harm (the no-new-checks rule). The Supervisor puts it to him when this issue is picked up, not now.

Refs #67, #53, #68.

Purpose (bug): the git guard's shell-line reader stops letting a push through from the worktree when bash would export GIT_DIR, through any of the shapes below. Found by the fable review of #67 PR 90 r=1 (comment 1390). Every shape is also blind at aadf83c4, before PR 90, so it sits outside that package's diff. Supervisor ruling 2026-11-23: file it as its own issue, behind macula-fleet#8. ## Shapes the reader does not see, while bash exports GIT_DIR Proof for each: `env -u GIT_DIR bash -c '<line>; env' | grep -c '^GIT_DIR='` prints 1 (bash 5.3.20). Through the full guard path, a following `git push` is judged at the worktree. A set -a the reader misses, because it is not at a command position it knows: - `if set -a; then GIT_DIR=/c/.git; fi` - `while set -a; do GIT_DIR=/c/.git; break; done` - `time set -a; GIT_DIR=/c/.git` - `eval set -a; GIT_DIR=/c/.git` - `\set -a; GIT_DIR=/c/.git` - `>/dev/null set -a; GIT_DIR=/c/.git` A function body: - `f() { set -a; local GIT_DIR=/c/.git; env; }; f` An assignment the reader does not read as one, under set -a: - `set -a; read GIT_DIR <<< /c/.git` - `set -a; printf -v GIT_DIR %s /c/.git` - `set -a; : "${GIT_DIR:=/c/.git}"` - `set -a; for GIT_DIR in /c/.git; do :; done` Noisy direction (the reader says exported, bash does not; notes only): `set -a; export -n GIT_DIR=...`, `set - -a`, `set -e - -a`, `true | set -a`. ## Done when - Each shape above has a test, named after the shape, that fails on the current reader and passes on the fix. - A differential script runs the reader against real bash over every listed line, with 0 blind mismatches. ## An option, not decided A reader that approximates bash will keep finding holes like these. One option is that the guard refuses any `set`/`declare`/`read`/`printf -v` shape it cannot classify, instead of letting it through. That would be a new refusal, so it needs Raf's yes naming the harm (the no-new-checks rule). The Supervisor puts it to him when this issue is picked up, not now. Refs #67, #53, #68.
mars changed title from Git guard: set -a / assignment shapes the reader misses (if/while/time/eval/\\set/redirect, functions, read/printf -v/${:=}/for) let an exported GIT_DIR through to Git guard: set -a / assignment shapes the reader misses (if/while/time/eval/\set/redirect, functions, read/printf -v/${:=}/for) let an exported GIT_DIR through 2026-11-23 07:22:07 +00:00
Author
Member

One more shape found at #67 PR 90 r=2 (24756f74). It is also blind at 17048c2a:

  • set -oo pipefail allexport; GIT_DIR=/c/.git; git push: in bash two o's take two words, so allexport is on and GIT_DIR is exported; the reader takes one word and judges the push at the worktree.
One more shape found at #67 PR 90 r=2 (24756f74). It is also blind at 17048c2a: - `set -oo pipefail allexport; GIT_DIR=/c/.git; git push`: in bash two o's take two words, so allexport is on and GIT_DIR is exported; the reader takes one word and judges the push at the worktree.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
martha-ai/martha#94
No description provided.