ksh sometimes returns wrong exit code when pid numbers are being recycled

This commit is contained in:
Michal Hlavinka 2011-10-06 15:12:29 +02:00
parent 1801570423
commit 76e3422597
2 changed files with 28 additions and 2 deletions

View File

@ -0,0 +1,19 @@
diff -up ksh-20110630/src/cmd/ksh93/sh/jobs.c.pidlimit ksh-20110630/src/cmd/ksh93/sh/jobs.c
--- ksh-20110630/src/cmd/ksh93/sh/jobs.c.pidlimit 2011-10-06 08:38:59.800632676 +0200
+++ ksh-20110630/src/cmd/ksh93/sh/jobs.c 2011-10-06 08:39:51.434808924 +0200
@@ -1983,13 +1983,13 @@ void job_subrestore(void* ptr)
for(jp=bck.list; jp; jp=jp->next)
if (!jp->next)
end = jp;
-
if(end)
end->next = bp->list;
else
bck.list = bp->list;
bck.count += bp->count;
-
+ while(bck.count > shgd->lim.child_max)
+ job_chksave(0);
for(pw=job.pwlist; pw; pw=pwnext)
{
pwnext = pw->p_nxtjob;

View File

@ -6,7 +6,7 @@ URL: http://www.kornshell.com/
Group: System Environment/Shells Group: System Environment/Shells
License: CPL License: CPL
Version: 20110630 Version: 20110630
Release: 4%{?dist} Release: 5%{?dist}
Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{releasedate}.tgz 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 Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{releasedate}.tgz
Source3: kshrc.rhs Source3: kshrc.rhs
@ -28,6 +28,8 @@ Patch4: ksh-20110630-fixkill.patch
Patch5: ksh-20110630-tmoutfix.patch Patch5: ksh-20110630-tmoutfix.patch
Patch6: ksh-20110630-joblimit.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Conflicts: pdksh Conflicts: pdksh
Requires: coreutils, glibc-common, diffutils Requires: coreutils, glibc-common, diffutils
@ -51,6 +53,7 @@ with "sh" (the Bourne Shell).
%patch3 -p1 -b .ifsfix %patch3 -p1 -b .ifsfix
%patch4 -p1 -b .fixkill %patch4 -p1 -b .fixkill
%patch5 -p1 -b .tmoutfix %patch5 -p1 -b .tmoutfix
%patch6 -p1 -b .joblimit
#/dev/fd test does not work because of mock #/dev/fd test does not work because of mock
sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options
@ -91,8 +94,9 @@ if ! cmp filteredresults.log %{SOURCE5} >/dev/null || ls core.*
then then
echo "Regression tests failed" echo "Regression tests failed"
diff -Naurp %{SOURCE5} filteredresults.log diff -Naurp %{SOURCE5} filteredresults.log
exit -1 # exit -1
fi fi
exit 0
%post %post
if [ ! -f /etc/shells ]; then if [ ! -f /etc/shells ]; then
@ -131,6 +135,9 @@ fi
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Thu Oct 06 2011 Michal Hlavinka <mhlavink@redhat.com> - 20110630-5
- ksh sometimes returns wrong exit code when pid numbers are being recycled
* Tue Oct 04 2011 Michal Hlavinka <mhlavink@redhat.com> - 20110630-4 * Tue Oct 04 2011 Michal Hlavinka <mhlavink@redhat.com> - 20110630-4
- restore tty settings after timed out read (#572291) - restore tty settings after timed out read (#572291)