There is a regression involving alias expansion, a here-document, and a
command substitution. The following worked fine until dash 0.5.8; it
throws a syntax error as of dash 0.5.9.
alias BEGIN='{' END='}'
BEGIN
cat <<eof
$(echo hi)
eof
END
With some git brute-forcing I determined this was the commit that broke it:
commit 7c245aa8ed33ba5db30eef9369d67036a05b0371
Author: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Tue Oct 28 17:22:16 2014 +0800
[PARSER] Simplify EOF/newline handling in list parser
This patch simplifies the EOF and new handling in the list parser.
In particular, it eliminates a case where we may leave here-documents
unfinished upon EOF.
It also removes special EOF/newline handling from parsecmd.
Related shells:
- I've confirmed the test case to work fine on:
FreeBSD sh 9, 10, 11 and 12
NetBSD sh 8 and 9.0RC1
busybox ash 1.20 - 1.24
- I've confirmed the test case broken on:
busyboxy ash 1.25 through current
Since busybox ash tracks dash, it's not surprising it broke there as well.
- M.
--
modernish -- harness the shell
https://github.com/modernish/modernish