From e4b22c21d8aa53bb562702d8e6b2a382ce135d6e1ba1273276f3cf859f606d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Fri, 17 Jun 2011 13:42:26 +0000 Subject: [PATCH] - Add zsh-kill-suspended-job.patch: fix killing suspended jobs - Add zsh-findproc.patch: fix findproc() to find stopped jobs OBS-URL: https://build.opensuse.org/package/show/shells/zsh?expand=0&rev=71 --- zsh-findproc.patch | 20 ++++++++++++++ zsh-kill-suspended-job.patch | 53 ++++++++++++++++++++++++++++++++++++ zsh.changes | 6 ++++ zsh.spec | 7 +++++ 4 files changed, 86 insertions(+) create mode 100644 zsh-findproc.patch create mode 100644 zsh-kill-suspended-job.patch diff --git a/zsh-findproc.patch b/zsh-findproc.patch new file mode 100644 index 0000000..73c4533 --- /dev/null +++ b/zsh-findproc.patch @@ -0,0 +1,20 @@ +commit 21c39600ef2d74c3e7474c4e5b89805656c6fe4e +Author: Bart Schaefer +Date: Sun Jun 12 15:06:37 2011 +0000 + + 29472: findproc() needs at least to also return stopped jobs. + +diff --git a/Src/jobs.c b/Src/jobs.c +index b3ec000..0ace80b 100644 +--- a/Src/jobs.c ++++ b/Src/jobs.c +@@ -189,7 +189,8 @@ findproc(pid_t pid, Job *jptr, Process *pptr, int aux) + * the termination of the process which pid we were supposed + * to return in a different job. + */ +- if (pn->pid == pid && pn->status == SP_RUNNING) { ++ if (pn->pid == pid && (pn->status == SP_RUNNING || ++ WIFSTOPPED(pn->status))) { + *pptr = pn; + *jptr = jobtab + i; + return 1; diff --git a/zsh-kill-suspended-job.patch b/zsh-kill-suspended-job.patch new file mode 100644 index 0000000..12d719b --- /dev/null +++ b/zsh-kill-suspended-job.patch @@ -0,0 +1,53 @@ +commit 98b29d02ca17068779f4b8fa2d43c9753386478f +Author: Bart Schaefer +Date: Wed Jun 15 15:38:14 2011 +0000 + + 29481: always return a matching job in findproc() but scan the whole list + to prefer running jobs + +diff --git a/Src/jobs.c b/Src/jobs.c +index 0ace80b..9c9b12f 100644 +--- a/Src/jobs.c ++++ b/Src/jobs.c +@@ -160,6 +160,8 @@ findproc(pid_t pid, Job *jptr, Process *pptr, int aux) + Process pn; + int i; + ++ *jptr = NULL; ++ *pptr = NULL; + for (i = 1; i <= maxjob; i++) + { + /* +@@ -189,16 +191,16 @@ findproc(pid_t pid, Job *jptr, Process *pptr, int aux) + * the termination of the process which pid we were supposed + * to return in a different job. + */ +- if (pn->pid == pid && (pn->status == SP_RUNNING || +- WIFSTOPPED(pn->status))) { ++ if (pn->pid == pid) { + *pptr = pn; + *jptr = jobtab + i; +- return 1; ++ if (pn->status == SP_RUNNING) ++ return 1; + } + } + } + +- return 0; ++ return (*pptr && *jptr); + } + + /* Does the given job number have any processes? */ +diff --git a/Src/signals.c b/Src/signals.c +index 456a853..a848acd 100644 +--- a/Src/signals.c ++++ b/Src/signals.c +@@ -489,7 +489,6 @@ wait_for_processes(void) + * Find the process and job containing this pid and + * update it. + */ +- pn = NULL; + if (findproc(pid, &jn, &pn, 0)) { + #if defined(HAVE_WAIT3) && defined(HAVE_GETRUSAGE) + struct timezone dummy_tz; diff --git a/zsh.changes b/zsh.changes index 020ef06..03a4e3c 100644 --- a/zsh.changes +++ b/zsh.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jun 17 13:35:56 UTC 2011 - idonmez@novell.com + +- Add zsh-kill-suspended-job.patch: fix killing suspended jobs +- Add zsh-findproc.patch: fix findproc() to find stopped jobs + ------------------------------------------------------------------- Wed Jun 1 13:17:38 UTC 2011 - idonmez@novell.com diff --git a/zsh.spec b/zsh.spec index 5dbe55a..123fda8 100644 --- a/zsh.spec +++ b/zsh.spec @@ -29,6 +29,11 @@ Source1: zshrc Source2: zshenv Source3: zprofile Patch1: %{name}-%{version}-disable-c02cond-test.patch +# PATCH-FIX-UPSTREAM zsh-findproc.patch idoenmez@suse.de -- Upstream commit 21c39600ef2d74c3e7474c4e5b89805656c6fe4e +Patch2: %{name}-findproc.patch +# PATCH-FIX-UPSTREAM zsh-kill-suspended-job.patch idoenmez@suse.de -- Upstream commit 98b29d02ca17068779f4b8fa2d43c9753386478f +Patch3: %{name}-kill-suspended-job.patch + BuildRequires: fdupes BuildRequires: libcap-devel BuildRequires: ncurses-devel @@ -47,6 +52,8 @@ Zsh is well known for its command line completion. %prep %setup -q %patch1 +%patch2 -p1 +%patch3 -p1 # Fix bindir path in some files perl -p -i -e 's|/usr/local/bin|%{_bindir}|' \