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

Re: [bug] type -m '^foo'



On Fri, 1 Oct 2004, Stephane Chazelas wrote:

> With latest CVS version as well as 4.2.0
> 
> $ type -m '(^a)'
> 
> segfaults.

This fixes the crash, but it would be better if pattry() could be 
rewritten so as not to need to modify the string in place.

Index: Src/hashtable.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/hashtable.c,v
retrieving revision 1.10
diff -c -r1.10 hashtable.c
--- Src/hashtable.c	22 Jun 2004 07:53:05 -0000	1.10
+++ Src/hashtable.c	1 Oct 2004 16:53:31 -0000
@@ -433,7 +433,7 @@
 	    HashNode hn = st.u.u;
 	    st.u.u = st.u.u->next;
 	    if ((hn->flags & flags1) + !flags1 && !(hn->flags & flags2) &&
-		pattry(pprog, hn->nam)) {
+		pattry(pprog, dupstring(hn->nam))) {
 		scanfunc(hn, scanflags);
 		match++;
 	    }



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