Reject multiple pathname expansion results in redirection operands#158
Merged
Conversation
POSIX.1-2024 allows the shell to treat it as an error when pathname expansion on a file redirection operand results in more than one pathname. Previously, yash only did so when the POSIXly-correct mode was disabled, but now it does so regardless of the mode. POSIX does not seem to allow the shell to treat it as an error when pathname expansion on a file redirection operand results in no pathname, so this error is only reported when the POSIXly-correct mode is disabled as before. However, the previous error message was misleading as we were using the same message as the one for multiple matches. This commit changes the error message to indicate that no match was found. Closes #95
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.
POSIX.1-2024 allows the shell to treat it as an error when pathname expansion on a file redirection operand results in more than one pathname. Previously, yash only did so when the POSIXly-correct mode was disabled, but now it does so regardless of the mode.
POSIX does not seem to allow the shell to treat it as an error when pathname expansion on a file redirection operand results in no pathname, so this error is only reported when the POSIXly-correct mode is disabled as before. However, the previous error message was misleading as we were using the same message as the one for multiple matches. This commit changes the error message to indicate that no match was found.
Closes #95
Summary by Copilot
This pull request introduces changes to the behavior of pathname expansion in file redirection, updates related documentation and translations, and adjusts corresponding test cases. The most significant updates ensure consistent error handling when pathname expansion results in no matches or multiple matches, regardless of whether POSIXly-correct mode is enabled.
Changes to pathname expansion behavior:
expand.cto treat pathname expansion resulting in no matches or multiple matches as errors in non-POSIX mode, while maintaining POSIX behavior when the mode is enabled. [1] [2]Documentation updates:
doc/posix.txtanddoc/ja/posix.txtto reflect the new behavior for pathname expansion in file redirection. [1] [2]Translation updates:
po/ja.pofor cases where pathname expansion fails due to no matches or multiple matches.Test case updates:
tests/redir-y.tstto include new test cases for pathname expansion errors in both POSIX and non-POSIX modes, and updated existing test descriptions for clarity. [1] [2]Miscellaneous:
po/ja.po.