[klibc] [klibc:update-dash] dash: parser: Fix backquote support in here-document EOF mark

klibc-bot for Herbert Xu herbert at gondor.apana.org.au
Sat Mar 28 14:49:02 PDT 2020


Commit-ID:  e90b159a00304664ddc94fca392146f4bde1bcec
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=e90b159a00304664ddc94fca392146f4bde1bcec
Author:     Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Thu, 15 Mar 2018 18:27:30 +0800
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 28 Mar 2020 21:42:54 +0000

[klibc] dash: parser: Fix backquote support in here-document EOF mark

[ dash commit c166b718b496da63c4df7a0972df2fc6cd38256b ]

Currently using backquotes in a here-document EOF mark is broken
because dash tries to do command substitution on it.  This patch
fixes it by checking whether we're looking for an EOF mark during
tokenisation.

Reported-by: Harald van Dijk <harald at gigawatt.nl>
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/parser.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index cd980941..ae76400e 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -1037,6 +1037,11 @@ toggledq:
 				}
 				break;
 			case CBQUOTE:	/* '`' */
+				if (checkkwd & CHKEOFMARK) {
+					USTPUTC('`', out);
+					break;
+				}
+
 				PARSEBACKQOLD();
 				break;
 			case CEOF:


More information about the klibc mailing list