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
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#define SH_RELEASE_FORK "93u+m" /* only change if you develop a new ksh93 fork */
|
||||
#define SH_RELEASE_SVER "1.0.0-beta.2" /* semantic version number: https://semver.org */
|
||||
#define SH_RELEASE_DATE "2022-03-05" /* must be in this format for $((.sh.version)) */
|
||||
#define SH_RELEASE_DATE "2022-03-10" /* must be in this format for $((.sh.version)) */
|
||||
#define SH_RELEASE_CPYR "(c) 2020-2022 Contributors to ksh " SH_RELEASE_FORK
|
||||
|
||||
/* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue