mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
test foo =~ foo should fail with exit status 2 (#245)
When test is passed the '=~' operator, it will silently fail with
exit status 1:
$ test foo =~ foo; echo $?
1
This bug is caused by test_binop reaching the 'NOTREACHED' area of
code. The bugfix was adapted from ksh2020:
https://github.com/att/ast/issues/1152
src/cmd/ksh93/bltins/test.c: test_binop():
- Error out with a message suggesting usage of '[[ ... ]]' if '=~'
is passed to the test builtin.
- Special-case TEST_END (']]') as that is not really an operator.
Co-authored-by: Martijn Dekker <martijn@inlv.org>
This commit is contained in:
parent
767d23b3fe
commit
fc2d5a6019
6 changed files with 51 additions and 6 deletions
7
NEWS
7
NEWS
|
|
@ -3,6 +3,13 @@ For full details, see the git log at: https://github.com/ksh93/ksh
|
|||
|
||||
Any uppercase BUG_* names are modernish shell bug IDs.
|
||||
|
||||
2021-03-27:
|
||||
|
||||
- The 'test' builtin will now show an error message when given the invalid ']]'
|
||||
or '=~' operators; it also properly returns with exit status 2 now (instead
|
||||
of exit status 1). If the invalid operator is supported by [[ ... ]] (such
|
||||
as '=~'), test will now suggest the usage of [[ ... ]] instead.
|
||||
|
||||
2021-03-22:
|
||||
|
||||
- A new --globcasedetect shell option is added to ksh on OSs where we can check
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue