Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: $((##)) causes seg fault
- X-seq: zsh-workers 19308
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: PATCH: $((##)) causes seg fault
- Date: Wed, 17 Dec 2003 21:54:12 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
I just noticed that there is a bug report filed on Sourceforge: ((##))
causes a segmentation fault. Fix is below. Should I be printing an error
message instead of returning zero?
This is also applicable to 4.0
Oliver
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.56
diff -u -r1.56 utils.c
--- Src/utils.c 29 Oct 2003 19:17:30 -0000 1.56
+++ Src/utils.c 17 Dec 2003 20:38:24 -0000
@@ -3643,7 +3643,10 @@
}
DPUTS(fromwhere == 4, "BUG: unterminated $' substitution");
*t = '\0';
- *len = t - buf;
+ if (fromwhere == 6)
+ *misc = 0;
+ else
+ *len = t - buf;
return buf;
}
Index: Test/C01arith.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/C01arith.ztst,v
retrieving revision 1.6
diff -u -r1.6 C01arith.ztst
--- Test/C01arith.ztst 26 Mar 2003 17:33:40 -0000 1.6
+++ Test/C01arith.ztst 17 Dec 2003 20:38:24 -0000
@@ -68,6 +68,14 @@
0:#, ## and $#
>117
+ print $((##))
+0:## without following character
+>0
+
+ print $((## ))
+0:## followed by a space
+>32
+
integer i
(( i = 3 + 5 * 1.75 ))
print $i
Messages sorted by:
Reverse Date,
Date,
Thread,
Author