Closed McDutchie closed 3 months ago
There are other cases. The following are also not entered into the history.
$ a[]=12
-ksh: syntax error at line 1: `[]' empty subscript
$ function foo $bad { :; }
-ksh: syntax error at line 1: invalid reference list
All of these are omitted from the history because the error message is thrown using a direct errormsg()
call without calling sh_syntax()
. So the fix should be either to amend sh_syntax()
so that it can show these messages, or to keep printing the message separately but also call sh_syntax()
and amend it to skip the message in that case.
Reproducer:
This is as expected: the space between the final
) )
means it's not an arithmetic expansion, so it's treated as a command substitution with a syntax error.But now, arrow up: the command with the syntax error does not come back for the user to correct it. It has not been added to the history, and that is a bug.
We inherited this bug from 93u+.