Skip to content

Reject {n} redirection prefix#167

Merged
magicant merged 1 commit into
trunkfrom
io-location
May 8, 2025
Merged

Reject {n} redirection prefix#167
magicant merged 1 commit into
trunkfrom
io-location

Conversation

@magicant

@magicant magicant commented May 8, 2025

Copy link
Copy Markdown
Owner

This commit implements recognition of I/O location tokens that are always rejected as a syntax error. The shell may validly accept the I/O location syntax and semantics in the future.

Summary by Copilot

This pull request introduces a new reserved syntax for file descriptors in braces before redirection operators, updates the parser to handle this syntax as a syntax error, and includes corresponding documentation and test updates. Below are the most important changes grouped by theme:

Syntax Reservation and Parsing Updates:

  • Added a new token type TT_IO_LOCATION to the parser to represent the reserved {name} syntax before redirection operators. Updated the next_token function to identify and classify this syntax as TT_IO_LOCATION. [1] [2]
  • Modified the tryparse_redirect function to treat TT_IO_LOCATION tokens as syntax errors, with appropriate error messages.
  • Updated alias substitution and operand validation logic to account for TT_IO_LOCATION tokens, ensuring they are rejected where appropriate. [1] [2]

Documentation Updates:

  • Updated doc/redir.txt and doc/ja/redir.txt to document the reserved {name} syntax for future use, noting that it currently results in a syntax error. [1] [2]

News and Release Notes:

  • Added entries to NEWS and NEWS.ja files to announce the reservation of the {name} syntax for file descriptors and its current treatment as a syntax error. [1] [2]

Test Coverage:

  • Added new test cases in tests/redir-y.tst to verify that {name} syntax is correctly identified as unsupported and results in syntax errors.

This commit implements recognition of I/O location tokens that are
always rejected as a syntax error. The shell may validly accept the I/O
location syntax and semantics in the future.
@magicant magicant added this to the 2.59 milestone May 8, 2025
@magicant magicant self-assigned this May 8, 2025
@magicant magicant added the enhancement New feature or request label May 8, 2025
@magicant magicant mentioned this pull request May 8, 2025
56 tasks
@magicant
magicant merged commit c576db4 into trunk May 8, 2025
@magicant
magicant deleted the io-location branch May 8, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant