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

PATCH: prompt bug (Re: [matthias@xxxxxxxxxxxxxx: Re: pcre-module])



Clint Adams wrote:
> ----- Forwarded message from Matthias Kopfermann <matthias@xxxxxxxxxxxxxx> -----
> As Bart is busy (I told him), there is a _serious_ - I guess so, but I am
> not quite sure- bug in zsh that I found out today:
> 
> Its with the prompt variable %v.
> I tried `print -P %-10v' and i got a segfault on all 4.x

Thanks for spotting this.

This should fix it.

Oliver

Index: Src/prompt.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/prompt.c,v
retrieving revision 1.14
diff -u -r1.14 prompt.c
--- Src/prompt.c	13 Nov 2003 14:34:38 -0000	1.14
+++ Src/prompt.c	21 Apr 2004 08:10:29 -0000
@@ -579,7 +579,7 @@
 		    arg = 1;
 		else if (arg < 0)
 		    arg += arrlen(psvar) + 1;
-		if (arrlen(psvar) >= arg)
+		if (arg > 0 && arrlen(psvar) >= arg)
 		    stradd(psvar[arg - 1]);
 		break;
 	    case 'E':



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