From 8a6e4f28df1ef48cef5f994613ff60f57689e2e0 Mon Sep 17 00:00:00 2001 From: Tomas Smetana Date: May 23 2007 06:52:45 +0000 Subject: fix SIGTTOU handling, spawned processes, spec file, remove redundant builtins --- diff --git a/ksh-20070328-builtins.patch b/ksh-20070328-builtins.patch new file mode 100644 index 0000000..6e34e34 --- /dev/null +++ b/ksh-20070328-builtins.patch @@ -0,0 +1,18 @@ +--- ksh-20070328/src/cmd/ksh93/data/builtins.c.builtoff 2007-05-22 13:14:33.000000000 +0200 ++++ ksh-20070328/src/cmd/ksh93/data/builtins.c 2007-05-22 13:14:51.000000000 +0200 +@@ -128,6 +128,7 @@ + #ifdef SHOPT_CMDLIB_HDR + #include SHOPT_CMDLIB_HDR + #else ++#if 0 + CMDLIST(basename) + CMDLIST(chmod) + CMDLIST(dirname) +@@ -141,6 +142,7 @@ + CMDLIST(wc) + CMDLIST(sync) + #endif ++#endif + "", 0, 0 + }; + diff --git a/ksh-20070328-exit19.patch b/ksh-20070328-exit19.patch new file mode 100644 index 0000000..b8ab3b4 --- /dev/null +++ b/ksh-20070328-exit19.patch @@ -0,0 +1,33 @@ +--- ksh-20070328/src/cmd/ksh93/sh/jobs.c.exit19 2007-05-22 11:51:10.000000000 +0200 ++++ ksh-20070328/src/cmd/ksh93/sh/jobs.c 2007-05-22 11:55:55.000000000 +0200 +@@ -307,7 +307,8 @@ + else + { + pw->p_flag |= (P_DONE|P_NOTIFY); +- if(WEXITSTATUS(wstat) > pw->p_exit) ++ pw->p_exit = pw->p_exitmin; ++ if(WEXITSTATUS(wstat) > pw->p_exitmin) + pw->p_exit = WEXITSTATUS(wstat); + } + if(pw->p_pgrp==0) +@@ -1068,8 +1069,8 @@ + pw->p_env = sh.curenv; + pw->p_pid = pid; + pw->p_flag = P_EXITSAVE; +- pw->p_exit = sh.xargexit; +- sh.xargexit = 0; ++ pw->p_exitmin = sh.xargexit; ++ pw->p_exit = 0; + if(sh_isstate(SH_MONITOR)) + { + if(killpg(job.curpgid,0)<0 && errno==ESRCH) +--- ksh-20070328/src/cmd/ksh93/include/jobs.h.exit19 2007-05-22 11:51:29.000000000 +0200 ++++ ksh-20070328/src/cmd/ksh93/include/jobs.h 2007-05-22 11:52:14.000000000 +0200 +@@ -64,6 +64,7 @@ + pid_t p_fgrp; /* process group when stopped */ + short p_job; /* job number of process */ + unsigned short p_exit; /* exit value or signal number */ ++ unsigned short p_exitmin; /* minimum exit value for xargs */ + unsigned char p_flag; /* flags - see below */ + int p_env; /* subshell environment number */ + #ifdef JOBS diff --git a/ksh-20070328-ttou.patch b/ksh-20070328-ttou.patch new file mode 100644 index 0000000..ccdf367 --- /dev/null +++ b/ksh-20070328-ttou.patch @@ -0,0 +1,19 @@ +--- ksh-20070328/src/cmd/ksh93/sh/jobs.c.ttou 2007-05-22 12:47:38.000000000 +0200 ++++ ksh-20070328/src/cmd/ksh93/sh/jobs.c 2007-05-22 12:50:24.000000000 +0200 +@@ -609,9 +609,16 @@ + { + /* save the terminal state for current job */ + #ifdef SIGTSTP ++ Sig_handler_t saved_handler; ++ ++ saved_handler = signal(SIGTTOU, SIG_IGN); + job_fgrp(pw,tcgetpgrp(job.fd)); + if(tcsetpgrp(job.fd,sh.pid) !=0) ++ { ++ signal(SIGTTOU, saved_handler); + return; ++ } ++ signal(SIGTTOU, saved_handler); + #endif /* SIGTSTP */ + /* force the following tty_get() to do a tcgetattr() */ + tty_set(-1, 0, NIL(struct termios*)); diff --git a/ksh.spec b/ksh.spec index 78b979f..6e1476a 100644 --- a/ksh.spec +++ b/ksh.spec @@ -8,7 +8,7 @@ URL: http://www.kornshell.com/ Group: Applications/Shells License: Common Public License Version 1.0 Version: 20070328 -Release: 1 +Release: 2%{?dist} #Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{releasedate}.linux.i386.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 @@ -18,6 +18,9 @@ Patch1: ksh-20070328-uname.patch Patch2: ksh-20070328-useex.patch Patch3: ksh-20070328-loginsh.patch Patch4: ksh-20070328-leak.patch +Patch5: ksh-20070328-exit19.patch +Patch6: ksh-20070328-builtins.patch +Patch7: ksh-20070328-ttou.patch # for debugging only: #Patch100: ksh-20060124-iffedebug.patch @@ -26,6 +29,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Provides: ksh93 Obsoletes: ksh93 Conflicts: pdksh +Requires: coreutils, glibc-common, diffutils Requires(post): grep, coreutils Requires(preun): grep, coreutils @@ -44,14 +48,16 @@ with "sh" (the Bourne Shell). %patch2 -p1 -b .use_ex %patch3 -p1 -b .loginsh %patch4 -p1 -b .leak +%patch5 -p1 -b .exit19 +%patch6 -p1 -b .builtins +%patch7 -p1 -b .ttou #patch100 -p1 -b .iffedebug %build ./bin/package "read" ||: -# Use this for debugging: -#export CCFLAGS="-O0 -ggdb" -#./bin/package DEBUG "make" -./bin/package "make" %{?_smp_mflags} +export CCFLAGS="$RPM_OPT_FLAGS" +export CC=gcc +./bin/package "make" cp lib/package/LICENSES/ast LICENSE %install @@ -103,6 +109,12 @@ fi rm -rf $RPM_BUILD_ROOT %changelog +* Tue May 22 2007 Tomas Smetana 20070328-2 +- fix wrong exit status of spawned process after SIGSTOP +- fix building of debuginfo package, add %%{?dist} to release +- fix handling of SIGTTOU in non-interactive shell +- remove useless builtins + * Thu Apr 19 2007 Tomas Smetana 20070328-1 - new upstream source - fix login shell invocation (#182397)