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
ksh aborts when I have typo in an option #1284
Comments
I'm noticing that as long as the |
@kusalananda Because |
This is the backtrace:
|
It was introduced by 3c27860. @krader1961 Can yo take a look at it ? |
Turns out that |
TBD is whether Coverity Scan issues a new warning with the moved |
@kusalananda Sorry for the confusion. I did not want to say that ksh uses |
@krader1961 Thank you for fixing it! As for the original Coverity report, I think it was a true positive but the fix was wrong. Instead of removing the first check for NULL, you should have added an additional check for NULL before the second dereference. Note that |
@kdudka If you take the original implementation at face value, and assume it is correct, then it is in fact an error for the nested, second, dereference of My mistake in this instance was concluding the original code was incorrect in assuming that |
src/cmd/ksh93/tests/arrays.sh, src/cmd/ksh93/tests/arrays2.sh: - Backport some regression tests from ksh93v- for associative arrays. src/cmd/ksh93/tests/basic.sh: - Add ksh93v- regression tests for background process output in backtick and shared-state command substitutions as well as functions used in command substitutions. - Add a regression tests for using EXIT traps in subshells. In ksh93v- and ksh2020 EXIT traps don't work in forked subshells: att#1452 - The trap builtin shouldn't segfault after receiving an invalid signal name. ksh2020 regression: att#1403 - Add a test to make sure invalid flags don't crash ksh. ksh2020 regression: att#1284 - Test for an illegal seek error when using the 'join' command with process substitutions. ksh93v- regression: https://www.mail-archive.com/ast-users@lists.research.att.com/msg00816.html src/cmd/ksh93/tests/bracket.sh: - Add some regression tests from ksh93v- for the -eq test operator. src/cmd/ksh93/tests/builtins.sh: - Move the regression test for 'exit' in an interactive shell to the exit.sh script. - Test for assignments preceding the command builtin persisting after an error. ksh2020 regression: att#1402 - The chmod builtin should modify the permissions of all files passed to it. ksh2020 regression: att#949 - Add regression tests for the cd builtin. In ksh93v- 2013-10-10 alpha, using cd on a directory without an execute bit doesn't fail. The test for using cd on a normal file was backported from ksh93v-. - Backport a ksh93v- regression test for the exit status from 'kill %'. src/cmd/ksh93/tests/case.sh: - Test for a segfault when ksh handles an invalid character class in a pattern. ksh2020 regression: att#1409 src/cmd/ksh93/tests/exit.sh: - Add regression tests from ksh2020 for the 'exit' builtin: att@d9491d4 src/cmd/ksh93/tests/io.sh: - Add a regression test from ksh93v- for a process substitution hang. This test fails in the 93v- 2013 alpha but succeeds in the 2014 beta. src/cmd/ksh93/tests/math.sh: - 'typeset -s foo=30000' adds garbage to $foo in ksh93u+, ksh93v- and ksh2020: $ typeset -s foo=30000 $ echo $foo 5#1430000 This bug was fixed in commit 88a6baa, but that commit didn't add a regression test for it. src/cmd/ksh93/tests/variables.sh: - Add a regression test for $PS4 incorrectly unsetting ${.sh.subshell}: att#1092
src/cmd/ksh93/tests/arrays.sh, src/cmd/ksh93/tests/arrays2.sh: - Backport some regression tests from ksh93v- for associative arrays. src/cmd/ksh93/tests/basic.sh: - Add ksh93v- regression tests for background process output in backtick and shared-state command substitutions as well as functions used in command substitutions. - Add regression tests for using EXIT traps in subshells. In ksh93v- and ksh2020 EXIT traps don't work in forked subshells: att#1452 - The trap builtin shouldn't segfault after receiving an invalid signal name. ksh2020 regression: att#1403 - Add a test to make sure invalid flags don't crash ksh. ksh2020 regression: att#1284 - Test for an illegal seek error when using the 'join' command with process substitutions. ksh93v- regression: https://www.mail-archive.com/ast-users@lists.research.att.com/msg00816.html src/cmd/ksh93/tests/bracket.sh: - Add some regression tests from ksh93v- for the -eq test operator. src/cmd/ksh93/tests/builtins.sh: - Move the regression test for 'exit' in an interactive shell to the exit.sh script. - Test for assignments preceding the command builtin persisting after an error. ksh2020 regression: att#1402 - The chmod builtin should modify the permissions of all files passed to it. ksh2020 regression: att#949 - Add regression tests for the cd builtin. In ksh93v- 2013-10-10 alpha, using cd on a directory without an execute bit doesn't cause an error. The test for using cd on a normal file was backported from ksh93v-. - Backport a ksh93v- regression test for the exit status from 'kill %'. src/cmd/ksh93/tests/case.sh: - Test for a segfault when ksh handles an invalid character class in a pattern. ksh2020 regression: att#1409 src/cmd/ksh93/tests/exit.sh: - Add regression tests from ksh2020 for the 'exit' builtin: att@d9491d4 src/cmd/ksh93/tests/io.sh: - Add a regression test from ksh93v- for a process substitution hang. This test fails in the 93v- 2013 alpha but succeeds in the 2014 beta. src/cmd/ksh93/tests/math.sh: - 'typeset -s foo=30000' adds garbage to $foo in ksh93u+, ksh93v- and ksh2020: $ typeset -s foo=30000 $ echo $foo 5#1430000 This bug was fixed in commit 88a6baa, but that commit didn't add a regression test for it. src/cmd/ksh93/tests/variables.sh: - Add a regression test for $PS4 incorrectly unsetting ${.sh.subshell}: att#1092
src/cmd/ksh93/tests/arrays.sh, src/cmd/ksh93/tests/arrays2.sh: - Backport some regression tests from ksh93v- for associative arrays. src/cmd/ksh93/tests/basic.sh: - Add ksh93v- regression tests for background process output in backtick and shared-state command substitutions as well as functions used in command substitutions. - Add regression tests for using EXIT traps in subshells. In ksh93v- and ksh2020 EXIT traps don't work in forked subshells: att#1452 - The trap builtin shouldn't segfault after receiving an invalid signal name. ksh2020 regression: att#1403 - Add a test to make sure invalid flags don't crash ksh. ksh2020 regression: att#1284 - Test for an illegal seek error when using the 'join' command with process substitutions. ksh93v- regression: https://www.mail-archive.com/ast-users@lists.research.att.com/msg00816.html src/cmd/ksh93/tests/bracket.sh: - Add some regression tests from ksh93v- for the -eq test operator. src/cmd/ksh93/tests/builtins.sh: - Move the regression test for 'exit' in an interactive shell to the exit.sh script. - Test for assignments preceding the command builtin persisting after an error. ksh2020 regression: att#1402 - The chmod builtin should modify the permissions of all files passed to it. ksh2020 regression: att#949 - Add regression tests for the cd builtin. In ksh93v- 2013-10-10 alpha, using cd on a directory without an execute bit doesn't cause an error. The test for using cd on a normal file was backported from ksh93v-. - Backport a ksh93v- regression test for the exit status from 'kill %'. src/cmd/ksh93/tests/case.sh: - Test for a segfault when ksh handles an invalid character class in a pattern. ksh2020 regression: att#1409 src/cmd/ksh93/tests/exit.sh: - Add regression tests from ksh2020 for the 'exit' builtin: att@d9491d46 src/cmd/ksh93/tests/io.sh: - Add a regression test from ksh93v- for a process substitution hang. This test fails in the 93v- 2013 alpha but succeeds in the 2014 beta. src/cmd/ksh93/tests/math.sh: - 'typeset -s foo=30000' adds garbage to $foo in ksh93u+, ksh93v- and ksh2020: $ typeset -s foo=30000 $ echo $foo 5#1430000 This bug was fixed in commit 88a6baa, but that commit didn't add a regression test for it. src/cmd/ksh93/tests/variables.sh: - Add a regression test for $PS4 incorrectly unsetting ${.sh.subshell}: att#1092
Description of problem:
ksh aborts when I have typo in an option.
Ksh version:
2020.0.0-alpha1-1-g7d7bba3e
How reproducible:
easily
Steps to reproduce:
Actual results:
Expected results:
Additional info:
I get the expected output with ksh 93u+.
The text was updated successfully, but these errors were encountered: