Skip to content

Fold a Line Continuation the Way Bash Does Before the Guard Reads a Command #2113

Closed as not planned

Description

@ptr727

Problem

classify in gh-write-guard.py replaces each backslash-newline with a space before any rule reads the command. Bash deletes the pair instead, joining the words on either side, so a word split across a continuation reads as two words to the guard and one to bash. Rule 7 then never sees a sleep or a loop keyword spelled that way.

Reproduce (constructed)

Allowed on develop at 4c9087d, although bash runs sleep:

while [ ! -f /nonexistent ]; do sl\
eep 1; done

printf 'ec\\\nho joined\n' | bash prints joined, which shows the join. wh\ then ile on the next line does the same for the keyword.

Done looks like

The command above is denied, and a self-test row pins it. Deleting the pair rather than replacing it with a space matches bash, including where a space already sits before the backslash, but every rule reads the folded text, so the change needs the whole self-test.

Found by the local strict review of the #2059 fix.

Activity

  1. ptr727 commented on Oct 8, 2026

    @ptr727
    OwnerAuthor

    Closed: Folded into #1959 per #2517, approved by the maintainer. This is a case of the guard's lexer splitting a command differently from bash, and #1959's single bash-aware scanner fixes the class, with this shape kept as a self-test row there.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions