about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-12-18 10:49:52 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-12-18 10:49:52 +0000
commit4ad8d51ab9a5f30766707768c3e709710d58e4c2 (patch)
tree9dd3cff8fc6d60cdb7d795bd703e3fbff2c4a06f
parentf93857ab6585d1042eb422e99eead7159666e269 (diff)
downloadzsh-4ad8d51ab9a5f30766707768c3e709710d58e4c2.tar.gz
zsh-4ad8d51ab9a5f30766707768c3e709710d58e4c2.tar.xz
zsh-4ad8d51ab9a5f30766707768c3e709710d58e4c2.zip
Apply 19308 (## on its own in arithmetic. zsh-4.0.8
4.0.8
-rw-r--r--ChangeLog8
-rw-r--r--Completion/Unix/Command/.distfiles1
-rw-r--r--Config/version.mk4
-rw-r--r--Src/utils.c5
-rw-r--r--Test/C01arith.ztst98
5 files changed, 113 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ecf2606d3..328bf48fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2003-12-18  Peter Stephenson  <pws@csr.com>
+
+	* unposted: Config/version.mk, Completion/Unix/Command/.distfiles:
+	zsh-4.0.8.
+
+	* Oliver: 19308: Src/utils.c, Test/C01arith.ztst:
+	fix crash with lonely ## in arithmetic.
+
 2003-12-17  Clint Adams  <clint@zsh.org>
 
 	* Stephen RĂ¼ger: 19255: Completion/Debian/Command/_apt: update
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index 5c99e85d4..047ee4f86 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -21,4 +21,5 @@ _global                     _figlet       _ifconfig     _last         _larch
 _lsof         _mt           _xmlsoft      _elinks       _tidy         _python
 _antiword     _renice       _sablotron    _cdrecord     _aap          _du
 _rar          _vorbis       _subversion   _screen       _nice
+_ecasound     _gpg	    _nmap
 '
diff --git a/Config/version.mk b/Config/version.mk
index 6d1fc0666..d8a81b207 100644
--- a/Config/version.mk
+++ b/Config/version.mk
@@ -27,5 +27,5 @@
 # This must also serve as a shell script, so do not add spaces around the
 # `=' signs.
 
-VERSION=4.0.7
-VERSION_DATE='June 18, 2003'
+VERSION=4.0.8
+VERSION_DATE='December 17, 2003'
diff --git a/Src/utils.c b/Src/utils.c
index fafdd99d9..1d7d2e163 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3470,7 +3470,10 @@ getkeystring(char *s, int *len, int fromwhere, int *misc)
     }
     DPUTS(fromwhere == 4, "BUG: unterminated $' substitution");
     *t = '\0';
-    *len = t - buf;
+    if (fromwhere == 6)
+      *misc = 0;
+    else
+      *len = t - buf;
     return buf;
 }
 
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
new file mode 100644
index 000000000..536a23de4
--- /dev/null
+++ b/Test/C01arith.ztst
@@ -0,0 +1,98 @@
+# Tests corresponding to the texinfo node `Arithmetic Evaluation'
+
+%test
+
+  integer light there
+  (( light = 42 )) &&
+  let 'there = light' &&
+  print $(( there ))
+0:basic integer arithmetic
+>42
+
+  float light there
+  integer rnd
+  (( light = 3.1415 )) &&
+  let 'there = light' &&
+  print -- $(( rnd = there * 10000 ))
+# save rounding problems by converting to integer
+0:basic floating point arithmetic
+>31415
+
+  print $(( 0x10 + 0X01 + 2#1010 ))
+0:base input
+>27
+
+  float light
+  (( light = 4 ))
+  print $light
+  typeset -F light
+  print $light
+0:conversion to float
+>4.000000000e+00
+>4.0000000000
+
+  integer i
+  (( i = 32.5 ))
+  print $i
+0:conversion to int
+>32
+
+  integer i
+  (( i = 4 - - 3 * 7 << 1 & 7 ^ 1 | 16 ** 2 ))
+  print $i
+0:precedence (arithmetic)
+>1591
+
+  print $(( 1 < 2 || 2 < 2 && 3 > 4 ))
+0:precedence (logical)
+>1
+
+  print $(( 1 + 4 ? 3 + 2 ? 4 + 3 ? 5 + 6 ? 4 * 8 : 0 : 0 : 0 : 0 ))
+0:precedence (ternary)
+>32
+
+  print $(( 3 ? 2 ))
+1:parsing ternary (1)
+?ZTST_execchunk:2: ':' expected
+
+  print $(( 3 ? 2 : 1 : 4 ))
+1:parsing ternary (2)
+?ZTST_execchunk:2: ':' without '?'
+
+  print $(( 0, 4 ? 3 : 1, 5 ))
+0:comma operator
+>5
+
+  foo=000
+  print $(( ##A + ##\C-a + #foo + $#foo ))
+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
+0:promotion to float
+>11
+
+  typeset x      &&
+  (( x = 3.5 ))  &&
+  print $x       &&
+  (( x = 4 ))    &&
+  print $x
+0:use of scalars to store integers and floats
+>3.5
+>4
+
+  (( newarray[unsetvar]++ ))
+  (( newarray[unsetvar]++ ))
+  print ${(t)newarray} ${#newarray} ${newarray[1]}
+0:setting array elements in math context
+>array 1 2