Accepting request 212246 from shells

- Update to version 5.0.4
  * Small bugfix release
- Add zsh-pipefix.patch to import pipe fixes from zsh.git
- Remove upstream patches
  * zsh-osc-suseversion.patch
  * zsh-zypper-completion.patch

OBS-URL: https://build.opensuse.org/request/show/212246
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/zsh?expand=0&rev=53
This commit is contained in:
Stephan Kulow 2013-12-26 16:42:43 +00:00 committed by Git OBS Bridge
commit cacb94037b
7 changed files with 178 additions and 61 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eb220ae5a8076191ec6b4c6a5a2f18122d074a19f25b45f0320b44b8166c5a03
size 3025767

3
zsh-5.0.4.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e96fe7c9440adb4169fd4b2f0d9a5c8bdf1498423bc2efd2c3205ef7c1de4ee8
size 3093541

View File

@ -1,15 +0,0 @@
Index: zsh/Completion/openSUSE/Command/_osc
===================================================================
--- zsh.orig/Completion/openSUSE/Command/_osc
+++ zsh/Completion/openSUSE/Command/_osc
@@ -16,8 +16,8 @@
# version 0.2
#
-OSC_BUILD_TARGETS="openSUSE_11.2 openSUSE_11.3 openSUSE_11.4 openSUSE_12.1 openSUSE_Tumbleweed openSUSE_Factory SLE_11_SP1"
-OSC_PROJECTS="openSUSE:Factory openSUSE:Tumbleweed openSUSE:12.1 openSUSE:11.4 openSUSE:11.2 openSUSE:11.3"
+OSC_BUILD_TARGETS="openSUSE_12.1 openSUSE_12.2 openSUSE_12.3 openSUSE_Tumbleweed openSUSE_Factory SLE_11_SP2"
+OSC_PROJECTS="openSUSE:Factory openSUSE:Tumbleweed openSUSE:12.3 openSUSE:12.2 openSUSE:12.1"
# user defined variables $OSC_BUILD_TARGETS_EXTRA and
# $OSC_PROJECTS_EXTRA can add to the project/build target list

159
zsh-pipefix.patch Normal file
View File

@ -0,0 +1,159 @@
diff --git a/Src/exec.c b/Src/exec.c
index dccdc2b..4480033 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1691,6 +1691,7 @@ execpline2(Estate state, wordcode pcode,
execcmd(state, input, output, how, last1 ? 1 : 2);
else {
int old_list_pipe = list_pipe;
+ int subsh_close = -1;
Wordcode next = state->pc + (*state->pc), pc;
wordcode code;
@@ -1738,6 +1739,7 @@ execpline2(Estate state, wordcode pcode,
} else {
/* otherwise just do the pipeline normally. */
addfilelist(NULL, pipes[0]);
+ subsh_close = pipes[0];
execcmd(state, input, pipes[1], how, 0);
}
zclose(pipes[1]);
@@ -1750,6 +1752,8 @@ execpline2(Estate state, wordcode pcode,
execpline2(state, *state->pc++, how, pipes[0], output, last1);
list_pipe = old_list_pipe;
cmdpop();
+ if (subsh_close != pipes[0])
+ zclose(pipes[0]);
}
}
diff --git a/Test/A05execution.ztst b/Test/A05execution.ztst
index c8320a1..61d24fe 100644
--- a/Test/A05execution.ztst
+++ b/Test/A05execution.ztst
@@ -202,3 +202,15 @@ F:the bug is still there or it reappeared. See workers-29973 for details.
0:Check $pipestatus with a known difficult case
>1 0 1 0 0
F:This similar test was triggering a reproducible failure with pipestatus.
+
+ { unsetopt MONITOR } 2>/dev/null
+ coproc { read -Et 5 || kill -INT $$ }
+ print -u $ZTST_fd 'This test takes 5 seconds to fail...'
+ { printf "%d\n" {1..20000} } | ( read -E )
+ print -p done
+ read -Ep
+0:Bug regression: piping a shell construct to an external process may hang
+>1
+>done
+F:This test checks for a file descriptor leak that could cause the left
+F:side of a pipe to block on write after the right side has exited
diff --git a/Src/exec.c b/Src/exec.c
index 4480033..f16cfd3 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2389,7 +2389,7 @@ static void
execcmd(Estate state, int input, int output, int how, int last1)
{
HashNode hn = NULL;
- LinkList args;
+ LinkList args, filelist = NULL;
LinkNode node;
Redir fn;
struct multio *mfds[10];
@@ -2911,6 +2911,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
flags |= ESUB_KEEPTRAP;
if (type == WC_SUBSH && !(how & Z_ASYNC))
flags |= ESUB_JOB_CONTROL;
+ filelist = jobtab[thisjob].filelist;
entersubsh(flags);
close(synch[1]);
forked = 1;
@@ -3264,6 +3265,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
if (is_shfunc) {
/* It's a shell function */
+ pipecleanfilelist(filelist);
execshfunc((Shfunc) hn, args);
} else {
/* It's a builtin */
@@ -3342,6 +3344,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
DPUTS(varspc,
"BUG: assignment before complex command");
list_pipe = 0;
+ pipecleanfilelist(filelist);
/* If we're forked (and we should be), no need to return */
DPUTS(last1 != 1 && !forked, "BUG: not exiting?");
DPUTS(type != WC_SUBSH, "Not sure what we're doing.");
diff --git a/Src/jobs.c b/Src/jobs.c
index 371b8eb..a321172 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1173,6 +1173,30 @@ addfilelist(const char *name, int fd)
zaddlinknode(ll, jf);
}
+/* Clean up pipes no longer needed associated with a job */
+
+/**/
+void
+pipecleanfilelist(LinkList filelist)
+{
+ LinkNode node;
+
+ if (!filelist)
+ return;
+ node = firstnode(filelist);
+ while (node) {
+ Jobfile jf = (Jobfile)getdata(node);
+ if (jf->is_fd) {
+ LinkNode next = nextnode(node);
+ zclose(jf->u.fd);
+ (void)remnode(filelist, node);
+ zfree(jf, sizeof(*jf));
+ node = next;
+ } else
+ incnode(node);
+ }
+}
+
/* Finished with list of files for a job */
/**/
@@ -1415,19 +1439,7 @@ zwaitjob(int job, int wait_cmd)
* we can't deadlock on the fact that those still exist, so
* that's not a problem.
*/
- LinkNode node = firstnode(jn->filelist);
- while (node) {
- Jobfile jf = (Jobfile)getdata(node);
- if (jf->is_fd) {
- LinkNode next = nextnode(node);
- (void)remnode(jn->filelist, node);
- zclose(jf->u.fd);
- zfree(jf, sizeof(*jf));
- node = next;
- } else {
- incnode(node);
- }
- }
+ pipecleanfilelist(jn->filelist);
}
while (!errflag && jn->stat &&
!(jn->stat & STAT_DONE) &&
diff --git a/Test/A05execution.ztst b/Test/A05execution.ztst
index 61d24fe..6abfd8b 100644
--- a/Test/A05execution.ztst
+++ b/Test/A05execution.ztst
@@ -207,10 +207,12 @@ F:This similar test was triggering a reproducible failure with pipestatus.
coproc { read -Et 5 || kill -INT $$ }
print -u $ZTST_fd 'This test takes 5 seconds to fail...'
{ printf "%d\n" {1..20000} } | ( read -E )
+ hang(){ printf "%d\n" {2..20000} | cat }; hang | ( read -E )
print -p done
read -Ep
0:Bug regression: piping a shell construct to an external process may hang
>1
+>2
>done
F:This test checks for a file descriptor leak that could cause the left
F:side of a pipe to block on write after the right side has exited

View File

@ -1,26 +0,0 @@
Index: zsh/Completion/openSUSE/Command/_zypper
===================================================================
--- zsh.orig/Completion/openSUSE/Command/_zypper
+++ zsh/Completion/openSUSE/Command/_zypper
@@ -28,11 +28,10 @@ _zypper() {
local hline
local -a cmdlist
local tag=0
- _call_program help-commands zypper help | while read -A hline; do
+ _call_program help-commands LANG=C zypper help | sed -e ':a;N;$!ba;s/\n\t\t\t\t/ /g' | while read -A hline; do
# start parsing with "Global Options:"
[[ $hline =~ "^Global Options:" ]] && tag=1
[[ $tag = 0 ]] && continue
- [[ $hline[1] =~ ^\t\t\t\t ]] && continue
# all commands have to start with lower case letters
[[ $hline[1] =~ ^[A-Z] ]] && continue
(( ${#hline} < 2 )) && continue
@@ -51,7 +50,7 @@ _zypper_cmd_do() {
local hline
local -a cmdlist
local tag=0
- _call_program help-commands zypper help $cmd | while read -A hline; do
+ _call_program help-commands LANG=C zypper help $cmd | while read -A hline; do
# start parsing from "Options:"
[[ $hline =~ "^Command options:" ]] && tag=1
[[ $tag = 0 ]] && continue

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed Dec 25 12:25:03 UTC 2013 - idonmez@suse.com
- Update to version 5.0.4
* Small bugfix release
- Add zsh-pipefix.patch to import pipe fixes from zsh.git
- Remove upstream patches
* zsh-osc-suseversion.patch
* zsh-zypper-completion.patch
-------------------------------------------------------------------
Mon Apr 22 09:22:02 UTC 2013 - idonmez@suse.com

View File

@ -17,7 +17,7 @@
Name: zsh
Version: 5.0.2
Version: 5.0.4
Release: 0
Summary: Shell with comprehensive completion
License: MIT
@ -36,9 +36,8 @@ Source15: zshenv.rhs
Source16: dotzshrc.rh
Source17: zshprompt.pl
%endif
Patch1: zsh-zypper-completion.patch
Patch2: zsh-osc-suseversion.patch
Patch3: trim-unneeded-completions.patch
Patch1: trim-unneeded-completions.patch
Patch2: zsh-pipefix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
Requires(pre): %{install_info_prereq}
@ -94,11 +93,10 @@ This package contains the Zsh manual in html format.
%prep
%setup -q -n %{name}-%{version}
%patch1 -p1
%patch2 -p1
%if 0%{?suse_version}
%patch3 -p1
%patch1 -p1
%endif
%patch2 -p1
# Remove executable bit
chmod 0644 Etc/changelog2html.pl
@ -129,15 +127,6 @@ perl -p -i -e 's|/usr/local/bin|%{_bindir}|' \
make all info html
# make help text files
install -d Help
pushd Help/
troff -Tlatin1 -t -mandoc ../Doc/zshbuiltins.1 | \
grotty -cbou | \
sed -e 's/±/{+|-}/' | \
../Util/helpfiles
popd
# generate intro.ps
groff -Tps -ms Doc/intro.ms > intro.ps
@ -179,7 +168,7 @@ done
# install help files
install -m 0755 -Dd %{buildroot}%{_datadir}/%{name}/%{version}/help
install -m 0644 Help/* %{buildroot}%{_datadir}/%{name}/%{version}/help/
install -m 0644 Doc/help/* %{buildroot}%{_datadir}/%{name}/%{version}/help/
# link zsh binary
ln -sf %{_bindir}/zsh %{buildroot}/bin/zsh