From 2249c87fa4c529dc1ae2ce8bee044dfff232f0fa Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Wed, 6 May 2015 10:29:00 +0200 Subject: [PATCH] do not crash, when disk is full, report an error (#1212994) --- ksh-20120801-diskfull.patch | 20 ++++++++++++++++++++ ksh.spec | 7 ++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 ksh-20120801-diskfull.patch diff --git a/ksh-20120801-diskfull.patch b/ksh-20120801-diskfull.patch new file mode 100644 index 0000000..9d68d93 --- /dev/null +++ b/ksh-20120801-diskfull.patch @@ -0,0 +1,20 @@ +--- ksh-20120801/src/cmd/ksh93/sh/main.c 2015-04-17 16:55:57.802048900 -0300 ++++ ksh-20120801/src/cmd/ksh93/sh/main.c 2015-04-17 17:10:45.276129709 -0300 +@@ -423,7 +423,7 @@ static void exfile(register Shell_t *shp + sfsync(shp->outpool); + shp->st.execbrk = shp->st.breakcnt = 0; + /* check for return from profile or env file */ +- if(sh_isstate(SH_PROFILE) && (jmpval==SH_JMPFUN || jmpval==SH_JMPEXIT)) ++ if(sh_isstate(SH_PROFILE) && (jmpval==SH_JMPFUN || jmpval==SH_JMPEXIT || jmpval==SH_JMPERREXIT)) + { + sh_setstate(states); + goto done; +@@ -600,6 +600,8 @@ done: + siglongjmp(*shp->jmplist,jmpval); + else if(jmpval == SH_JMPEXIT) + sh_done(shp,0); ++ else if(jmpval == SH_JMPERREXIT) ++ sh_done(shp,-1); + if(fno>0) + sh_close(fno); + if(shp->st.filename) diff --git a/ksh.spec b/ksh.spec index 77246e8..a6295ad 100644 --- a/ksh.spec +++ b/ksh.spec @@ -9,7 +9,7 @@ Group: System Environment/Shells #CPL everywhere else (for KSH itself) License: CPL Version: %{releasedate} -Release: 25%{?dist} +Release: 26%{?dist} Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{release_date}.tgz Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{release_date}.tgz Source2: kshcomp.conf @@ -150,6 +150,7 @@ Patch60: ksh-20120801-trapcom.patch # for ksh <= 2013-04-09, rhbz#960371 Patch61: ksh-20120801-lexfix.patch Patch62: ksh-20140801-arraylen.patch +Patch63: ksh-20120801-diskfull.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Conflicts: pdksh @@ -217,6 +218,7 @@ with "sh" (the Bourne Shell). %patch60 -p1 -b .trapcom %patch61 -p1 -b .lexfix %patch62 -p1 -b .arraylen +%patch63 -p1 -b .diskfull #/dev/fd test does not work because of mock sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options @@ -320,6 +322,9 @@ fi rm -rf $RPM_BUILD_ROOT %changelog +* Wed May 06 2015 Michal Hlavinka - 20120801-26 +- do not crash, when disk is full, report an error (#1212994) + * Tue Apr 07 2015 Michal Hlavinka - 20120801-25 - using trap DEBUG could cause segmentation fault