Skip to content

test: Reject -a, -o, and parentheses in POSIXly-correct mode #161

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

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

magicant
Copy link
Owner

These operators were removed from the POSIX standard in 2024.

Closes #153

Summary by Copilot

This pull request introduces changes to the test built-in command in the Yash shell to improve POSIX compliance, deprecate certain operators, and update documentation and tests accordingly. The most significant changes include disallowing the use of -a, -o, and parentheses in POSIXly-correct mode, updating error messages and translations, and modifying tests to reflect the new behavior.

Changes to test Built-in Behavior:

  • The test ([) built-in now rejects binary operators -a and -o and parentheses (, ) when the shell is in POSIXly-correct mode. Error messages are displayed when these are used in such cases. ([[1]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0R132-R134), [[2]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0L306-R322), [[3]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0L390-R408), [[4]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0R428-R430), [[5]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0R446-R448), [[6]](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0R473-R475))

Documentation Updates:

  • Updated doc/_test.txt and doc/ja/_test.txt to reflect the deprecation of -a, -o, and parentheses, recommending the use of shell language constructs instead. Examples and notes were added to clarify preferred alternatives. ([[1]](https://github.com/magicant/yash/pull/161/files#diff-1b85979c4f57e3e1a1a25f8dca191475b6f2d1e07325f462b8cf740820b56a6aR118-R141), [[2]](https://github.com/magicant/yash/pull/161/files#diff-1b85979c4f57e3e1a1a25f8dca191475b6f2d1e07325f462b8cf740820b56a6aL153-R175), [[3]](https://github.com/magicant/yash/pull/161/files#diff-8b60d1b965a3f2b41d7286413552609c9cb78734abbf154613403a2a69122737R113-R133), [[4]](https://github.com/magicant/yash/pull/161/files#diff-8b60d1b965a3f2b41d7286413552609c9cb78734abbf154613403a2a69122737L139-R153))

Translation Updates:

  • Added new error messages for the disallowed operators and parentheses in POSIXly-correct mode to the Japanese translation file po/ja.po. Updated line references and timestamps for consistency. ([[1]](https://github.com/magicant/yash/pull/161/files#diff-2610fe3387a707fedd19063c18e228faa7843e4da17408a61956635ffece271cL257-R305), [[2]](https://github.com/magicant/yash/pull/161/files#diff-2610fe3387a707fedd19063c18e228faa7843e4da17408a61956635ffece271cL1751-R1775), [[3]](https://github.com/magicant/yash/pull/161/files#diff-2610fe3387a707fedd19063c18e228faa7843e4da17408a61956635ffece271cL1792-R1838))

Test Suite Modifications:

  • Updated tests/test-p.tst and tests/test1-y.tst to remove tests for the now-disallowed operators in POSIXly-correct mode and add new tests to verify the correct error messages are displayed when these operators are used. ([[1]](https://github.com/magicant/yash/pull/161/files#diff-4f468cbcaa9cdd27aabdf72899ed62810586a43e464fadfe5db72cf6278dcb81L388-L400), [[2]](https://github.com/magicant/yash/pull/161/files#diff-4f468cbcaa9cdd27aabdf72899ed62810586a43e464fadfe5db72cf6278dcb81L413-L430), [[3]](https://github.com/magicant/yash/pull/161/files#diff-710274c01e0de2d8856fe168ba7654f02985081a0eec2850b211b4d938ff4953R93-R122), [[4]](https://github.com/magicant/yash/pull/161/files#diff-710274c01e0de2d8856fe168ba7654f02985081a0eec2850b211b4d938ff4953R138-R192))

Miscellaneous Updates:

  • Updated copyright year in builtins/test.c to reflect the current year. ([builtins/test.cL3-R3](https://github.com/magicant/yash/pull/161/files#diff-af628874c6012bc557c8478762adb6b2e737a80ec679c28e9f7c04697e0588f0L3-R3))

These changes ensure better adherence to POSIX standards while providing clear guidance and error handling for users.

These operators were removed from the POSIX standard in 2024.

Closes #153
@magicant magicant added this to the 2.59 milestone Apr 22, 2025
@magicant magicant self-assigned this Apr 22, 2025
@magicant magicant merged commit b302c8d into trunk Apr 23, 2025
5 checks passed
@magicant magicant deleted the posix-test branch April 23, 2025 12:46
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.

Rejecting non-POSIX operators in the test built-in
1 participant