Repository navigation
Closed
Description
Question
How should the gh-write-guard.py wait-loop rule (requirement 7) decide that a [, [[, or test comparison bounds a loop, now that crediting -lt/-le/-gt/-ge anywhere in the condition (#1636) is being narrowed?
The unattended lane for #1636 (handoff #1989) parked here after its two-round local review budget ran out. Branch feature/auto-1636, commits d11c3ea, 8f9f498 and d28bde0, no pull request yet. Each round made the token-level parse of a test's operands more precise, and each round's adversarial review found new shapes on the text the round before wrote. That is the non-converging pattern. Round three's open findings, all constructed cases:
- A substitution glued to a word,
[ -n x$(ls -lt out) ], is still credited as a bound. - A fused separator and subshell after
test,test -f x;(ls -lt out), is read as test grouping and credited. - A
casearm's)inside$(...)unbalances the depth count (contrived). - A quoted literal backtick operand,
[ "$c" != '' -a $i -lt 3 ]`, hides a real comparison and denies a bounded loop that develop allows today.
Options
- Recommended: fail closed on any opaque operand. A comparison counts only inside a
[,[[, ortestwhose operands before it carry no substitution, backtick, or parenthesis token at all. This is short, and every unparsed shape resolves to deny rather than to a bypass. The cost is that some genuinely bounded loops that develop allows today are denied,until [ $(date +%s) -ge $end ]the common one. The deny message already names the(( SECONDS < end ))form, so the fix for the user is a one-line rewrite. The parked branch is reworked to this and driven to develop. - Keep refining the operand parser. Fix round three's four findings and review again, accepting further rounds. This keeps every bounded loop develop allows today, but the last three rounds each produced about four new findings, so a converging end is not in sight. The parked branch continues as it stands.
- Ship the parked branch as it is and file the remaining shapes. The commits already close both shapes
_BOUND_IN_CONDITIONReads an Ordinary Command Flag as an Arithmetic Guard #1636 names,ls -ltandgrep -le, and many more. The remaining bypasses need a deliberate spelling, and the backtick regression is rare. The four findings become a follow-up issue, and this lane's pull request is opened from the branch unchanged.
What each choice does to the parked work
- Option 1 replaces the operand parser in
_bound_in_conditionwith the simpler fail-closed check, and turns some existing_WAIT_CASESallow rows into deny rows. - Option 2 adds a fourth commit to
feature/auto-1636. - Option 3 opens the pull request from the branch as it stands.
Handoff: #1989. Blocks: the not-yet-opened feature/auto-1636 -> develop pull request for #1636.
Metadata
Metadata
Assignees
Labels
No labels
Activity
ptr727 commentedon Sep 28, 2026
Answered by the maintainer in an attended session: option 2, keep refining the operand parser. Fix round three's four findings on
feature/auto-1636and review again. Work continues under handoff #1989.Credit a Comparison Bound Only Inside a Test Invocation (#1999)