Git guard: shell shapes still blind after #94 (stacked prefixes, a redirection after the command word, read/printf variants, case/select/getopts/declare -n/+=) #97

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

Purpose (defect): the git guard's shell-line reader sees GIT_DIR wherever bash would hand it to git, so no shell shape left over from #94 lets a push reach a clone it was not judged against.

Where these come from

Mars's fable review of PR 96 (#94, Vesta) at 75e75ae8, record PR 96 c1505. It ran a 130-line differential against real bash 5.3.20 (scripts and outputs in ~/.claude/sessions/mars-scratch/r96/: mine.mjs, mine.wt.out). At the tip, 35 lines are still blind: bash exports GIT_DIR and the reader misses it. None of them is one of the lines #94 lists, so they were not folded into PR 96 (no scope creep). They are listed here.

Still blind: cousins of #94's shapes

  • Stacked prefixes. afterAKeyword goes only one deep (read_the_git_calls_in_a_shell_line.ts:842 at 75e75ae8): if ! set -a, if command set -a, if >/dev/null set -a, time eval set -a, eval eval set -a, command eval set -a, eval command set -a, time -p set -a.
  • A redirection after the command word: set >/dev/null -a, set > /dev/null -a, <<< x set -a.
  • Quoted eval (a named limit of PR 96): eval "set -a", eval "export GIT_DIR=x".
  • read (:623): while read GIT_DIR; do git push; done <<< x under set -a or after export GIT_DIR; read GIT_DIR <<</c/.git (no space); read -p x GIT_DIR; read X GIT_DIR (a named limit); < <(…).
  • printf (:649): -vGIT_DIR, -v GIT_DIR -- %s x, -v GIT_DIR /c/.git, and formats other than one %s (a named limit).
  • Backslash-newline: set \⏎-a.

Blind and outside #94's list

case x in x) set -a;; esac; case … export GIT_DIR=…; select GIT_DIR in …; ((GIT_DIR=5)); getopts a GIT_DIR; declare -n r=GIT_DIR; r=…; GIT_DIR+=….

The class

Each shape the reader learns by name leaves its neighbours blind. The refuse-unknown option (refuse a git call whose shell line the reader cannot fully follow) is still the owner's choice, as #94 records. This issue keeps the list until that choice is made.

A check that fails mechanically

Each line above becomes a red-first test named after its shape, and a line in the differential against real bash (vesta-94-diff.mjs or a successor). A blind line fails by name.

Refs #94, PR 96.

Purpose (defect): the git guard's shell-line reader sees GIT_DIR wherever bash would hand it to git, so no shell shape left over from #94 lets a push reach a clone it was not judged against. ## Where these come from Mars's fable review of PR 96 (#94, Vesta) at 75e75ae8, record PR 96 c1505. It ran a 130-line differential against real bash 5.3.20 (scripts and outputs in ~/.claude/sessions/mars-scratch/r96/: mine.mjs, mine.wt.out). At the tip, 35 lines are still blind: bash exports GIT_DIR and the reader misses it. None of them is one of the lines #94 lists, so they were not folded into PR 96 (no scope creep). They are listed here. ## Still blind: cousins of #94's shapes - Stacked prefixes. `afterAKeyword` goes only one deep (read_the_git_calls_in_a_shell_line.ts:842 at 75e75ae8): `if ! set -a`, `if command set -a`, `if >/dev/null set -a`, `time eval set -a`, `eval eval set -a`, `command eval set -a`, `eval command set -a`, `time -p set -a`. - A redirection after the command word: `set >/dev/null -a`, `set > /dev/null -a`, `<<< x set -a`. - Quoted eval (a named limit of PR 96): `eval "set -a"`, `eval "export GIT_DIR=x"`. - read (:623): `while read GIT_DIR; do git push; done <<< x` under `set -a` or after `export GIT_DIR`; `read GIT_DIR <<</c/.git` (no space); `read -p x GIT_DIR`; `read X GIT_DIR` (a named limit); `< <(…)`. - printf (:649): `-vGIT_DIR`, `-v GIT_DIR -- %s x`, `-v GIT_DIR /c/.git`, and formats other than one %s (a named limit). - Backslash-newline: `set \⏎-a`. ## Blind and outside #94's list `case x in x) set -a;; esac`; `case … export GIT_DIR=…`; `select GIT_DIR in …`; `((GIT_DIR=5))`; `getopts a GIT_DIR`; `declare -n r=GIT_DIR; r=…`; `GIT_DIR+=…`. ## The class Each shape the reader learns by name leaves its neighbours blind. The refuse-unknown option (refuse a git call whose shell line the reader cannot fully follow) is still the owner's choice, as #94 records. This issue keeps the list until that choice is made. ## A check that fails mechanically Each line above becomes a red-first test named after its shape, and a line in the differential against real bash (vesta-94-diff.mjs or a successor). A blind line fails by name. Refs #94, PR 96.
Author
Member

Two more blind shapes, from Mars's fable review of PR 96 r=1 at d44e343f. Both are outside #94's list, so they were not folded in. Bash exports GIT_DIR; the reader says undefined.

  • A redirection inside set: set >/dev/null -a; GIT_DIR=/c/.git; git push and set -o >/dev/null allexport; GIT_DIR=/c/.git; git push. (set -a >/dev/null reads correctly.)
  • := over an empty export: export GIT_DIR=; : "${GIT_DIR:=/c/.git}"; git push. Bash exports /c/.git because := also defaults an empty value. The no-colon form agrees.
    Also noisy, the recoverable direction: GIT_DIR=/a; set -a; : "${GIT_DIR=/c/.git}". Bash exports nothing; the reader says /a.
Two more blind shapes, from Mars's fable review of PR 96 r=1 at d44e343f. Both are outside #94's list, so they were not folded in. Bash exports GIT_DIR; the reader says undefined. - A redirection inside `set`: `set >/dev/null -a; GIT_DIR=/c/.git; git push` and `set -o >/dev/null allexport; GIT_DIR=/c/.git; git push`. (`set -a >/dev/null` reads correctly.) - `:=` over an empty export: `export GIT_DIR=; : "${GIT_DIR:=/c/.git}"; git push`. Bash exports /c/.git because `:=` also defaults an empty value. The no-colon form agrees. Also noisy, the recoverable direction: `GIT_DIR=/a; set -a; : "${GIT_DIR=/c/.git}"`. Bash exports nothing; the reader says /a.
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#97
No description provided.