From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25140 invoked from network); 11 Aug 2003 13:10:59 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Aug 2003 13:10:59 -0000 Received: (qmail 5764 invoked by alias); 11 Aug 2003 13:10:53 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18941 Received: (qmail 5754 invoked from network); 11 Aug 2003 13:10:53 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 11 Aug 2003 13:10:53 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 11 Aug 2003 13:10:52 -0000 Received: from EXCHANGE02.csr.com (unverified) by MAILSWEEPER01.cambridgesiliconradio.com (Content Technologies SMTPRS 4.3.10) with ESMTP id for ; Mon, 11 Aug 2003 14:10:01 +0100 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 11 Aug 2003 14:12:26 +0100 To: zsh-workers@sunsite.dk Subject: Re: Unexpected alias expansion in history list In-reply-to: "Haakon Riiser"'s message of "Mon, 11 Aug 2003 00:19:07 +0200." <20030810221907.GA15013@s.chello.no> Date: Mon, 11 Aug 2003 14:10:48 +0100 Message-ID: <17910.1060607448@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 11 Aug 2003 13:12:26.0954 (UTC) FILETIME=[36112AA0:01C3600A] Haakon Riiser wrote: > The following "bug" is probably not important, since it only > happens in a syntactically illegal command, but I chose to report > it anyway, in case the bug has other (more serious) symptomps. > > Steps to reproduce: > > % zsh -f > % alias foo='foo bar' > % (foo) foo > zsh: parse error near `foo' > % history > 1 alias foo='foo bar' > 2 (foo) foo bar > ^^^^^^^ Actually, I think it's relatively harmless because it only shows up when parsing output after an error. However, I think we can get it right quite easily, too. Index: Src/hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/hist.c,v retrieving revision 1.45 diff -u -r1.45 hist.c --- Src/hist.c 14 Jun 2002 17:52:05 -0000 1.45 +++ Src/hist.c 11 Aug 2003 13:08:12 -0000 @@ -290,6 +290,8 @@ void herrflush(void) { + inpopalias(); + while (!lexstop && inbufct && !strin) hwaddc(ingetc()); } Index: Src/input.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/input.c,v retrieving revision 1.7 diff -u -r1.7 input.c --- Src/input.c 17 Feb 2003 14:07:11 -0000 1.7 +++ Src/input.c 11 Aug 2003 13:08:13 -0000 @@ -549,3 +549,17 @@ inpoptop(); } while (remcont); } + +/* + * Expunge any aliases from the input stack; they shouldn't appear + * in the history and need to be flushed explicitly when we encounter + * an error. + */ + +/**/ +void +inpopalias(void) +{ + while (inbufflags & INP_ALIAS) + inpoptop(); +} -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************