From 0a835abdfbeac590512ac43f9450d96d7290a11e Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Fri, 22 Feb 2013 16:45:55 +0100 Subject: [PATCH] do not segfault on kill % (#914669) --- ksh-20130214-fixkill.patch | 21 +++++++++++++++++++++ ksh.spec | 7 ++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 ksh-20130214-fixkill.patch diff --git a/ksh-20130214-fixkill.patch b/ksh-20130214-fixkill.patch new file mode 100644 index 0000000..0862880 --- /dev/null +++ b/ksh-20130214-fixkill.patch @@ -0,0 +1,21 @@ +diff -up ksh-20130214/src/cmd/ksh93/sh/jobs.c.fixkill ksh-20130214/src/cmd/ksh93/sh/jobs.c +--- ksh-20130214/src/cmd/ksh93/sh/jobs.c.fixkill 2012-09-26 17:43:04.000000000 +0200 ++++ ksh-20130214/src/cmd/ksh93/sh/jobs.c 2013-02-22 16:38:05.080161740 +0100 +@@ -1104,6 +1104,8 @@ static struct process *job_bystring(regi + + int job_kill(register struct process *pw,register int sig) + { ++ if(pw==0) ++ goto error; + Shell_t *shp = pw->p_shp; + register pid_t pid; + register int r; +@@ -1127,8 +1129,6 @@ int job_kill(register struct process *pw + #endif /* SIGTSTP */ + job_lock(); + errno = ECHILD; +- if(pw==0) +- goto error; + pid = pw->p_pid; + #if SHOPT_COSHELL + if(pw->p_cojob) diff --git a/ksh.spec b/ksh.spec index c5020fe..10a92ea 100644 --- a/ksh.spec +++ b/ksh.spec @@ -6,7 +6,7 @@ URL: http://www.kornshell.com/ Group: System Environment/Shells License: EPL Version: 20120801 -Release: 6%{?dist} +Release: 7%{?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 Source2: kshcomp.conf @@ -24,6 +24,7 @@ Patch3: rmdirfix.patch Patch4: ksh-20120801-cdfix.patch Patch5: ksh-20120801-tabfix.patch Patch6: ksh-20120801-cdfix2.patch +Patch7: ksh-20130214-fixkill.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Conflicts: pdksh @@ -49,6 +50,7 @@ with "sh" (the Bourne Shell). %patch4 -p1 -b .cdfix %patch5 -p1 -b .tabfix %patch6 -p1 -b .cdfix2 +%patch7 -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 @@ -142,6 +144,9 @@ fi rm -rf $RPM_BUILD_ROOT %changelog +* Fri Feb 22 2013 Michal Hlavinka - 20120801-7 +- do not segfault on kill % (#914669) + * Fri Feb 01 2013 Michal Hlavinka - 20120801-6 - cd file did not produce any error