diff --git a/src/cmd/ksh93/data/lexstates.c b/src/cmd/ksh93/data/lexstates.c index b06d8ca43..4f257a38c 100644 --- a/src/cmd/ksh93/data/lexstates.c +++ b/src/cmd/ksh93/data/lexstates.c @@ -274,7 +274,7 @@ static const char sh_lexstate7[256] = S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, - S_ERR, S_ERR, S_ERR, S_MOD2, S_ERR, S_MOD2, S_ERR, S_ERR, + S_ERR, 0, S_ERR, S_MOD2, 0, S_MOD2, S_ERR, S_ERR, S_ERR, S_ERR, S_MOD1, S_MOD1, S_ERR, S_MOD1, S_DOT, S_MOD2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, S_MOD1, S_ERR, S_ERR, S_MOD1, S_ERR, S_MOD1, diff --git a/src/cmd/ksh93/tests/heredoc.sh b/src/cmd/ksh93/tests/heredoc.sh index d6519f85c..726870400 100755 --- a/src/cmd/ksh93/tests/heredoc.sh +++ b/src/cmd/ksh93/tests/heredoc.sh @@ -509,5 +509,15 @@ EOF' || err_exit 'placing a command substitution and here-doc on the same line c $SHELL -c '$(true << !) !' 2> /dev/null && err_exit "a here-doc that isn't completed before the closing ) in a command substitution doesn't cause an error" +# ====== +# Check that ${p}, where p is a special parameter, does not cause a syntax error in a here-document. +# Bug for ${!} and ${$} reported at: https://github.com/ksh93/ksh/issues/127 +for p in @ \* \# ! \$ - \? 0; do + err=$(eval ': <&1) || err_exit "special parameter \${$p} throws syntax error in here-document (got \"$err\")" +done + # ====== exit $((Errors<125?Errors:125))