You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Single-bracket test commands are merged across redirected statements #316
If two single-bracket test commands appear above and below a series of statements containing a redirection, both tests and all statements between will be interpreted as one large redirected_statement inside a single test_command. I believe this is a minimal example:
The same merge happens after a pipeline of 3 or more commands, with no test command involved. A line carrying any redirect right after the pipeline is joined onto the pipeline's last command, and the tree has no ERROR node.
gives head the arguments -4, echo and done, while bash runs echo done > out.txt as its own command.
These parse correctly:
A pipeline of 2 commands, a | b then d > f.
A ; at the end of the pipeline's line.
A blank line between the two lines does not help.
Seen on 0.25.1 through web-tree-sitter 0.27.0. We hit it replaying 8187 shell commands through a guard that reads the tree: 5 of them were affected, each hiding the next line's command.
Activity
marcospgp commentedon Sep 16, 2026
The same merge happens after a pipeline of 3 or more commands, with no test command involved. A line carrying any redirect right after the pipeline is joined onto the pipeline's last command, and the tree has no ERROR node.
parses as
so
dbecomes an argument ofc. A realistic case:gives
headthe arguments-4,echoanddone, while bash runsecho done > out.txtas its own command.These parse correctly:
a | bthend > f.;at the end of the pipeline's line.A blank line between the two lines does not help.
Seen on 0.25.1 through web-tree-sitter 0.27.0. We hit it replaying 8187 shell commands through a guard that reads the tree: 5 of them were affected, each hiding the next line's command.