Re: Command substitution in here-documents

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

 



I've been continuing to worry about this.

In the old code (prior to commit 7c245aa) the TNL token that was
detected in list() had actually been read.  The current code uses
peektoken().

When parseheredoc() is called in interactive mode the last call to
readtoken() is in the code to set the prompt.  Even though the text
of that token is long gone it's used anyway.  Exactly what then happens
on a given platform depends on how memory allocation is handled.

I can make the error go away by explicitly reading the TNL token when
peektoken() detects a newline and we're about to call parseheredoc().

Of course, I may be wrong.

Ron
---
 src/parser.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/parser.c b/src/parser.c
index c4e6378..b9bc0ca 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -170,6 +170,7 @@ list(int nlflag)
 		case TNL:
 			if (!(nlflag & 1))
 				break;
+			readtoken();
 			parseheredoc();
 			return n1;
 
-- 
2.17.1




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

  Powered by Linux