[ksh/f15] do not crash when killing last bg job when there is not any

Michal Hlavinka mhlavink at fedoraproject.org
Fri Aug 12 10:30:00 UTC 2011


commit 48280955f3774d83c3f2ab66e46da49a4b85d70e
Author: Michal Hlavinka <mhlavink at redhat.com>
Date:   Fri Aug 12 12:29:47 2011 +0200

    do not crash when killing last bg job when there is not any

 ksh-20110630-fixkill.patch |   20 ++++++++++++++++++++
 ksh.spec                   |   11 +++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)
---
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 d08eb8f..a321cce 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:      1%{?dist}
+Release:      2%{?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
@@ -52,7 +56,7 @@ sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options
 ./bin/package
 ./bin/package make mamake ||:
 ./bin/package make mamake ||:
-export CCFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
+export CCFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -O0 -ggdb3"
 export CC=gcc
 ./bin/package "make"
 
@@ -124,6 +128,9 @@ fi
     rm -rf $RPM_BUILD_ROOT
 
 %changelog
+* Fri Aug 12 2011 Michal Hlavinka <mhlavink at redhat.com> - 20110630-2
+- do not crash when killing last bg job when there is not any
+
 * Fri Aug 12 2011 Michal Hlavinka <mhlavink at redhat.com> - 20110630-1
 - ksh updated to 2011-06-30
 


More information about the scm-commits mailing list