mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix another test/[ corner case bug; add --posix test script
This fixes another corner case bug in the horror show that is the test/[ comand. Reproducer: $ ksh --posix -c 'test X -a -n' ksh: test: argument expected Every other shell returns 0 (success) as, POSIXly, this is a test for the strings 'X' and '-n' both being non-empty, combined with the binary -a (logical and) operator. Instead, '-n' was taken as a unary primary operator with a missing argument, which is incorrect. POSIX reference: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html > 3 arguments: > * If $2 is a binary primary, perform the binary test of $1 and $3. src/cmd/ksh93/bltins/test.c: - e3(): If the final argument begins with a dash, always treat it as a test for a non-empty string, therefore return true. Do not limit this to "new flags" only. src/cmd/ksh93/tests/posix.sh: - Added. These are tests for every aspect of the POSIX mode.
This commit is contained in:
parent
9e2a8c6925
commit
fd28da31da
6 changed files with 232 additions and 34 deletions
4
NEWS
4
NEWS
|
@ -3,6 +3,10 @@ For full details, see the git log at: https://github.com/ksh93/ksh/tree/1.0
|
|||
|
||||
Any uppercase BUG_* names are modernish shell bug IDs.
|
||||
|
||||
2022-03-10:
|
||||
|
||||
- Fixed another corner case bug in the 'test'/'[' command.
|
||||
|
||||
2022-03-05:
|
||||
|
||||
- The 'enum' command can now create more than one type per invocation.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue