Repository navigation
Description
This was generated by AI during work-loop execution.
Context
#1491 added scripts/check-shell-portability.sh. An automated Codex review on the PR (#1511) raised
several detection-precision findings; the two that risked a real false positive on the CORRECT
portable form (grep -Pn/sort -Vr combined-flag clusters, and the sed -i ''/sed -i ""
empty-suffix idiom wrongly flagged) were fixed directly in that PR. This issue tracks the remaining,
lower-severity findings deliberately deferred:
1. Additional GNU sed -i spellings not yet covered
The current token only catches a literal standalone -i followed by a separate (space-delimited)
argument. GNU sed also accepts:
-Ei/-iE(combined with the extended-regex short flag)--in-place[=SUFFIX](long form)- an attached (no-space) empty suffix, e.g.
-i''— ambiguous with BSD's own attached-suffix syntax,
so this one needs real sed-dialect research before encoding, not a quick pattern tweak.
--in-place alone is a clean, unambiguous addition (a literal token, no combined-cluster complexity).
The -Ei/-iE combined-cluster case needs the same "flag can appear anywhere in the cluster"
treatment #1511 already applied to grep -P / sort -V / echo -e, scoped carefully so it does not
also start matching unrelated -i uses (e.g. grep -i, sort -i... -i is common across tools, so a
bare cluster-scan risks over-matching if not anchored to sed specifically — verify before landing).
2. portability-scope: declaration matches anywhere in the file, including strings/docs
The whole-file exemption is grep -qE 'portability-scope:' -- "$file" — an unconditional substring
search, so a file that merely mentions the string portability-scope: in a doc block or string
literal (not as a genuine declaration comment) would be wrongly exempted. This exact mechanism is
already shipped and accepted in the sibling check-skill-portability.sh (same one-line grep -qE
check) — hardening it here should probably land as a shared fix touching both gates, not a
one-off divergence between siblings.
3. awk operand disambiguation for a pathological filename
scan_file() passes "$TOKENS" "$file" positionally to awk. A changed file whose full repo-root
path is shaped like an identifier=value assignment (e.g. a top-level file literally named
FOO=bar.sh) would be parsed by awk as a -v-style command-line assignment instead of opened as a
file, silently dropping it from the scan (a fail-open on an extremely unlikely, arguably invalid,
filename shape). Low real-world risk — no file in this repo's corpus is shaped this way — but worth a
defensive fix (e.g. prefixing operands with ./ or using -v explicitly) given this gate's own
stated fail-closed posture.
Priority
All three are low-severity / low-likelihood relative to the near-miss #1491 fixes. Bundled here rather
than filed individually since they share one gate and one likely reviewer.
Activity
fix(ci): harden shell-portability-lint match precision per review
feat(ci): add shell-portability-lint gate for GNU-only constructs (#1511
kyle-sexton commentedon Jul 26, 2026
This was generated by AI during triage.
Triage
Duplicate check against #1517: not a duplicate. Read both bodies in full. #1517 explicitly frames itself as "Second round" and states "#1513 already tracks the first deferred round" — the two are sequential, non-overlapping rounds of the same Codex-review precision sweep on
scripts/check-shell-portability.sh, not the same gap filed twice. Confirmed by content: this issue's three items (additionalsed -ispellings,portability-scope:substring-match imprecision,awkoperand disambiguation) do not overlap #1517's five items (escape-class scope, line-continuation joining,realpathcontrol-flow, thesed -i ''round-3 reversal,sortlong forms). No duplicate action taken.Verification: confirmed against current
scripts/check-shell-portability.sh/scripts/shell-portability-tokens.txt.sed -ispellings): the active token only matches a space-delimited standalone-i;--in-place,-Ei/-iEcombined clusters, and attached empty-suffix (-i'') are not covered, matching the claim.portability-scope:anywhere in file):scan_file()usesgrep -qE 'portability-scope:' -- "$file"— an unconditional substring search with no anchoring to a genuine declaration-comment shape. Confirmed.awkoperand disambiguation):scan_file()invokesawk '...' "$TOKENS" "$file"with$filepassed as a bare positional operand, whichawkwould parse as avar=valueassignment for a pathologicalIDENT=value.sh-shaped filename. Confirmed, low real-world likelihood (no such file exists in this repo today).Classification
Type: Task
Priority:
priority: low(already applied; matches the issue's own "Priority: Low" assessment — all three items are low-severity/low-likelihood).Target state: briefed, decision-defaulted. This is CI lint tooling, not the guardrails' runtime-blocking git-parsing logic — lower blast radius than the git-guard cluster, and each item has a well-scoped, low-risk default:
--in-placelong-form addition now; defer-Ei/-iEcombined-cluster handling and the attached-empty-suffix case — the issue itself flags the latter as needing "real sed-dialect research before encoding," not a quick pattern tweak, and the-icombined-cluster case needs careful anchoring tosedspecifically to avoid over-matchinggrep -i/sort -i.scripts/check-shell-portability.shand the siblingscripts/check-skill-portability.sh(the issue notes the same one-linegrep -qEmechanism is shared) — recommended as one PR touching both gates rather than a divergent one-off fix.awkoperand fix (e.g../-prefix or explicit-v) — no real corpus risk today, but cheap and matches the gate's stated fail-closed posture.Decision defaulted: implement items 1 (unambiguous part only), 2 (both gates), and 3 now; defer the
-Ei/-iEcluster and attached-empty-suffix sub-cases of item 1 pending sed-dialect research — veto before merge if a maintainer wants the full item 1 scope addressed in this pass instead.Labels applied:
agent-ready(role label resolved from tracker defaults) +status: ready(already present).priority: lowandarea: securityunchanged.Related: #1491, #1511 (origin PR), #1517 (round 2, distinct — see duplicate check above), #1510 (staged-class enable, distinct scope, not blocking).
kyle-sexton commentedon Jul 26, 2026
kyle-sexton commentedon Jul 26, 2026
This was generated by AI during work-loop execution.
Autonomous work-loop dispatch (work-items:work-loop) picked up this item; the invoker's admission gate had already passed (triaged autonomous-eligible, verified against check-shell-portability.sh and shell-portability-tokens.txt). Claimed, implemented, and opened PR #1534.
fix(ci): detect sort's --version-sort / --sort=version long forms (#1530
fix(ci): check-skill-portability.sh's awk operand shares the identifi…
fix(ci): shell-portability-lint's sed -Ei / --in-place tokens miss op…
fix(ci): correct sed -Ei/--in-place boundary comment and extend shipp…
fix(ci): shell-portability-lint's sort -V token misses operator-termi…
fix(ci): withdraw end-of-options handling rather than ship it half-built
kyle-sexton commentedon Jul 26, 2026
Two concrete reproductions for the backslash-continuation half of this issue, from #1544's fifth review round. Both exit 0 with "No unexcused GNU-only constructs":
date \ -d tomorrow +%s stat \ -c %s "$f"The header at
scripts/check-shell-portability.sh:54-56already states this limitation abstractly and cites this issue. Worth carrying the reproductions here because #1544 activatesdate -dandstat -c, which makes the gap materially more likely to bite than it was for the regex-escape classes alone — a continueddate/statinvocation is ordinary formatting in real scripts.Scope note for whoever picks this up: joining logical lines is a scanner-WIDE change, not a per-token one. It alters what "a line" means for every token, the reported line number, and the
portability-ok:/portability-scope:annotation rules, which are all anchored to physical lines. #1544 demonstrated the hazard of changing a scanner-wide mechanism inside a class-activation PR: an earlier revision there re-derived command boundaries for every token and silently broke two unrelated classes, caught only by the existing suite.Priority argument, for consideration against the lexing work queued on #1562: a backslash continuation is far more common in real scripts than
stat ${a:-x;y} -corstat "$(f)" -c, so this is plausibly the highest-value of the three known fail-open gaps.ci: honor -- end-of-options in shell-portability-lint via a word layer (
ci(scripts): flag a bare & in a ${var//pat/repl} replacement (#2097)
refactor(scripts): extract the shared changed-file and awk-operand se…
refactor(scripts): define the list-file format once, and close a thir…
refactor(scripts): dissolve incident history in gate headers (group 5)
refactor(scripts): dissolve revision history in gate suites (group 3)
refactor(scripts): dissolve history narration in gate scripts (group 6)