Re: Expansion-lookalikes in heredoc delimiters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Harald van Dijk <harald@xxxxxxxxxxx> wrote:
>
> Changing dash to support this would in my opinion be unreasonable, as it 
> would require a total rewrite of the parser.

I don't think it's that hard.

---8<---
Subject: parser: Fix backquote support in here-document EOF mark

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@xxxxxxxxxxx>
Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

diff --git a/src/parser.c b/src/parser.c
index 382658e..283ed63 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1012,6 +1012,11 @@ quotemark:
 				}
 				break;
 			case CBQUOTE:	/* '`' */
+				if (checkkwd & CHKEOFMARK) {
+					USTPUTC('`', out);
+					break;
+				}
+
 				PARSEBACKQOLD();
 				break;
 			case CEOF:
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux