fix: parse named file descriptor redirects - #13
Merged
Conversation
aliou
force-pushed
the
fix/named-fd-redirects
branch
from
July 30, 2026 06:33
b72b84f to
2d380b4
Compare
378-kaiabot
Bot
force-pushed
the
fix/named-fd-redirects
branch
from
August 22, 2026 11:43
2d380b4 to
0c2b57d
Compare
Port the {varname} redirect case from mvdan/sh (upstream 3fbbfb3). A
braced valid name immediately followed by a redirect operator becomes the
redirect's fd in bash and zsh; POSIX and mksh reject it, and anything
else still parses as a word.
378-kaiabot
Bot
force-pushed
the
fix/named-fd-redirects
branch
from
August 22, 2026 12:00
0c2b57d to
1cc917d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Port the
{varname}redirect case frommvdan/sh(upstream commit3fbbfb3, "{varname}>redirects work in Zsh too").fd, e.g.foo {fd}<fileand{fd}>>out foo.bashandzsh; rejected inposixandmkshwith the upstream wording (`{varname}` redirects are a bash/zsh feature).{1fd}>out,{fd-x}>out,{}>out), and{ foo; }still parses as aBlock.Replaces #6, which was written on a remote branch.
Verification
bashandzsh({fd}>fileredirects;{1a}>fileis a literal word) and against upstreamsyntax/lexer.go:isLitRedir/syntax/parser.go:2049.pnpm test(20 files, 270 tests),pnpm typecheck,pnpm checkall pass.