summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2011-12-14 01:30:08 +0100
committerAxel Beckert <abe@deuxchevaux.org>2011-12-14 01:31:10 +0100
commit3e739c6befbab45a3b6e460b5ce26ac0359155ec (patch)
tree0cc28cfd413d9f2a3c5c13da83606f2829e641ba
parent00f335b142707b7f9e3531714b7a3bf5b377dcc1 (diff)
parent79f2f7fa2ce18552869afa33f1d0d42cf4191b04 (diff)
downloadzsh-3e739c6befbab45a3b6e460b5ce26ac0359155ec.tar.gz
zsh-3e739c6befbab45a3b6e460b5ce26ac0359155ec.zip
Merge commit 'zsh-4.3.14' into debian
-rw-r--r--ChangeLog32
-rw-r--r--Completion/Unix/Command/_nm3
-rw-r--r--Config/version.mk4
-rw-r--r--Etc/FAQ.yo2
-rw-r--r--README2
-rw-r--r--Src/lex.c12
-rw-r--r--Src/utils.c4
-rw-r--r--Test/A04redirect.ztst4
-rw-r--r--Test/B01cd.ztst14
-rwxr-xr-xTest/ztst.zsh71
10 files changed, 116 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 1bff2da72..48b89b147 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2011-12-06 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: Config/version.mk: release 4.3.14.
+
+2011-12-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 29940: Src/utils.c (metafy): null termination shouldn't
+ be applied to original buffer if not to be modified.
+
+ * From Stef VAN VLIERBERGHE: 29934: Src/lex.c (add): use of
+ uninitialised memory when lexer needed to reallocate token.
+
+2011-12-02 Peter Stephenson <pws@csr.com>
+
+ * unposted: Test/B01cd.ztst: fix documentation for '*'
+ test output syntax.
+
+2011-12-01 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 29924: Test/A04redirect.ztst, Test/B01cd.ztst, Test/ztst.zsh:
+ add ability to match output of tests using patterns.
+
+2011-12-01 Peter Stephenson <pws@csr.com>
+
+ * unposted: Completion/Unix/Command/_nm: also complete
+ directories.
+
+ * 29923: Test/A04redirect.ztst: work around variant message from
+ strerror() for invalid file descriptor.
+
2011-11-30 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Config/version.mk: 4.3.13 release.
@@ -15627,5 +15657,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5509 $
+* $Revision: 1.5517 $
*****************************************************
diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm
index 276a38f19..5638014d6 100644
--- a/Completion/Unix/Command/_nm
+++ b/Completion/Unix/Command/_nm
@@ -22,7 +22,8 @@ case $state in
"object-files:object file:_path_files -g '*.o'" \
"executable-files:executable file:_path_files -g '*(*)'" \
"dynamic-libraries:dynamic library:_path_files -g '*.so'" \
- "static-libraries:static library:_path_files -g '*.a'" && ret=0
+ "static-libraries:static library:_path_files -g '*.a'" \
+ "directories:directory:_path_files -g '*(/)'" && ret=0
;;
esac
diff --git a/Config/version.mk b/Config/version.mk
index adde27080..0380bcba2 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.3.13
-VERSION_DATE='November 30, 2011'
+VERSION=4.3.14
+VERSION_DATE='December 6, 2011'
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index b401c632e..973eea8ef 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -302,7 +302,7 @@ sect(On what machines will it run?)
sect(What's the latest version?)
Zsh 4.2.7 is the latest production version. The latest development
- version is 4.3.13; this contains support for multibyte character strings
+ version is 4.3.14; this contains support for multibyte character strings
(such as UTF-8 locales). All the main features for multibyte
support are now in place and this is likely soon to become the
stable series 4.4.
diff --git a/README b/README
index 07e1f7357..ce359a7b7 100644
--- a/README
+++ b/README
@@ -5,7 +5,7 @@ THE Z SHELL (ZSH)
Version
-------
-This is version 4.3.13 of the shell. This is a development release,
+This is version 4.3.14 of the shell. This is a development release,
but is believed to be reasonably stable. Sites where the users need to
edit command lines with multibyte characters (in particular UTF-8)
will probably want to upgrade. The previous widely released version
diff --git a/Src/lex.c b/Src/lex.c
index 90c4effd9..05f54f842 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -567,22 +567,14 @@ add(int c)
{
*bptr++ = c;
if (bsiz == ++len) {
-#if 0
- int newbsiz;
-
- newbsiz = bsiz * 8;
- while (newbsiz < inbufct)
- newbsiz *= 2;
- bptr = len + (tokstr = (char *)hrealloc(tokstr, bsiz, newbsiz));
- bsiz = newbsiz;
-#endif
-
int newbsiz = bsiz * 2;
if (newbsiz > inbufct && inbufct > bsiz)
newbsiz = inbufct;
bptr = len + (tokstr = (char *)hrealloc(tokstr, bsiz, newbsiz));
+ /* len == bsiz, so bptr is at the start of newly allocated memory */
+ memset(bptr, 0, newbsiz - bsiz);
bsiz = newbsiz;
}
}
diff --git a/Src/utils.c b/Src/utils.c
index 6c2ea98d5..014cb2fa2 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3959,7 +3959,7 @@ metafy(char *buf, int len, int heap)
if (imeta(*e++))
meta++;
- if (meta || heap == META_DUP || heap == META_HEAPDUP) {
+ if (meta || heap == META_DUP || heap == META_HEAPDUP || *e != '\0') {
switch (heap) {
case META_REALLOC:
buf = zrealloc(buf, len + meta + 1);
@@ -4002,8 +4002,8 @@ metafy(char *buf, int len, int heap)
meta--;
}
}
+ *e = '\0';
}
- *e = '\0';
return buf;
}
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index e58102664..888a0d480 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -155,7 +155,7 @@
(exec 3<&-
read foo <&-)
1:'<&-' redirection
-?(eval):1: failed to close file descriptor 3: bad file descriptor
+*?\(eval\):1: failed to close file descriptor 3:*
print foo >&-
0:'>&-' redirection
@@ -163,7 +163,7 @@
(exec >&-
print foo)
0:'>&-' with attempt to use closed fd
-?(eval):2: write error: bad file descriptor
+*?\(eval\):2: write error:*
fn() { local foo; read foo; print $foo; }
coproc fn
diff --git a/Test/B01cd.ztst b/Test/B01cd.ztst
index b5ba4d03b..c7920dd05 100644
--- a/Test/B01cd.ztst
+++ b/Test/B01cd.ztst
@@ -53,9 +53,17 @@
# stderr.
#
# The rules for '<', '>' and '?' lines are the same: only the first
-# character is stripped, with subsequent whitespace being significant;
-# lines are not subject to any substitution unless the `q' flag (see
-# below) is set.
+# character is stripped (with the excpetion for '*' noted below), with
+# subsequent whitespace being significant; lines are not subject to any
+# substitution unless the `q' flag (see below) is set.
+#
+# The first line (only) of a '>' and '?' chunk may be preceded by a '*',
+# so the line starts '*>' or '*?'. This signifies that all lines in the
+# chunk (not just the one with the '*' in front) in the actual output
+# are pattern matched against the corresponding lines in the test
+# output. Each line following '>' or '?' must be a valid pattern, so
+# characters special to patterns such as parentheses must be quoted
+# with a backslash. The EXTENDED_GLOB option is used for all such patterns.
#
# Each chunk of indented code is to be evaluated in one go and is to
# be followed by a line starting (in the first column) with
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index 4b583a5a8..745a13cff 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -285,12 +285,52 @@ $ZTST_code" && return 0
# diff wrapper
ZTST_diff() {
- local diff_out diff_ret
+ emulate -L zsh
+ setopt extendedglob
+
+ local diff_out
+ integer diff_pat diff_ret
+
+ case $1 in
+ (p)
+ diff_pat=1
+ ;;
- diff_out=$(diff "$@")
- diff_ret="$?"
- if [[ "$diff_ret" != "0" ]]; then
- print -r "$diff_out"
+ (d)
+ ;;
+
+ (*)
+ print "Bad ZTST_diff code: d for diff, p for pattern match"
+ ;;
+ esac
+ shift
+
+ if (( diff_pat )); then
+ local -a diff_lines1 diff_lines2
+ integer failed i
+
+ diff_lines1=("${(f)$(<$argv[-2])}")
+ diff_lines2=("${(f)$(<$argv[-1])}")
+ if (( ${#diff_lines1} != ${#diff_lines2} )); then
+ failed=1
+ else
+ for (( i = 1; i <= ${#diff_lines1}; i++ )); do
+ if [[ ${diff_lines2[i]} != ${~diff_lines1[i]} ]]; then
+ failed=1
+ break
+ fi
+ done
+ fi
+ if (( failed )); then
+ print -rl "Pattern match failed:" \<${^diff_lines1} \>${^diff_lines2}
+ diff_ret=1
+ fi
+ else
+ diff_out=$(diff "$@")
+ diff_ret="$?"
+ if [[ "$diff_ret" != "0" ]]; then
+ print -r "$diff_out"
+ fi
fi
return "$diff_ret"
@@ -298,6 +338,7 @@ ZTST_diff() {
ZTST_test() {
local last match mbegin mend found substlines
+ local diff_out diff_err
while true; do
rm -f $ZTST_in $ZTST_out $ZTST_err
@@ -305,6 +346,8 @@ ZTST_test() {
ZTST_message=''
ZTST_failmsg=''
found=0
+ diff_out=d
+ diff_err=d
ZTST_verbose 2 "ZTST_test: looking for new test"
@@ -343,10 +386,20 @@ $ZTST_curline"
('<'*) ZTST_getredir || return 1
found=1
;;
- ('>'*) ZTST_getredir || return 1
+ ('*>'*)
+ ZTST_curline=${ZTST_curline[2,-1]}
+ diff_out=p
+ ;&
+ ('>'*)
+ ZTST_getredir || return 1
found=1
;;
- ('?'*) ZTST_getredir || return 1
+ ('*?'*)
+ ZTST_curline=${ZTST_curline[2,-1]}
+ diff_err=p
+ ;&
+ ('?'*)
+ ZTST_getredir || return 1
found=1
;;
('F:'*) ZTST_failmsg="${ZTST_failmsg:+${ZTST_failmsg}
@@ -390,7 +443,7 @@ $(<$ZTST_terr)"
rm -rf $ZTST_out
print -r -- "${(e)substlines}" >$ZTST_out
fi
- if [[ $ZTST_flags != *d* ]] && ! ZTST_diff -c $ZTST_out $ZTST_tout; then
+ if [[ $ZTST_flags != *d* ]] && ! ZTST_diff $diff_out -c $ZTST_out $ZTST_tout; then
ZTST_testfailed "output differs from expected as shown above for:
$ZTST_code${$(<$ZTST_terr):+
Error output:
@@ -402,7 +455,7 @@ $(<$ZTST_terr)}"
rm -rf $ZTST_err
print -r -- "${(e)substlines}" >$ZTST_err
fi
- if [[ $ZTST_flags != *D* ]] && ! ZTST_diff -c $ZTST_err $ZTST_terr; then
+ if [[ $ZTST_flags != *D* ]] && ! ZTST_diff $diff_err -c $ZTST_err $ZTST_terr; then
ZTST_testfailed "error output differs from expected as shown above for:
$ZTST_code"
return 1