From c4c2012284c3a3a45843e9400379c84855d853ef Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 2 Apr 2018 13:29:20 +0200 Subject: ash: parser: Fix single-quoted patterns in here-documents Upstream commit: From: Herbert Xu Date: Fri, 9 Mar 2018 23:07:53 +0800 parser: Fix single-quoted patterns in here-documents The script x=* cat <<- EOF ${x#'*'} EOF prints * instead of nothing as it should. The problem is that when we're in sqsyntax context in a here-document, we won't add CTLESC as we should. This patch fixes it: Reported-by: Harald van Dijk Signed-off-by: Herbert Xu Signed-off-by: Denys Vlasenko --- shell/ash_test/ash-heredoc/heredoc_var_expand1.right | 4 ++++ shell/ash_test/ash-heredoc/heredoc_var_expand1.tests | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 shell/ash_test/ash-heredoc/heredoc_var_expand1.right create mode 100755 shell/ash_test/ash-heredoc/heredoc_var_expand1.tests (limited to 'shell/ash_test') diff --git a/shell/ash_test/ash-heredoc/heredoc_var_expand1.right b/shell/ash_test/ash-heredoc/heredoc_var_expand1.right new file mode 100644 index 000000000..eb221832d --- /dev/null +++ b/shell/ash_test/ash-heredoc/heredoc_var_expand1.right @@ -0,0 +1,4 @@ + +Ok1:0 + +Ok2:0 diff --git a/shell/ash_test/ash-heredoc/heredoc_var_expand1.tests b/shell/ash_test/ash-heredoc/heredoc_var_expand1.tests new file mode 100755 index 000000000..3b00bab7b --- /dev/null +++ b/shell/ash_test/ash-heredoc/heredoc_var_expand1.tests @@ -0,0 +1,11 @@ +x='*' + +cat <<- EOF + ${x#'*'} +EOF +echo Ok1:$? + +cat <