diff --git a/NEWS b/NEWS index 4f7e31e5244e..a18d893321b8 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,11 @@ For full details, see the git log at: https://github.com/ksh93/ksh Any uppercase BUG_* names are modernish shell bug IDs. +2020-07-23: + +- A command substitution that is run on the same line as a here-document + will no longer cause a syntax error. + 2020-07-22: - Fixed two race conditions when running external commands on diff --git a/src/cmd/ksh93/include/version.h b/src/cmd/ksh93/include/version.h index 23274355a786..2f87d7609a2b 100644 --- a/src/cmd/ksh93/include/version.h +++ b/src/cmd/ksh93/include/version.h @@ -17,4 +17,4 @@ * David Korn * * * ***********************************************************************/ -#define SH_RELEASE "93u+m 2020-07-22" +#define SH_RELEASE "93u+m 2020-07-23" diff --git a/src/cmd/ksh93/sh/lex.c b/src/cmd/ksh93/sh/lex.c index 916561b57f98..3ea25437e38e 100644 --- a/src/cmd/ksh93/sh/lex.c +++ b/src/cmd/ksh93/sh/lex.c @@ -1563,6 +1563,7 @@ static int comsub(register Lex_t *lp, int endtok) { register int n,c,count=1; register int line=lp->sh->inlineno; + struct ionod *inheredoc = lp->heredoc; char *first,*cp=fcseek(0),word[5]; int off, messages=0, assignok=lp->assignok, csub; struct lexstate save; @@ -1689,7 +1690,7 @@ static int comsub(register Lex_t *lp, int endtok) lp->lexd.dolparen--; lp->lex = save; lp->assignok = (endchar(lp)==RBRACT?assignok:0); - if(lp->heredoc) + if(lp->heredoc && !inheredoc) errormsg(SH_DICT,ERROR_exit(SYNBAD),e_lexsyntax5,lp->sh->inlineno,lp->heredoc->ioname); return(messages); } diff --git a/src/cmd/ksh93/tests/heredoc.sh b/src/cmd/ksh93/tests/heredoc.sh index 1cabd44e38e0..d75443345a18 100755 --- a/src/cmd/ksh93/tests/heredoc.sh +++ b/src/cmd/ksh93/tests/heredoc.sh @@ -498,4 +498,16 @@ print foo > $tmp/foofile x=$( $SHELL 2> /dev/null 'read <<< $(<'"$tmp"'/foofile) 2> /dev/null;print -r "$REPLY"') [[ $x == foo ]] || err_exit '<<< $( /dev/null && err_exit "a here-doc that isn't completed before the closing ) in a command substitution doesn't cause an error" + +# ====== exit $((Errors<125?Errors:125))