From f57567a859889c6a317aecbc93fc5ac85a082a72 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Fri, 12 Aug 2011 15:59:01 +0200 Subject: [PATCH] do not crash when killing last bg job when there is not any --- ksh-20110630-fixkill.patch | 20 ++++++++++++++++++++ ksh.spec | 9 ++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 ksh-20110630-fixkill.patch diff --git a/ksh-20110630-fixkill.patch b/ksh-20110630-fixkill.patch new file mode 100644 index 0000000..c027bac --- /dev/null +++ b/ksh-20110630-fixkill.patch @@ -0,0 +1,20 @@ +diff -up ksh-20110630/src/cmd/ksh93/sh/jobs.c.orig ksh-20110630/src/cmd/ksh93/sh/jobs.c +--- ksh-20110630/src/cmd/ksh93/sh/jobs.c.orig 2011-08-12 11:50:39.059283656 +0200 ++++ ksh-20110630/src/cmd/ksh93/sh/jobs.c 2011-08-12 11:52:02.237911639 +0200 +@@ -1103,7 +1103,7 @@ static struct process *job_bystring(regi + + int job_kill(register struct process *pw,register int sig) + { +- Shell_t *shp = pw->p_shp; ++ Shell_t *shp; + register pid_t pid; + register int r; + const char *msg; +@@ -1116,6 +1116,7 @@ int job_kill(register struct process *pw + errno = ECHILD; + if(pw==0) + goto error; ++ shp = pw->p_shp; + pid = pw->p_pid; + #if SHOPT_COSHELL + if(pw->p_cojob) diff --git a/ksh.spec b/ksh.spec index ee61daa..6b602d6 100644 --- a/ksh.spec +++ b/ksh.spec @@ -6,7 +6,7 @@ URL: http://www.kornshell.com/ Group: System Environment/Shells License: CPL Version: 20110630 -Release: 2%{?dist} +Release: 3%{?dist} Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{releasedate}.tgz Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{releasedate}.tgz Source3: kshrc.rhs @@ -23,6 +23,9 @@ Patch2: ksh-20100826-fixregr.patch # for ksh < 2011-08-03 Patch3: ksh-20110630-ifsfix.patch +# sent upstream, for ksh <= 2011-08-12 +Patch4: ksh-20110630-fixkill.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Conflicts: pdksh Requires: coreutils, glibc-common, diffutils @@ -44,6 +47,7 @@ with "sh" (the Bourne Shell). %patch1 -p1 -b .builtins %patch2 -p1 -b .fixregr %patch3 -p1 -b .ifsfix +%patch4 -p1 -b .fixkill #/dev/fd test does not work because of mock sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options @@ -124,6 +128,9 @@ fi rm -rf $RPM_BUILD_ROOT %changelog +* Fri Aug 12 2011 Michal Hlavinka - 20110630-3 +- do not crash when killing last bg job when there is not any + * Wed Aug 03 2011 Michal Hlavinka - 20110630-2 - fix: IFS manipulation in a function can cause crash