Skip to content

Read a Subshell's Trailing Comment and a Tab-Stripped Heredoc as Bash Does in the Write Guard #3353

Closed

Description

@ptr727

Context

Found by the local review of the backslash-newline narrowing (branch feature/guard-backslash-newline-quoting), confirmed with a classify probe on develop using constructed commands. Both are low realism, filed together as tokenizer divergences from bash.

Gaps

  • A # right after a subshell's ) opens a comment in bash. _context_lex and _skip_group read it as text, as _context_lex's docstring states. An apostrophe in that comment then pairs with one on a later line and hides the lines between. Develop allows (echo it)# it's, then gh pr merge 5 --admin, then # ', one per line.
  • A <<- heredoc fed to a shell has its leading tabs stripped before the inner shell joins a continuation. No reading strips them, so a word split across a tab-indented continuation stays split. Develop allows bash <<-'EOF' followed by a tab-indented gh pr merge 5 --ad\ line, a tab-indented min line, and a tab-indented EOF. The inner shell runs --admin.

Possible Direction

Read )# as a comment opener after a subshell's ), keeping it text after a substitution's. Strip the leading tabs of a <<- body before reading it as a script.

Activity

  1. added
    bugSomething isn't working
    pre-existingReview finding classed pre-existing per local-strict-review Disposing of Findings
    scriptA defect in hub tooling
    on Oct 22, 2026
  2. ptr727 commented on Oct 23, 2026

    @ptr727
    OwnerAuthor

    Closed as out of the write guard's scope under the maintainer's decision (ptr727, 2026-10-23) on #3391, item 1. The guard bounds a good-faith agent's mistake rather than an adversary, so a parse gap reached only by a command shape no agent plausibly types in a coding session is closed rather than fixed, and the guard's own growth is a cost each later review pays again. The scope statement lands in the guard's docstring and README under #3391. Reopen only with a command a session actually produced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpre-existingReview finding classed pre-existing per local-strict-review Disposing of FindingsscriptA defect in hub tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions