dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: DASH shell mailing list <dash@vger.kernel.org>
Subject: Alias/heredoc/cmdsubst regression
Date: Sat, 25 Jan 2020 00:48:51 +0100	[thread overview]
Message-ID: <40db0aa1-195b-f29e-5068-01fa101affd9@inlv.org> (raw)

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

             reply	other threads:[~2020-01-25  0:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24 23:48 Martijn Dekker [this message]
2020-01-25  1:13 ` Alias/heredoc/cmdsubst regression 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40db0aa1-195b-f29e-5068-01fa101affd9@inlv.org \
    --to=martijn@inlv.org \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).