zsh-workers
 help / color / mirror / code / Atom feed
* ZLE history expansion bug fix
@ 1995-05-25  3:11 Zefram
  1995-05-29 19:49 ` Zoltan Hidvegi
  0 siblings, 1 reply; 2+ messages in thread
From: Zefram @ 1995-05-25  3:11 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----BEGIN PGP SIGNED MESSAGE-----

There is a bug in ZLE history expansion (2.6-beta9-test2):

% echo

% !{e <TAB>
[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-----


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ZLE history expansion bug fix
  1995-05-25  3:11 ZLE history expansion bug fix Zefram
@ 1995-05-29 19:49 ` Zoltan Hidvegi
  0 siblings, 0 replies; 2+ messages in thread
From: Zoltan Hidvegi @ 1995-05-29 19:49 UTC (permalink / raw)
  To: Zefram

zefram wrote:
> There is a bug in ZLE history expansion (2.6-beta9-test2):
> 
> % echo
> 
> % !{e <TAB>
> [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.

All of these bugs are already corrected in my release. A new hzoli9 release
based on beta9-test5 is now avaible from ktud.elte.hu:/home/ftp/pub/zsh

Zoltan


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-05-29 18:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-05-25  3:11 ZLE history expansion bug fix Zefram
1995-05-29 19:49 ` Zoltan Hidvegi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).