zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: $((##)) causes seg fault
@ 2003-12-17 20:54 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2003-12-17 20:54 UTC (permalink / raw)
  To: Zsh workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-12-17 20:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-17 20:54 PATCH: $((##)) causes seg fault Oliver Kiddle

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).