Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Yikes! Missing Patches in zsh-2.6-beta14...



Hello,

Zoltan submitted some patches when zsh-2.6 was in beta12 and beta13.
Neither made it into beta13 or beta14.  Here are the patches (one is
slightly modified).  They address two problems:

	(1) Call init_term() if ``print -P'' is being used (otherwise,
	    escape sequences of the form '%B...%b' do not work in shell
	    scripts or noninteractive shells.

	(2) Fix crashes when using PROMPT_SUBST.  Recall the following
	    from Zoltan's message of 01-Mar-96:
	    
	    "[... after !! history expansion] lex.c calls the spell
	    checker on [a command] before the alias stack is popped.
	    The spell checker sees that [a misspelled command] should
	    be corrected, and prints the spelling correction prompt,
	    which then calls lexsave/lexrestore [...].  And the later
	    lexrestore calls clearalstack() which coredumps because of
	    the NULL entry that history expansion put there [...]"

The patches are included below.

- Eskandar


*** builtin.c.orig	Tue Apr 16 10:14:49 1996
--- builtin.c	Tue Apr 16 10:16:30 1996
***************
*** 4080,4087 ****
  	if (ops['D'])
  	    fprintdir(arg, fout);
  	else {
! 	    if (ops['P'])
  		arg = putprompt(arg, &len, NULL, 0);
  	    fwrite(arg, len, 1, fout);
  	    if(ops['P'])
  		free(arg);
--- 4080,4090 ----
  	if (ops['D'])
  	    fprintdir(arg, fout);
  	else {
! 	    if (ops['P']) {
!     		if (!termok && (isset(INTERACTIVE) || !init_term()))
! 		    return 1;
  		arg = putprompt(arg, &len, NULL, 0);
+ 	    }
  	    fwrite(arg, len, 1, fout);
  	    if(ops['P'])
  		free(arg);

*** lex.c.orig	Sun Apr 14 22:33:32 1996
--- lex.c	Tue Apr 16 10:20:07 1996
***************
*** 52,58 ****
      int histdone;
      int spaceflag;
      int stophist;
-     int alstackind;
      int hlinesz;
      char *hline;
      char *hptr;
--- 52,57 ----
***************
*** 83,88 ****
--- 82,93 ----
  {
      struct lexstack *ls;
  
+ #ifdef DEBUG
+     if (alstackind) {
+ 	fprintf(stdout, "BUG: lexsave called with alstackind != 0\n");
+ 	fflush(stdout);
+     }
+ #endif
      ls = (struct lexstack *)malloc(sizeof(struct lexstack));
  
      ls->incmdpos = incmdpos;
***************
*** 91,97 ****
      ls->dbparens = dbparens;
      ls->in_brace_param = in_brace_param;
      ls->alstat = alstat;
-     ls->alstackind = alstackind;
      ls->isfirstln = isfirstln;
      ls->isfirstch = isfirstch;
      ls->histremmed = histremmed;
--- 96,101 ----
***************
*** 155,161 ****
      chwordlen = lstack->chwordlen;
      chwordpos = lstack->chwordpos;
      clearalstack();
-     alstackind = lstack->alstackind;
      hlinesz = lstack->hlinesz;
      lexstop = errflag = 0;
  
--- 159,164 ----
***************
*** 917,923 ****
      hwget(&yytext);
      s = yytext;
      if (interact && isset(SHINSTDIN) && !strin && !incasepat && tok == STRING &&
! 	(isset(CORRECTALL) || (isset(CORRECT) && incmdpos)) && !nocorrect)
  	spckword(&tokstr, &s, incmdpos, 1);
      if (zleparse && !alstackind) {
  	int zp = zleparse;
--- 920,926 ----
      hwget(&yytext);
      s = yytext;
      if (interact && isset(SHINSTDIN) && !strin && !incasepat && tok == STRING &&
! 	(isset(CORRECTALL) || (isset(CORRECT) && incmdpos)) && !nocorrect && !alstackind)
  	spckword(&tokstr, &s, incmdpos, 1);
      if (zleparse && !alstackind) {
  	int zp = zleparse;




Messages sorted by: Reverse Date, Date, Thread, Author