From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4340 invoked by alias); 9 Dec 2014 17:14:27 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33940 Received: (qmail 14283 invoked from network); 9 Dec 2014 17:14:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,RCVD_IN_BRBL_LASTEXT, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 X-Biglobe-Sender: Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: free() error on simple input scripts From: "Jun T." In-Reply-To: <141206223657.ZM28506@torch.brasslantern.com> Date: Wed, 10 Dec 2014 00:45:42 +0900 Content-Transfer-Encoding: 7bit Message-Id: References: <20141206042732.GA28745@ti.fritz.box> <141206150753.ZM2978@torch.brasslantern.com> <141206223657.ZM28506@torch.brasslantern.com> To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.1878.6) X-Biglobe-Spnum: 59815 2014/12/07 15:36, Bart Schaefer 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;