summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog107
-rw-r--r--Completion/Unix/Command/_getopt7
-rw-r--r--Completion/Unix/Type/_path_files2
-rw-r--r--Completion/Unix/Type/_time_zone3
-rw-r--r--Config/version.mk4
-rw-r--r--Doc/Zsh/expn.yo3
-rw-r--r--Doc/Zsh/params.yo3
-rw-r--r--Doc/version.yo4
-rw-r--r--Doc/zsh.12
-rw-r--r--Doc/zsh.texi19
-rw-r--r--Doc/zshall.14
-rw-r--r--Doc/zshbuiltins.12
-rw-r--r--Doc/zshcalsys.12
-rw-r--r--Doc/zshcompctl.12
-rw-r--r--Doc/zshcompsys.12
-rw-r--r--Doc/zshcompwid.12
-rw-r--r--Doc/zshcontrib.18
-rw-r--r--Doc/zshexpn.14
-rw-r--r--Doc/zshmisc.12
-rw-r--r--Doc/zshmodules.12
-rw-r--r--Doc/zshoptions.12
-rw-r--r--Doc/zshparam.17
-rw-r--r--Doc/zshroadmap.12
-rw-r--r--Doc/zshtcpsys.12
-rw-r--r--Doc/zshzftpsys.12
-rw-r--r--Doc/zshzle.12
-rw-r--r--Etc/BUGS21
-rw-r--r--Etc/creating-a-release.txt3
-rw-r--r--NEWS10
-rw-r--r--Src/Modules/stat.c12
-rw-r--r--Src/Modules/system.c4
-rw-r--r--Src/Zle/compcore.c2
-rw-r--r--Src/builtin.c3
-rw-r--r--Src/exec.c10
-rw-r--r--Src/hist.c4
-rw-r--r--Src/input.c24
-rw-r--r--Src/jobs.c17
-rw-r--r--Src/params.c20
-rw-r--r--Src/patchlevel.h.release2
-rw-r--r--Src/pattern.c10
-rw-r--r--Src/prompt.c2
-rw-r--r--Test/C03traps.ztst2
-rw-r--r--Test/D02glob.ztst12
-rw-r--r--Test/E03posix.ztst2
-rw-r--r--Test/P01privileged.ztst23
-rw-r--r--Test/README7
-rw-r--r--Test/V14system.ztst2
-rw-r--r--Test/X03zlebindkey.ztst1
-rwxr-xr-xTest/ztst.zsh65
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure80
-rw-r--r--configure.ac59
52 files changed, 482 insertions, 119 deletions
diff --git a/ChangeLog b/ChangeLog
index 212007ba4..7de1a877a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,110 @@
+2022-05-01 dana <dana@dana.is>
+
+ * unposted: Config/version.mk: Update for 5.8.1.3-test (5.9)
+
+ * unposted: Etc/creating-a-release.txt: Mention #zsh topic
+
+2022-04-30 Bart Schaefer <schaefer@zsh.org>
+
+ * unposted: Etc/BUGS: remove debian #924736, fixed since 5.8 by
+ workers/44142; correct misguided edit from earlier commit
+
+ * unposted: Doc/Zsh/expn.yo, NEWS: Details about ${(*)...}
+
+ * 50150: Src/Modules/stat.c: Filenames need unmetafy for printing
+
+ * 50149: Etc/BUGS, Src/builtin.c, Src/jobs.c: Remove all =(...)
+ files at shell exit
+
+2022-04-29 Bart Schaefer <schaefer@zsh.org>
+
+ * 50136: Etc/BUGS, Src/exec.c: Fix =(nosuchcommand) race/deadlock
+ first reported in workers/42609
+
+ * 50134: Src/jobs.c: Tweak process group handling (workers/43409)
+ to avoid creating "unkillable" pipelines that ignore signals
+
+ * unposted: Etc/BUGS: Details about STTY; consistency nit
+
+2022-04-28 Bart Schaefer <schaefer@zsh.org>
+
+ * 50138: Doc/Zsh/params.yo: Note ERRNO must be set before use.
+
+ * 50133 (Bart, PWS, Jun-ichi): Src/input.c, configure.ac: when
+ lseek(2) is available, use it to check for and rewind read-ahead
+ for more efficient line-buffered input.
+
+ * 50126: Etc/BUGS, Src/exec.c: Fix multios in current-shell "exec"
+
+ * 50101: Src/Modules/system.c: sysread -o with param matches doc
+
+2022-04-26 dana <dana@dana.is>
+
+ * unposted: Completion/Unix/Command/_getopt: Fix util-linux
+ variant detection
+
+ * unposted: NEWS: Adjust dedication wording
+
+2022-04-26 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 50089: Test/X03zlebindkey.ztst: unset LC_* for multibyte tests
+
+2022-04-12 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 50049: Src/exec.c, Src/prompt.c: care with signed character
+ indices on the few remaining systems such as Cygwin that aren't
+ otherwise protected.
+
+2022-04-20 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 50081: Src/pattern.c, Src/params.c: reset global mbstate_t
+ variables when LC_CTYPE changes
+
+ * 50080: Src/hist.c: add missing STOUC() in casemodify()
+
+2022-04-19 Bart Schaefer <schaefer@zsh.org>
+
+ * unposted (cf. users/27656 (Tomasz Pala), users/27660):
+ Completion/Unix/Type/_path_files: fix $SUFFIX when GLOB_COMPLETE
+
+2022-04-14 Bart Schaefer <schaefer@zsh.org>
+
+ * 50069: Test/C03traps.ztst: fix test description
+
+ * 50068: Etc/BUGS, Src/builtin.c, Test/C03traps.ztst: 'exit' in
+ trap causes calling function to return (fixes workers/44007)
+
+2022-04-14 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 50052: Test/V14system.ztst: do nothing when skipping the test
+
+ * 50046: Test/ztst.zsh: export LANG to child zsh
+
+2022-04-12 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 50013: Test/P01privileged.ztst, Test/ztst.zsh: skip %test if
+ a chunk in %prep returns nonzero
+
+ * 49996 (Peter) + 50012: Test/README, Test/ztst.zsh: add
+ ZTST_continue to continue tests after a failure
+
+ * 50017: Completion/Unix/Type/_time_zone: allow lowercase to
+ match with uppercase
+
+2022-04-11 Bart Schaefer <schaefer@zsh.org>
+
+ * 50043: Test/D02glob.ztst, Test/E03posix.ztst: for root user,
+ skip glob tests that rely on limited privilege and fix EUID test
+
+2022-04-11 Mikael Magnusson <mikachu@gmail.com>
+
+ * 50042: Src/Zle/compcore.c: Another fix for 49915
+
+2022-04-10 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: NEWS: Improve flow between the paragraph and
+ its links.
+
2022-04-09 dana <dana@dana.is>
* unposted: Config/version.mk, Etc/FAQ.yo: Update for
diff --git a/Completion/Unix/Command/_getopt b/Completion/Unix/Command/_getopt
index 3359818b5..a8b0f6fc9 100644
--- a/Completion/Unix/Command/_getopt
+++ b/Completion/Unix/Command/_getopt
@@ -2,9 +2,10 @@
local -a args aopts
-# Note: BusyBox getopt is borrowed straight from util-linux, so they're
-# basically identical
-if _pick_variant busybox=BusyBox util-linux='getopt*enhanced' unix --version; then
+# @todo BusyBox getopt is borrowed straight from util-linux, so they're nearly
+# identical, but not quite: BusyBox doesn't have -h and -V and often doesn't
+# support long options. So possibly this could be more accurate
+if _pick_variant busybox=BusyBox util-linux='(enhanced|util-linux)' unix --version; then
args=(
'(-a --alternative)'{-a,--alternative}'[allow long options with single -]'
'(: -)'{-h,--help}'[display help information]'
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index 06d9d8d51..d46dcbe5a 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -734,7 +734,7 @@ for prepath in "$prepaths[@]"; do
compadd "$tmp4[@]" -s "${Uopt:+$ISUFFIX}" $listopts - "$tmpdisp"
done
else
- [[ -n "$compstate[pattern_match]" ]] && SUFFIX="${SUFFIX:s./.*/}*"
+ [[ -n "$compstate[pattern_match]" ]] && SUFFIX="${SUFFIX:gs./.*/}*"
for i in "$tmp1[@]"; do
_list_files i "$prepath$realpath$testpath"
diff --git a/Completion/Unix/Type/_time_zone b/Completion/Unix/Type/_time_zone
index c437252a8..a7b63adcd 100644
--- a/Completion/Unix/Type/_time_zone
+++ b/Completion/Unix/Type/_time_zone
@@ -6,4 +6,5 @@ if (( ! $+_zoneinfo_dirs )); then
_zoneinfo_dirs=( /usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/) )
fi
-_wanted time-zones expl 'time zone' _files -g '[A-Z]*' -W _zoneinfo_dirs "$@" -
+_wanted time-zones expl 'time zone' \
+ _files -g '[A-Z]*' -M 'm:{a-z}={A-Z}' -W _zoneinfo_dirs "$@" -
diff --git a/Config/version.mk b/Config/version.mk
index bf14a2eb2..ee6058b0d 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=5.8.1.2-test
-VERSION_DATE='April 9, 2022'
+VERSION=5.8.1.3-test
+VERSION_DATE='May 1, 2022'
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index bbacc6ae4..eb8cdbae5 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -1498,8 +1498,9 @@ form using `tt(%%)' will remove the same matches as for `tt(##)' in reverse
order.
)
item(tt(*))(
+pindex(EXTENDED_GLOB, enable)
Enable tt(EXTENDED_GLOB) for substitution via tt(${)...tt(/)...tt(}) or
-tt(${)...tt(//)...tt(}).
+tt(${)...tt(//)...tt(}). Note that `tt(**)' does not disable extendedglob.
)
item(tt(B))(
Include the index of the beginning of the match in the result.
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 6d2d41b7a..b543d1c38 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -750,6 +750,9 @@ as set by the most recently failed system call.
This value is system dependent and is intended for debugging
purposes. It is also useful with the tt(zsh/system) module which
allows the number to be turned into a name or message.
+
+To use this parameter, it must first be assigned a value (typically
+0 (zero)). It is initially unset for scripting compatibility.
)
vindex(FUNCNEST)
item(tt(FUNCNEST) <S>)(
diff --git a/Doc/version.yo b/Doc/version.yo
index ed5d73cbc..3ca873cfd 100644
--- a/Doc/version.yo
+++ b/Doc/version.yo
@@ -1,6 +1,6 @@
IFDEF(INCWSLEVEL)(INCWSLEVEL())(STARTDEF())
-def(version)(0)(5.8.1.2-test)
-def(date)(0)(April 9, 2022)
+def(version)(0)(5.8.1.3-test)
+def(date)(0)(May 1, 2022)
def(zshenv)(0)(/etc/zshenv)
def(zprofile)(0)(/etc/zprofile)
def(zshrc)(0)(/etc/zshrc)
diff --git a/Doc/zsh.1 b/Doc/zsh.1
index f85583d23..b5a7a96c3 100644
--- a/Doc/zsh.1
+++ b/Doc/zsh.1
@@ -1,4 +1,4 @@
-.TH "ZSH" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSH" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zsh \- the Z shell
.\" Yodl file: Zsh/intro.yo
diff --git a/Doc/zsh.texi b/Doc/zsh.texi
index 4509b7c92..9796d4c81 100644
--- a/Doc/zsh.texi
+++ b/Doc/zsh.texi
@@ -27,8 +27,8 @@
@end iftex
@titlepage
@title The Z Shell Manual
-@subtitle Version 5.8.1.2-test
-@subtitle Updated April 9, 2022
+@subtitle Version 5.8.1.3-test
+@subtitle Updated May 1, 2022
@author Original documentation by Paul Falstad
@page
This is a texinfo version of the documentation for the Z Shell, originally by
@@ -63,7 +63,7 @@ POSIX shells, but its default mode is not POSIX compatible, either.
@noindent
@cindex version
-Version 5.8.1.2-test, last updated April 9, 2022.
+Version 5.8.1.3-test, last updated May 1, 2022.
@end ifinfo
@menu
@@ -5957,8 +5957,9 @@ form using `@t{%%}' will remove the same matches as for `@t{##}' in reverse
order.
@item @t{*}
+@pindex EXTENDED_GLOB, enable
Enable @t{EXTENDED_GLOB} for substitution via @t{$@{}...@t{/}...@t{@}} or
-@t{$@{}...@t{//}...@t{@}}.
+@t{$@{}...@t{//}...@t{@}}. Note that `@t{**}' does not disable extendedglob.
@item @t{B}
Include the index of the beginning of the match in the result.
@@ -8596,6 +8597,10 @@ This value is system dependent and is intended for debugging
purposes. It is also useful with the @t{zsh/system} module which
allows the number to be turned into a name or message.
+@noindent
+To use this parameter, it must first be assigned a value (typically
+0 (zero)). It is initially unset for scripting compatibility.
+
@vindex FUNCNEST
@item @t{FUNCNEST} <S>
Integer. If greater than or equal to zero, the maximum nesting depth of
@@ -35518,7 +35523,7 @@ distribution in your home directory, you would use the commands:
@noindent
@example
mkdir ~/zsh_help
-perl ~/zsh-5.8.1.2-test/Util/helpfiles ~/zsh_help
+perl ~/zsh-5.8.1.3-test/Util/helpfiles ~/zsh_help
@end example
@noindent
@@ -35679,7 +35684,7 @@ Run @t{zkbd} either as an autoloaded function, or as a shell script:
@noindent
@example
-zsh -f ~/zsh-5.8.1.2-test/Functions/Misc/zkbd
+zsh -f ~/zsh-5.8.1.3-test/Functions/Misc/zkbd
@end example
@noindent
@@ -35744,7 +35749,7 @@ command and redirect the output into a file:
@noindent
@example
-. ~/zsh-5.8.1.2-test/Util/reporter > zsh.report
+. ~/zsh-5.8.1.3-test/Util/reporter > zsh.report
@end example
@noindent
diff --git a/Doc/zshall.1 b/Doc/zshall.1
index 15ff09107..23e556c42 100644
--- a/Doc/zshall.1
+++ b/Doc/zshall.1
@@ -1,4 +1,4 @@
-.TH "ZSHALL" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHALL" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshall \- the Z shell meta\-man page
.\" Yodl file: Zsh/intro.yo
@@ -486,7 +486,7 @@ file will be used instead\&.
.so man1/zshtcpsys.1
.so man1/zshzftpsys.1
.so man1/zshcontrib.1
-.TH "ZSHALL" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2\-test"
+.TH "ZSHALL" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3\-test"
.\" Yodl file: Zsh/filelist.yo
.SH "FILES"
.PD 0
diff --git a/Doc/zshbuiltins.1 b/Doc/zshbuiltins.1
index 5b4acbfd0..b420791a5 100644
--- a/Doc/zshbuiltins.1
+++ b/Doc/zshbuiltins.1
@@ -1,4 +1,4 @@
-.TH "ZSHBUILTINS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHBUILTINS" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshbuiltins \- zsh built\-in commands
.\" Yodl file: Zsh/builtins.yo
diff --git a/Doc/zshcalsys.1 b/Doc/zshcalsys.1
index 0a9b557b6..c6bc64e4b 100644
--- a/Doc/zshcalsys.1
+++ b/Doc/zshcalsys.1
@@ -1,4 +1,4 @@
-.TH "ZSHCALSYS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHCALSYS" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshcalsys \- zsh calendar system
.\" Yodl file: Zsh/calsys.yo
diff --git a/Doc/zshcompctl.1 b/Doc/zshcompctl.1
index a70703099..ec9f58fe6 100644
--- a/Doc/zshcompctl.1
+++ b/Doc/zshcompctl.1
@@ -1,4 +1,4 @@
-.TH "ZSHCOMPCTL" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHCOMPCTL" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshcompctl \- zsh programmable completion
.\" Yodl file: Zsh/compctl.yo
diff --git a/Doc/zshcompsys.1 b/Doc/zshcompsys.1
index 1edd707b8..f43924b46 100644
--- a/Doc/zshcompsys.1
+++ b/Doc/zshcompsys.1
@@ -1,4 +1,4 @@
-.TH "ZSHCOMPSYS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHCOMPSYS" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshcompsys \- zsh completion system
.\" Yodl file: Zsh/compsys.yo
diff --git a/Doc/zshcompwid.1 b/Doc/zshcompwid.1
index 54cc3ee72..22c1d086d 100644
--- a/Doc/zshcompwid.1
+++ b/Doc/zshcompwid.1
@@ -1,4 +1,4 @@
-.TH "ZSHCOMPWID" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHCOMPWID" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshcompwid \- zsh completion widgets
.\" Yodl file: Zsh/compwid.yo
diff --git a/Doc/zshcontrib.1 b/Doc/zshcontrib.1
index b6fb67bb6..573822d46 100644
--- a/Doc/zshcontrib.1
+++ b/Doc/zshcontrib.1
@@ -1,4 +1,4 @@
-.TH "ZSHCONTRIB" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHCONTRIB" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshcontrib \- user contributions to zsh
.\" Yodl file: Zsh/contrib.yo
@@ -41,7 +41,7 @@ distribution in your home directory, you would use the commands:
.RS
.nf
\fBmkdir ~/zsh_help
-perl ~/zsh\-5\&.8\&.1\&.2\-test/Util/helpfiles ~/zsh_help\fP
+perl ~/zsh\-5\&.8\&.1\&.3\-test/Util/helpfiles ~/zsh_help\fP
.fi
.RE
.PP
@@ -181,7 +181,7 @@ Run \fBzkbd\fP either as an autoloaded function, or as a shell script:
.PP
.RS
.nf
-\fBzsh \-f ~/zsh\-5\&.8\&.1\&.2\-test/Functions/Misc/zkbd\fP
+\fBzsh \-f ~/zsh\-5\&.8\&.1\&.3\-test/Functions/Misc/zkbd\fP
.fi
.RE
.PP
@@ -237,7 +237,7 @@ command and redirect the output into a file:
.PP
.RS
.nf
-\fB\&. ~/zsh\-5\&.8\&.1\&.2\-test/Util/reporter > zsh\&.report\fP
+\fB\&. ~/zsh\-5\&.8\&.1\&.3\-test/Util/reporter > zsh\&.report\fP
.fi
.RE
.PP
diff --git a/Doc/zshexpn.1 b/Doc/zshexpn.1
index 9ec445400..ccd132af4 100644
--- a/Doc/zshexpn.1
+++ b/Doc/zshexpn.1
@@ -1,4 +1,4 @@
-.TH "ZSHEXPN" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHEXPN" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshexpn \- zsh expansion and substitution
.\" Yodl file: Zsh/expn.yo
@@ -1639,7 +1639,7 @@ order\&.
.TP
\fB*\fP
Enable \fBEXTENDED_GLOB\fP for substitution via \fB${\fP\&.\&.\&.\fB/\fP\&.\&.\&.\fB}\fP or
-\fB${\fP\&.\&.\&.\fB//\fP\&.\&.\&.\fB}\fP\&.
+\fB${\fP\&.\&.\&.\fB//\fP\&.\&.\&.\fB}\fP\&. Note that `\fB**\fP\&' does not disable extendedglob\&.
.TP
\fBB\fP
Include the index of the beginning of the match in the result\&.
diff --git a/Doc/zshmisc.1 b/Doc/zshmisc.1
index e5396d1d8..dac720b87 100644
--- a/Doc/zshmisc.1
+++ b/Doc/zshmisc.1
@@ -1,4 +1,4 @@
-.TH "ZSHMISC" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHMISC" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshmisc \- everything and then some
.\" Yodl file: Zsh/grammar.yo
diff --git a/Doc/zshmodules.1 b/Doc/zshmodules.1
index dd3bb4c39..6c167fc8d 100644
--- a/Doc/zshmodules.1
+++ b/Doc/zshmodules.1
@@ -1,4 +1,4 @@
-.TH "ZSHMODULES" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHMODULES" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshmodules \- zsh loadable modules
.\" Yodl file: Zsh/modules.yo
diff --git a/Doc/zshoptions.1 b/Doc/zshoptions.1
index c85c877ee..e37a1315c 100644
--- a/Doc/zshoptions.1
+++ b/Doc/zshoptions.1
@@ -1,4 +1,4 @@
-.TH "ZSHOPTIONS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHOPTIONS" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshoptions \- zsh options
.\" Yodl file: Zsh/options.yo
diff --git a/Doc/zshparam.1 b/Doc/zshparam.1
index 8860fb8ac..fde15f575 100644
--- a/Doc/zshparam.1
+++ b/Doc/zshparam.1
@@ -1,4 +1,4 @@
-.TH "ZSHPARAM" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHPARAM" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshparam \- zsh parameters
.\" Yodl file: Zsh/params.yo
@@ -810,6 +810,11 @@ as set by the most recently failed system call\&.
This value is system dependent and is intended for debugging
purposes\&. It is also useful with the \fBzsh/system\fP module which
allows the number to be turned into a name or message\&.
+.RS
+.PP
+To use this parameter, it must first be assigned a value (typically
+0 (zero))\&. It is initially unset for scripting compatibility\&.
+.RE
.TP
\fBFUNCNEST\fP <S>
Integer\&. If greater than or equal to zero, the maximum nesting depth of
diff --git a/Doc/zshroadmap.1 b/Doc/zshroadmap.1
index 254c03bdd..fc04710a9 100644
--- a/Doc/zshroadmap.1
+++ b/Doc/zshroadmap.1
@@ -1,4 +1,4 @@
-.TH "ZSHROADMAP" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHROADMAP" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshroadmap \- informal introduction to the zsh manual
.\" Yodl file: Zsh/roadmap.yo
diff --git a/Doc/zshtcpsys.1 b/Doc/zshtcpsys.1
index 21ef50ee9..101f3fcd3 100644
--- a/Doc/zshtcpsys.1
+++ b/Doc/zshtcpsys.1
@@ -1,4 +1,4 @@
-.TH "ZSHTCPSYS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHTCPSYS" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshtcpsys \- zsh tcp system
.\" Yodl file: Zsh/tcpsys.yo
diff --git a/Doc/zshzftpsys.1 b/Doc/zshzftpsys.1
index 627d66564..782e4c0d7 100644
--- a/Doc/zshzftpsys.1
+++ b/Doc/zshzftpsys.1
@@ -1,4 +1,4 @@
-.TH "ZSHZFTPSYS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHZFTPSYS" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshzftpsys \- zftp function front\-end
.\" Yodl file: Zsh/zftpsys.yo
diff --git a/Doc/zshzle.1 b/Doc/zshzle.1
index c67d3fd34..f70a7d482 100644
--- a/Doc/zshzle.1
+++ b/Doc/zshzle.1
@@ -1,4 +1,4 @@
-.TH "ZSHZLE" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
+.TH "ZSHZLE" "1" "May 1, 2022" "zsh 5\&.8\&.1\&.3-test"
.SH "NAME"
zshzle \- zsh command line editor
.\" Yodl file: Zsh/zle.yo
diff --git a/Etc/BUGS b/Etc/BUGS
index 5624fb24d..72c313e88 100644
--- a/Etc/BUGS
+++ b/Etc/BUGS
@@ -23,18 +23,13 @@ the underlying VCS but not whether quilt is used.
Workaround: test (( ${+funcstack[(r)VCS_INFO_quilt]} )).
------------------------------------------------------------------------
41184: 'exec' optimization for last command in a subshell should be
-skipped when STTY=... is set for that command
+skipped when STTY=... is set for that command. This is complicated
+because the decision to (not) fork is made in execcmd_exec() before
+the prefix parameter assignments are examined in execute().
------------------------------------------------------------------------
41203 and others: Make it easier to maintain C modules out of tree.
(May require defining a stable API for modules, see 41254)
------------------------------------------------------------------------
-42609: :|: =(hang)
-------------------------------------------------------------------------
-44007 - Martijn - exit in trap executes rest of function
-See test case in Test/C03traps.ztst.
-------------------------------------------------------------------------
-44133 debian #924736 (partial patch in 44134) three setopts following ` #`
-------------------------------------------------------------------------
44850 terminal issues with continuation markers
------------------------------------------------------------------------
users/24765 -direct terminals. Not a bug as such but we may need to do
@@ -49,17 +44,9 @@ interactive and the subshell is the foreground job. The USEZLE option is
always turned off in subshells, for reasons lost to history. There is a
related, probably obsolete, vared special case for $TERM set to "emacs".
------------------------------------------------------------------------
-users/26150: MULTIOS does not work with "exec":
-
-exec 3>/tmp/test1 3>/tmp/test2
-
-causes a script to hang.
-------------------------------------------------------------------------
47561: [PATCH v4] vcs_info: choose backend by basedir
------------------------------------------------------------------------
-39319: () { exit } =(:) doesn't clean up the tempfile
-------------------------------------------------------------------------
48091: Bug in compdescribe with matcher 'b:-=+'
------------------------------------------------------------------------
-users/26071: Strange behavior about option completion of `git push
+users/26071: Strange behavior about option completion of "git push --f"
------------------------------------------------------------------------
diff --git a/Etc/creating-a-release.txt b/Etc/creating-a-release.txt
index 640d19d39..80fe2b301 100644
--- a/Etc/creating-a-release.txt
+++ b/Etc/creating-a-release.txt
@@ -153,7 +153,8 @@ To create a zsh release:
You may need assistance from another dev if you don't have access to do this.
-- Post to -workers@
+- Post to -workers@. You may also wish to (ask someone to) update the #zsh
+ channel topic on IRC.
- After a day or so post to:
diff --git a/NEWS b/NEWS
index b762ad4a2..d7a817c1e 100644
--- a/NEWS
+++ b/NEWS
@@ -7,8 +7,8 @@ Note also the list of incompatibilities in the README file.
Changes since 5.8.1
-------------------
-zsh 5.9 is dedicated in memory of Sven Guckes, who was, amongst other
-things, a long-time zsh advocate.
+zsh 5.9 is dedicated to the memory of Sven Guckes, who was, amongst other
+things, a long-time zsh advocate. For more information, see:
https://linuxnews.de/2022/02/sven-guckes-verstorben/
https://groups.google.com/g/vim_announce/c/MJBKVd-xrEE/m/joVNaDgAAgAJ
@@ -46,6 +46,12 @@ of CLOBBER for empty files only. It is disabled by default.
A (-) expansion flag was added. It works like (n) but correctly sorts
negative numbers.
+The (*) expansion flag enables EXTENDED_GLOB for pattern matching.
+For example, ${(*)sample/(#b)*(pat)*/${match[1]}} uses backreferences
+even if EXTENDED_GLOB is not otherwise set. However, this does not
+descend into nested exapansions, and doubling as (**) does not disable
+EXTENDED_GLOB.
+
The compinit function learnt a -w option to explain why compdump runs.
When run without the -i or -u options and compaudit discovers security
issues, answering "y" to the "Ignore insecure ..." prompt removes the
diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c
index 7c736072b..0df9b35b7 100644
--- a/Src/Modules/stat.c
+++ b/Src/Modules/stat.c
@@ -503,8 +503,10 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func))
if (OPT_ISSET(ops,'f'))
nargs = 1;
else
- for (aptr = args; *aptr; aptr++)
+ for (aptr = args; *aptr; aptr++) {
+ unmetafy(*aptr, NULL);
nargs++;
+ }
if (OPT_ISSET(ops,'g')) {
flags |= STF_GMT;
@@ -555,8 +557,8 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func))
for (; OPT_ISSET(ops,'f') || *args; args++) {
char outbuf[PATH_MAX + 9]; /* "link " + link name + NULL */
int rval = OPT_ISSET(ops,'f') ? fstat(fd, &statbuf) :
- OPT_ISSET(ops,'L') ? lstat(unmeta(*args), &statbuf) :
- stat(unmeta(*args), &statbuf);
+ OPT_ISSET(ops,'L') ? lstat(*args, &statbuf) :
+ stat(*args, &statbuf);
if (rval) {
if (OPT_ISSET(ops,'f'))
sprintf(outbuf, "%d", fd);
@@ -571,10 +573,10 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func))
if (flags & STF_FILE) {
if (arrnam)
- *arrptr++ = ztrdup(*args);
+ *arrptr++ = ztrdup_metafy(*args);
else if (hashnam) {
*hashptr++ = ztrdup(HNAMEKEY);
- *hashptr++ = ztrdup(*args);
+ *hashptr++ = ztrdup_metafy(*args);
} else
printf("%s%s", *args, (flags & STF_PICK) ? " " : ":\n");
}
diff --git a/Src/Modules/system.c b/Src/Modules/system.c
index 71745548f..ea11ef037 100644
--- a/Src/Modules/system.c
+++ b/Src/Modules/system.c
@@ -83,10 +83,6 @@ bin_sysread(char *nam, char **args, Options ops, UNUSED(int func))
/* -o: output file descriptor, else store in REPLY */
if (OPT_ISSET(ops, 'o')) {
- if (*args) {
- zwarnnam(nam, "no argument allowed with -o");
- return 1;
- }
outfd = getposint(OPT_ARG(ops, 'o'), nam);
if (outfd < 0)
return 1;
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index fe3ea10fc..4ac5d089f 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -3314,7 +3314,7 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
if (del) {
int n_orig = n;
for (bp = rp, ap = rp; bp < rp + n_orig; ap++, bp++) {
- while (bp[0]->flags & CMF_DELETE) {
+ while (bp < rp + n_orig && (bp[0]->flags & CMF_DELETE)) {
bp++;
n--;
}
diff --git a/Src/builtin.c b/Src/builtin.c
index 8ef678b22..1cef7cce8 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5720,6 +5720,8 @@ bin_break(char *name, char **argv, UNUSED(Options ops), int func)
* a bad job.
*/
if (stopmsg || (zexit(0, ZEXIT_DEFERRED), !stopmsg)) {
+ if (trap_state)
+ trap_state = TRAP_STATE_FORCE_RETURN;
retflag = 1;
breaks = loops;
exit_pending = 1;
@@ -5858,6 +5860,7 @@ zexit(int val, enum zexit_t from_where)
/* send SIGHUP to any jobs left running */
killrunjobs(from_where == ZEXIT_SIGNAL);
}
+ cleanfilelists();
if (isset(RCS) && interact) {
if (!nohistsave) {
int writeflags = HFILE_USE_OPTIONS;
diff --git a/Src/exec.c b/Src/exec.c
index 27d49e005..f2911807c 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -561,7 +561,7 @@ zexecve(char *pth, char **argv, char **newenvp)
isbinary = 1;
hasletter = 0;
for (ptr = execvebuf; ptr < ptr2; ptr++) {
- if (islower(*ptr) || *ptr == '$' || *ptr == '`')
+ if (islower(STOUC(*ptr)) || *ptr == '$' || *ptr == '`')
hasletter = 1;
if (hasletter && *ptr == '\n') {
isbinary = 0;
@@ -3898,6 +3898,10 @@ execcmd_exec(Estate state, Execcmd_params eparams,
for (i = 0; i < 10; i++)
if (save[i] != -2)
zclose(save[i]);
+ /*
+ * We're done with this job, no need to wait for it.
+ */
+ jobtab[thisjob].stat |= STAT_DONE;
goto done;
}
if (isset(XTRACE)) {
@@ -4879,13 +4883,9 @@ getoutputfile(char *cmd, char **eptr)
child_unblock();
return nam;
} else if (pid) {
- int os;
-
close(fd);
- os = jobtab[thisjob].stat;
waitforpid(pid, 0);
cmdoutval = 0;
- jobtab[thisjob].stat = os;
return nam;
}
diff --git a/Src/hist.c b/Src/hist.c
index f9440dba7..bff0abe61 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2254,10 +2254,10 @@ casemodify(char *str, int how)
int c;
int mod = 0;
if (*str == Meta) {
- c = str[1] ^ 32;
+ c = STOUC(str[1] ^ 32);
str += 2;
} else
- c = *str++;
+ c = STOUC(*str++);
switch (how) {
case CASMOD_LOWER:
if (isupper(c)) {
diff --git a/Src/input.c b/Src/input.c
index c59232681..9898a7177 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -217,12 +217,34 @@ shinbufrestore(void)
static int
shingetchar(void)
{
- int nread;
+ int nread, rsize = isset(SHINSTDIN) ? 1 : SHINBUFSIZE;
if (shinbufptr < shinbufendptr)
return STOUC(*shinbufptr++);
shinbufreset();
+#ifdef USE_LSEEK
+ if (rsize == 1 && lseek(SHIN, 0, SEEK_CUR) != (off_t)-1)
+ rsize = SHINBUFSIZE;
+ if (rsize > 1) {
+ do {
+ errno = 0;
+ nread = read(SHIN, shinbuffer, rsize);
+ } while (nread < 0 && errno == EINTR);
+ if (nread <= 0)
+ return -1;
+ if (isset(SHINSTDIN) &&
+ (shinbufendptr = memchr(shinbuffer, '\n', nread))) {
+ shinbufendptr++;
+ rsize = (shinbufendptr - shinbuffer);
+ if (nread > rsize &&
+ lseek(SHIN, -(nread - rsize), SEEK_CUR) < 0)
+ zerr("lseek(%d, %d): %e", SHIN, -(nread - rsize), errno);
+ } else
+ shinbufendptr = shinbuffer + nread;
+ return STOUC(*shinbufptr++);
+ }
+#endif
for (;;) {
errno = 0;
nread = read(SHIN, shinbufendptr, 1);
diff --git a/Src/jobs.c b/Src/jobs.c
index af0a1233d..a91ef787f 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1368,6 +1368,18 @@ deletefilelist(LinkList file_list, int disowning)
/**/
void
+cleanfilelists(void)
+{
+ int i;
+
+ DPUTS(shell_exiting >= 0, "BUG: cleanfilelists() before exit");
+
+ for (i = 1; i <= maxjob; i++)
+ deletefilelist(jobtab[i].filelist, 0);
+}
+
+/**/
+void
freejob(Job jn, int deleting)
{
struct process *pn, *nx;
@@ -1476,7 +1488,10 @@ addproc(pid_t pid, char *text, int aux, struct timeval *bgtime,
* set it for that, too.
*/
if (gleader != -1) {
- jobtab[thisjob].gleader = gleader;
+ if (jobtab[thisjob].stat & STAT_CURSH)
+ jobtab[thisjob].gleader = gleader;
+ else
+ jobtab[thisjob].gleader = pid;
if (list_pipe_job_used != -1)
jobtab[list_pipe_job_used].gleader = gleader;
/*
diff --git a/Src/params.c b/Src/params.c
index 970a207e4..27ea82298 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -4594,6 +4594,19 @@ static struct localename {
{NULL, 0}
};
+/* On some systems (at least on NetBSD-9), when LC_CTYPE changes,
+ * global variables (type mbstate_t) used by mbrtowc() etc. need be
+ * reset by clear_mbstate() */
+
+/**/
+static void
+clear_mbstate(void) {
+#ifdef MULTIBYTE_SUPPORT
+ mb_charinit(); /* utils.c */
+ clear_shiftstate(); /* pattern.c */
+#endif
+}
+
/**/
static void
setlang(char *x)
@@ -4616,6 +4629,7 @@ setlang(char *x)
* that case.
*/
setlocale(LC_ALL, x ? unmeta(x) : "");
+ clear_mbstate();
queue_signals();
for (ln = lc_names; ln->name; ln++)
if ((x = getsparam_u(ln->name)) && *x)
@@ -4641,8 +4655,10 @@ lc_allsetfn(Param pm, char *x)
unqueue_signals();
}
}
- else
+ else {
setlocale(LC_ALL, unmeta(x));
+ clear_mbstate();
+ }
}
/**/
@@ -4679,6 +4695,7 @@ lcsetfn(Param pm, char *x)
setlocale(ln->category, unmeta(x));
}
unqueue_signals();
+ clear_mbstate(); /* LC_CTYPE may have changed */
}
#endif /* USE_LOCALE */
@@ -5627,6 +5644,7 @@ endparamscope(void)
setlocale(ln->category, val);
}
}
+ clear_mbstate(); /* LC_CTYPE may have changed */
}
#endif /* USE_LOCALE */
unqueue_signals();
diff --git a/Src/patchlevel.h.release b/Src/patchlevel.h.release
index 05403a9e4..b95d69ac2 100644
--- a/Src/patchlevel.h.release
+++ b/Src/patchlevel.h.release
@@ -1 +1 @@
-#define ZSH_PATCHLEVEL "zsh-5.8.1.2-test-0-g6e55c92"
+#define ZSH_PATCHLEVEL "zsh-5.8.1.3-test-0-g3210020"
diff --git a/Src/pattern.c b/Src/pattern.c
index c0e31b78e..e947d1216 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -320,6 +320,14 @@ typedef wint_t patint_t;
*/
static mbstate_t shiftstate;
+/* See clear_mbstate() in params.c for the use of clear_shiftstate() */
+
+/**/
+mod_export void
+clear_shiftstate(void) {
+ memset(&shiftstate, 0, sizeof(shiftstate));
+}
+
/*
* Multibyte version: it's (almost) as easy to return the
* value as not, so do so since we sometimes need it..
@@ -1999,6 +2007,8 @@ charsub(char *x, char *y)
if (ret == MB_INVALID || ret == MB_INCOMPLETE) {
/* Error. Treat remainder as single characters */
+ /* Reset the shift state for next time. */
+ memset(&shiftstate, 0, sizeof(shiftstate));
return res + (y - x);
}
diff --git a/Src/prompt.c b/Src/prompt.c
index 738c7fc7a..092de63a4 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -1666,7 +1666,7 @@ match_colour(const char **teststrp, int is_fg, int colour)
tc = TCBGCOLOUR;
}
if (teststrp) {
- if (**teststrp == '#' && isxdigit((*teststrp)[1])) {
+ if (**teststrp == '#' && isxdigit(STOUC((*teststrp)[1]))) {
struct color_rgb color;
char *end;
zlong col = zstrtol(*teststrp+1, &end, 16);
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index 6f84e5db2..f120809a7 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -901,7 +901,7 @@ F:Must be tested with a top-level script rather than source or function
fn trap1 trap2
echo out2
'
--f:(workers/44007) function execution continues after 'exit' in trap
+0:'exit' in trap causes calling function to return
>out1
>fn1
>trap1
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 72891a2a7..850a535e5 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -748,13 +748,21 @@
touch glob.tmp/secret-d$1/dir/file
chmod $1 glob.tmp/secret-d$1
done
- print -raC 2 -- glob.tmp/secret-*/* glob.tmp/secret-*/file
+ if (( EUID == 0 )); then
+ ZTST_skip='Not testing unreadable directories (root reads anything)'
+ else
+ print -raC 2 -- glob.tmp/secret-*/* glob.tmp/secret-*/file
+ fi
0:names inside unreadable directories can be globbed if searchable
>glob.tmp/secret-d444/dir glob.tmp/secret-d444/file
>glob.tmp/secret-s444/dir glob.tmp/secret-s444/file
>glob.tmp/secret-d111/file glob.tmp/secret-s111/file
- print -rC 2 -- glob.tmp/secret-*/dir/*
+ if (( EUID == 0 )); then
+ ZTST_skip='Not testing unreadable directories (root reads anything)'
+ else
+ print -rC 2 -- glob.tmp/secret-*/dir/*
+ fi
0:glob files in readable directories inside unreadable directories
>glob.tmp/secret-d111/dir/file glob.tmp/secret-s111/dir/file
diff --git a/Test/E03posix.ztst b/Test/E03posix.ztst
index caab97ab6..6ac4d1732 100644
--- a/Test/E03posix.ztst
+++ b/Test/E03posix.ztst
@@ -153,7 +153,7 @@ F:This may also need to apply to multibyte whitespace
F:POSIX has neither math functions nor floating point
>42
- ARGV0=sh $ZTST_testdir/../Src/zsh -c 'EUID=10; echo "$EUID"'
+ ARGV0=sh $ZTST_testdir/../Src/zsh -c 'EUID=1; EUID=10; echo $EUID'
-f:EUID is not a special variable
>10
diff --git a/Test/P01privileged.ztst b/Test/P01privileged.ztst
index 7c4a1be35..5d45c1a4c 100644
--- a/Test/P01privileged.ztst
+++ b/Test/P01privileged.ztst
@@ -26,23 +26,23 @@
%prep
- # Mind your empty lines here. The logic in this %prep section is somewhat
- # complex compared to most others; to avoid lots of nested/duplicated
- # conditions we need to make sure that this all gets executed as a single
- # function from which we can return early
+ # If ZTST_unimplemented is set to non-null in a chunk then all the
+ # remaining chunks (and all of %test and %clean sections) will be skipped.
[[ $EUID == 0 || -n $ZSH_TEST_UNPRIVILEGED_UID$ZSH_TEST_UNPRIVILEGED_GID ]] || {
ZTST_unimplemented='PRIVILEGED tests require super-user privileges (or env var)'
- return 1
+ return 0
}
+
(( $+commands[perl] )) || { # @todo Eliminate this dependency with a C wrapper?
ZTST_unimplemented='PRIVILEGED tests require Perl'
- return 1
+ return 0
}
+
grep -qE '#define HAVE_SETRES?UID' $ZTST_testdir/../config.h || {
ZTST_unimplemented='PRIVILEGED tests require setreuid()/setresuid()'
- return 1
+ return 0
}
- #
+
ruid= euid= rgid= egid=
#
if [[ -n $ZSH_TEST_UNPRIVILEGED_UID ]]; then
@@ -76,13 +76,14 @@
#
[[ -n $ruid && -n $euid ]] || {
ZTST_unimplemented='PRIVILEGED tests require unprivileged UID:EUID'
- return 1
+ return 0
}
+
[[ -n $rgid || -n $egid ]] || {
ZTST_unimplemented='PRIVILEGED tests require unprivileged GID:EGID'
- return 1
+ return 0
}
- #
+
print -ru$ZTST_fd \
"Using unprivileged UID $ruid, EUID $euid, GID $rgid, EGID $egid"
#
diff --git a/Test/README b/Test/README
index 726d68e72..670434ac3 100644
--- a/Test/README
+++ b/Test/README
@@ -20,6 +20,13 @@ more information about the tests being performed with
ZTST_verbose=1 make check
(`test' is equivalent to `check') or change 1 to 2 for even more detail.
+A test file is usually aborted on the first error. To continue to the
+end, run with
+ ZTST_continue=1 make check
+This can usefully be combined with ZTST_verbose. The test is always
+aborted on a syntax error as in that case it is not obvoius how to
+continue.
+
Individual or groups of tests can be performed with
make TESTNUM=C02 check
or
diff --git a/Test/V14system.ztst b/Test/V14system.ztst
index 100daab08..ffdb730a4 100644
--- a/Test/V14system.ztst
+++ b/Test/V14system.ztst
@@ -5,10 +5,10 @@
if zmodload -s zsh/system && zmodload -s zsh/zselect; then
tst_dir=V14.tmp
mkdir -p -- $tst_dir
+ : > $tst_dir/file # File on which to acquire flock.
else
ZTST_unimplemented='the zsh/system and zsh/zselect modules are not available'
fi
- : > $tst_dir/file # File on which to acquire flock.
%test
diff --git a/Test/X03zlebindkey.ztst b/Test/X03zlebindkey.ztst
index 3e299a337..43692a85b 100644
--- a/Test/X03zlebindkey.ztst
+++ b/Test/X03zlebindkey.ztst
@@ -3,6 +3,7 @@
# into bindings. The latter is particularly tricky with multibyte sequences.
%prep
+ unset -m LC_\*
ZSH_TEST_LANG=
langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
$(locale -a 2>/dev/null | egrep 'utf8|UTF-8'))
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index 89fe69b5b..aca275c1c 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -17,6 +17,9 @@
# Defined in such a way that any value from the environment is used.
: ${ZTST_verbose:=0}
+# If non-zero, continue the tests even after a test fails.
+: ${ZTST_continue:=0}
+
# We require all options to be reset, not just emulation options.
# Unfortunately, due to the crud which may be in /etc/zshenv this might
# still not be good enough. Maybe we should trick it somehow.
@@ -30,6 +33,9 @@ emulate -R zsh
[[ -n $LC_NUMERIC ]] && LC_NUMERIC=C
[[ -n $LC_MESSAGES ]] && LC_MESSAGES=C
[[ -n $LANG ]] && LANG=C
+# Test file may (or may not) set LANG to other locales. In either case,
+# LANG must be passed to child zsh.
+export LANG
# Don't propagate variables that are set by default in the shell.
typeset +x WORDCHARS
@@ -143,6 +149,10 @@ ZTST_testfailed() {
$ZTST_failmsg"
fi
ZTST_testfailed=1
+ # if called from within ZTST_Test() this will increment ZTST_Test's local
+ # ZTST_failures. Otherwise global ZTST_failures will be incremented
+ # (but currently its value is not used).
+ (( ++ZTST_failures ))
return 1
}
ZTST_testxpassed() {
@@ -156,6 +166,7 @@ ZTST_testxpassed() {
$ZTST_failmsg"
fi
ZTST_testfailed=1
+ (( ++ZTST_failures ))
return 1
}
@@ -291,16 +302,18 @@ ZTST_execchunk() {
}
# Functions for preparation and cleaning.
-# When cleaning up (non-zero string argument), we ignore status.
-ZTST_prepclean() {
- # Execute indented code chunks.
- while ZTST_getchunk; do
- ZTST_execchunk >/dev/null || [[ -n $1 ]] || {
- [[ -n "$ZTST_unimplemented" ]] ||
+ZTST_prep ZTST_clean () {
+ # Execute indented code chunks. If ZTST_unimplemented is set
+ # in any chunk then we will skip the remaining chunks.
+ # We ignore return status of chunks when cleaning up.
+ while [[ -z "$ZTST_unimplemented" ]] && ZTST_getchunk; do
+ ZTST_execchunk >/dev/null || [[ $0 = ZTST_clean ]] || {
ZTST_testfailed "non-zero status from preparation code:
-$ZTST_code" && return 0
+$ZTST_code"
+ return 1
}
done
+ return 0
}
# diff wrapper
@@ -373,12 +386,12 @@ ZTST_diff() {
return "$diff_ret"
}
-
+
ZTST_test() {
local last match mbegin mend found substlines
local diff_out diff_err
local ZTST_skip
- integer expected_to_fail
+ integer expected_to_fail ZTST_failures
while true; do
rm -f $ZTST_in $ZTST_out $ZTST_err
@@ -492,7 +505,7 @@ $ZTST_curline"
$ZTST_code${$(<$ZTST_terr):+
Error output:
$(<$ZTST_terr)}"
- return 1
+ if (( ZTST_continue ));then continue; else return 1; fi
fi
ZTST_verbose 2 "ZTST_test: test produced standard output:
@@ -515,7 +528,7 @@ $(<$ZTST_terr)"
$ZTST_code${$(<$ZTST_terr):+
Error output:
$(<$ZTST_terr)}"
- return 1
+ if (( ZTST_continue ));then continue; else return 1; fi
fi
if [[ $ZTST_flags = *q* && -s $ZTST_err ]]; then
substlines="$(<$ZTST_err)"
@@ -529,21 +542,27 @@ $(<$ZTST_terr)}"
fi
ZTST_testfailed "error output differs from expected as shown above for:
$ZTST_code"
- return 1
+ if (( ZTST_continue ));then continue; else return 1; fi
fi
if (( expected_to_fail )); then
ZTST_testxpassed
- return 1
+ if (( ZTST_continue ));then continue; else return 1; fi
fi
fi
ZTST_verbose 1 "Test successful."
[[ -n $last ]] && break
done
- ZTST_verbose 2 "ZTST_test: all tests successful"
+ if (( ZTST_failures )); then
+ ZTST_verbose 1 "ZTST_test: $ZTST_failures test(s) failed"
+ else
+ ZTST_verbose 2 "ZTST_test: all tests successful"
+ fi
# reset message to keep ZTST_testfailed output correct
ZTST_message=''
+
+ return ZTST_failures
}
@@ -563,27 +582,29 @@ while [[ -z "$ZTST_unimplemented" ]] && ZTST_getsect $ZTST_skipok; do
(prep) if (( ${ZTST_sects[prep]} + ${ZTST_sects[test]} + \
${ZTST_sects[clean]} )); then
ZTST_testfailed "\`prep' section must come first"
- exit 1
+ break # skip %test and %clean sections, but run ZTST_cleanup
fi
- ZTST_prepclean
+ ZTST_prep || ZTST_skipok=1
ZTST_sects[prep]=1
;;
(test)
if (( ${ZTST_sects[test]} + ${ZTST_sects[clean]} )); then
ZTST_testfailed "bad placement of \`test' section"
- exit 1
+ break # skip %clean section, but run ZTST_cleanup
fi
- # careful here: we can't execute ZTST_test before || or &&
- # because that affects the behaviour of traps in the tests.
- ZTST_test
- (( $? )) && ZTST_skipok=1
+ if [[ -z "$ZTST_skipok" ]]; then # if no error in %prep
+ # careful here: we can't execute ZTST_test before || or &&
+ # because that affects the behaviour of traps in the tests.
+ ZTST_test
+ (( $? )) && ZTST_skipok=1
+ fi
ZTST_sects[test]=1
;;
(clean)
if (( ${ZTST_sects[test]} == 0 || ${ZTST_sects[clean]} )); then
ZTST_testfailed "bad use of \`clean' section"
else
- ZTST_prepclean 1
+ ZTST_clean
ZTST_sects[clean]=1
fi
ZTST_skipok=
diff --git a/config.h.in b/config.h.in
index 9651ec202..2fb5f0327 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1159,6 +1159,9 @@
/* Define to 1 if h_errno is not defined by the system. */
#undef USE_LOCAL_H_ERRNO
+/* Define to 1 if lseek() can be used for SHIN. */
+#undef USE_LSEEK
+
/* Define to 1 if you want to allocate stack memory e.g. with `alloca'. */
#undef USE_STACK_ALLOCATION
diff --git a/configure b/configure
index 992313a85..745339a8e 100755
--- a/configure
+++ b/configure
@@ -13243,6 +13243,86 @@ if test x$zsh_cv_sys_fifo = xyes; then
fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if lseek() correctly reports seekability" >&5
+printf %s "checking if lseek() correctly reports seekability... " >&6; }
+if test ${zsh_cv_sys_lseek+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if test "$cross_compiling" = yes
+then :
+ zsh_cv_sys_lseek=yes
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+int main() {
+ int pipefd[2], fd;
+ off_t ret;
+ char* tmpfile = "seekfiletest.tmp";
+ if ((fd = open(tmpfile, O_CREAT, S_IRUSR)) < 0) {
+ fprintf(stderr, "creating file failed\n");
+ return 1;
+ }
+ ret = lseek(fd, 0, SEEK_CUR);
+ close(fd);
+ unlink(tmpfile);
+ if (ret == (off_t)-1) {
+ fprintf(stderr, "lseek on regular file failed\n");
+ return 1;
+ }
+ if (pipe(pipefd) < 0) {
+ fprintf(stderr, "creating pipe failed\n");
+ return 1;
+ }
+ write(pipefd[1], "abcdefgh", 8);
+ ret = lseek(pipefd[0], 0, SEEK_CUR);
+ close(pipefd[0]);
+ close(pipefd[1]);
+ if (ret != (off_t)-1) {
+ fprintf(stderr, "lseek on pipe succeeded\n");
+ return 1;
+ }
+ if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
+ fprintf(stderr, "creating UNIX domain socket failed\n");
+ return 1;
+ }
+ ret = lseek(fd, 0, SEEK_CUR);
+ close(fd);
+ if (ret != (off_t)-1) {
+ fprintf(stderr, "lseek on UNIX domain socket succeeded\n");
+ return 1;
+ }
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"
+then :
+ zsh_cv_sys_lseek=yes
+else $as_nop
+ zsh_cv_sys_lseek=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $zsh_cv_sys_lseek" >&5
+printf "%s\n" "$zsh_cv_sys_lseek" >&6; }
+
+if test x$zsh_cv_sys_lseek = xyes; then
+ printf "%s\n" "#define USE_LSEEK 1" >>confdefs.h
+
+fi
+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if link() works" >&5
printf %s "checking if link() works... " >&6; }
if test ${zsh_cv_sys_link+y}
diff --git a/configure.ac b/configure.ac
index 8bba78c56..c72148d06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2210,6 +2210,65 @@ if test x$zsh_cv_sys_fifo = xyes; then
fi
dnl -----------
+dnl check that lseek() correctly reports seekability.
+dnl -----------
+AC_CACHE_CHECK(if lseek() correctly reports seekability,
+zsh_cv_sys_lseek,
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+int main() {
+ int pipefd[2], fd;
+ off_t ret;
+ char* tmpfile = "seekfiletest.tmp";
+ if ((fd = open(tmpfile, O_CREAT, S_IRUSR)) < 0) {
+ fprintf(stderr, "creating file failed\n");
+ return 1;
+ }
+ ret = lseek(fd, 0, SEEK_CUR);
+ close(fd);
+ unlink(tmpfile);
+ if (ret == (off_t)-1) {
+ fprintf(stderr, "lseek on regular file failed\n");
+ return 1;
+ }
+ if (pipe(pipefd) < 0) {
+ fprintf(stderr, "creating pipe failed\n");
+ return 1;
+ }
+ write(pipefd[1], "abcdefgh", 8);
+ ret = lseek(pipefd[0], 0, SEEK_CUR);
+ close(pipefd[0]);
+ close(pipefd[1]);
+ if (ret != (off_t)-1) {
+ fprintf(stderr, "lseek on pipe succeeded\n");
+ return 1;
+ }
+ if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
+ fprintf(stderr, "creating UNIX domain socket failed\n");
+ return 1;
+ }
+ ret = lseek(fd, 0, SEEK_CUR);
+ close(fd);
+ if (ret != (off_t)-1) {
+ fprintf(stderr, "lseek on UNIX domain socket succeeded\n");
+ return 1;
+ }
+ return 0;
+}
+]])],[zsh_cv_sys_lseek=yes],[zsh_cv_sys_lseek=no],[zsh_cv_sys_lseek=yes])
+])
+AH_TEMPLATE([USE_LSEEK],
+[Define to 1 if lseek() can be used for SHIN.])
+if test x$zsh_cv_sys_lseek = xyes; then
+ AC_DEFINE(USE_LSEEK)
+fi
+
+dnl -----------
dnl test for whether link() works
dnl for instance, BeOS R4.51 doesn't support hard links yet
dnl -----------