From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3) with ESMTP id FAA21300 for ; Wed, 17 Apr 1996 05:35:38 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id PAA25897; Tue, 16 Apr 1996 15:21:43 -0400 (EDT) Resent-Date: Tue, 16 Apr 1996 15:21:43 -0400 (EDT) Message-Id: <9604161916.AA10761@marathon.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 From: Eskandar Ensafi Resent-Message-ID: <"j2mLd3.0.ZK6.6D_Sn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/930 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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;