Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax: parse a redirect edge case without spaces #879

Merged
merged 1 commit into from
Jun 13, 2022
Merged

Conversation

mvdan
Copy link
Owner

@mvdan mvdan commented Jun 12, 2022

(see commit message)

In the input

	>&2>/dev/null

we would incorrectly error on the `2`, as we would tokenize it as part
of `2>/dev/null`, when in fact it's part of `>&2`.

To fix the problem, teach wordPart that it can construct a literal even
if it's a _LitRedir, the start of `N>word`. This is fine, because we
already use _LitRedir as a special case where it is needed, and it
should not be a special case here - otherwise the bug appears.

As reported by Sora Morimoto in asdf-community/asdf-direnv#120.
@mvdan mvdan merged commit e9bca7c into master Jun 13, 2022
@mvdan mvdan deleted the litredir-space branch June 14, 2022 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants