From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.10/8.6.9) with SMTP id PAA22323 for ; Thu, 25 May 1995 15:29:22 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA03369 (5.65c/Gatech-10.0-IDA for ); Thu, 25 May 1995 01:25:29 -0400 Received: by math (5.x/SMI-SVR4) id AA20391; Thu, 25 May 1995 01:20:52 -0400 Resent-Date: Thu, 25 May 1995 04:11:44 +0100 (BST) Old-Return-Path: From: Zefram Message-Id: <1843.199505250311@stone.dcs.warwick.ac.uk> Subject: ZLE history expansion bug fix To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Thu, 25 May 1995 04:11:44 +0100 (BST) X-Stardate: [-31]5725.66 Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-Id: <"xhqEV1.0.X-4.pE1nl"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/30 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----BEGIN PGP SIGNED MESSAGE----- There is a bug in ZLE history expansion (2.6-beta9-test2): % echo % !{e [zsh hangs, eating up processor time] The problem is that if a history reference is entered, using a { but not a matching }, containing a valid history reference followed by a space, ZLE enters an infinite loop. I have not been able to determine why these specific conditions are required to manifest this bug, nor whether any other set of conditions will work. My solution is to make all the ZLE code that calls the lexer treat LEXERR as a terminating token, as well as ENDINPUT. This solves the above bug. -zefram *** Src/zle_tricky.c.old Thu May 25 03:37:30 1995 --- Src/zle_tricky.c Thu May 25 04:01:09 1995 *************** *** 2831,2843 **** noaliases = 1; do { ctxtlex(); ! if (tok == ENDINPUT) break; if (!first && tokstr && *tokstr) addnode(foo, ztrdup(tokstr)); first = 0; ! } ! while (tok != ENDINPUT); noaliases = 0; hflush(); strinend(); --- 2831,2842 ---- noaliases = 1; do { ctxtlex(); ! if (tok == ENDINPUT || tok == LEXERR) break; if (!first && tokstr && *tokstr) addnode(foo, ztrdup(tokstr)); first = 0; ! } while (tok != ENDINPUT && tok != LEXERR); noaliases = 0; hflush(); strinend(); *************** *** 3735,3742 **** noerrs = 1; do { ctxtlex(); ! } ! while (tok != ENDINPUT && zleparse); noerrs = ne; noaliases = 0; hflush(); --- 3734,3740 ---- noerrs = 1; do { ctxtlex(); ! } while (tok != ENDINPUT && tok != LEXERR && zleparse); noerrs = ne; noaliases = 0; hflush(); *************** *** 3810,3816 **** do { curlincmd = incmdpos; ctxtlex(); ! if (tok == ENDINPUT) break; if (tok == STRING && curlincmd) { zsfree(s); --- 3808,3814 ---- do { curlincmd = incmdpos; ctxtlex(); ! if (tok == ENDINPUT || tok == LEXERR) break; if (tok == STRING && curlincmd) { zsfree(s); *************** *** 3818,3825 **** cmdwb = ll - wordbeg; cmdwe = ll + 1 - inbufct; } ! } ! while (tok != ENDINPUT && zleparse); hflush(); popheap(); strinend(); --- 3816,3822 ---- cmdwb = ll - wordbeg; cmdwe = ll + 1 - inbufct; } ! } while (tok != ENDINPUT && tok != LEXERR && zleparse); hflush(); popheap(); strinend(); -----BEGIN PGP SIGNATURE----- Version: 2.6.i iQBVAgUBL8P06WWJ8JfKi+e9AQGDyAH+INB1B95UTrWeOhPW8nSUchVt9tmmImZ1 kyYZJxbk5Trm4w/HVYA0PK0au8ig1azw1tAZ/0lDWI0bwqQy1OSg6g== =TKnv -----END PGP SIGNATURE-----