dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Alias/heredoc/cmdsubst regression
@ 2020-01-24 23:48 Martijn Dekker
  2020-01-25  1:13 ` Harald van Dijk
  0 siblings, 1 reply; 7+ messages in thread
From: Martijn Dekker @ 2020-01-24 23:48 UTC (permalink / raw)
  To: DASH shell mailing list

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@gondor.apana.org.au>
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-01-25 16:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-24 23:48 Alias/heredoc/cmdsubst regression Martijn Dekker
2020-01-25  1:13 ` Harald van Dijk
2020-01-25  1:38   ` Harald van Dijk
2020-01-25 12:19     ` [PATCH] parseheredoc: fix alias expansion: save and restore checkkwd Martijn Dekker
2020-01-25 16:17       ` Harald van Dijk
2020-01-25 16:26     ` Alias/heredoc/cmdsubst regression Martijn Dekker
2020-01-25 16:33       ` Harald van Dijk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).