zsh-workers
 help / color / mirror / code / Atom feed
From: Eskandar Ensafi <esky@CS.UCLA.EDU>
To: zsh-workers@math.gatech.edu
Subject: Yikes! Missing Patches in zsh-2.6-beta14...
Date: Tue, 16 Apr 1996 12:16:39 -0700	[thread overview]
Message-ID: <9604161916.AA10761@marathon.cs.ucla.edu> (raw)


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;



             reply	other threads:[~1996-04-16 19:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-16 19:16 Eskandar Ensafi [this message]
1996-04-16 19:57 ` Zoltan Hidvegi
1996-04-16 20:04   ` Eskandar Ensafi
1996-04-17  0:18     ` Richard J. Coleman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9604161916.AA10761@marathon.cs.ucla.edu \
    --to=esky@cs.ucla.edu \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).