Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: free() error on simple input scripts
2014/12/07 15:36, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> source =(<<<$'d\\\0')
The input backslash-null is metafiled by shingetline() to
backslash-meta-space (since 0 xor 32 = 32 = ' '), but it seems
the lexer does not treat the meta after backslash specially and
interprets the space as a word separator; this results in a
word ending with meta.
What is the "correct" behavior for the input backslash-null?
The following may be a possibility but I'm not sure.
(The ifdef DEBUG part is copied from line 1059 in the same file)
diff --git a/Src/lex.c b/Src/lex.c
index 1a854f5..b2a0544 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1326,8 +1326,20 @@ gettokstr(int c, int sub)
c = hgetc();
if (!lexstop)
continue;
- } else
+ } else {
add(Bnull);
+ if (c == STOUC(Meta)) {
+ c = hgetc();
+#ifdef DEBUG
+ if (lexstop) {
+ fputs("BUG: input terminated by Meta\n", stderr);
+ fflush(stderr);
+ goto brk;
+ }
+#endif
+ add(Meta);
+ }
+ }
if (lexstop)
goto brk;
break;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author