From 680c3016a2dddc3edb4d79868a728e899638e2c4 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 11 Apr 2018 12:39:18 +0200 Subject: ash: parser: Allow newlines within parameter substitution Upstream commit: Date: Thu, 22 Mar 2018 21:41:24 +0800 parser: Allow newlines within parameter substitution On Fri, Mar 16, 2018 at 11:27:22AM +0800, Herbert Xu wrote: > On Thu, Mar 15, 2018 at 10:49:15PM +0100, Harald van Dijk wrote: > > > > Okay, it can be trivially modified to something that does work in other > > shells (even if it were actually executed), but gets rejected at parse time > > by dash: > > > > if false; then > > : ${$+ > > } > > fi > > That's just a bug in dash's parser with ${} in general, because > it bombs out without the if clause too: > > : ${$+ > } This patch fixes the parsing of newlines with parameter substitution. Signed-off-by: Herbert Xu Signed-off-by: Denys Vlasenko --- shell/hush_test/hush-vars/param_expand_alt2.right | 4 ++++ shell/hush_test/hush-vars/param_expand_alt2.tests | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 shell/hush_test/hush-vars/param_expand_alt2.right create mode 100755 shell/hush_test/hush-vars/param_expand_alt2.tests (limited to 'shell/hush_test') diff --git a/shell/hush_test/hush-vars/param_expand_alt2.right b/shell/hush_test/hush-vars/param_expand_alt2.right new file mode 100644 index 000000000..fef5889ca --- /dev/null +++ b/shell/hush_test/hush-vars/param_expand_alt2.right @@ -0,0 +1,4 @@ +Unquoted: H H +Quoted: H +H +Ok:0 diff --git a/shell/hush_test/hush-vars/param_expand_alt2.tests b/shell/hush_test/hush-vars/param_expand_alt2.tests new file mode 100755 index 000000000..d8abf4c3b --- /dev/null +++ b/shell/hush_test/hush-vars/param_expand_alt2.tests @@ -0,0 +1,7 @@ +echo Unquoted: H${$+ +}H + +echo Quoted: "H${$+ +}H" + +echo Ok:$? -- cgit v1.2.3