#ExclusiveArch: x86_64 %define releasedate 2010-06-21 #ExcludeArch: ia64 Name: ksh Summary: The Original ATT Korn Shell URL: http://www.kornshell.com/ Group: Applications/Shells License: Common Public License Version 1.0 Version: 20100621 Release: 5%{?dist}.1 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 #we need old locale, because the new one is broken (#493570) Source2: http://www.research.att.com/~gsf/download/tgz/ast-base-locale.2006-02-14.tgz #documentation of important changes not mentioned in RELEASE file Source3: ChangeLog Patch1: ksh-20070328-uname.patch #use 'ex' editor instead of 'ed' Patch2: ksh-20070328-useex.patch #fedora/rhel specific Patch3: ksh-20080202-builtins.patch #sent upstream, ksh 2009-12-11 still does not include this patch, rhbz#278781 Patch4: ksh-20070328-ttou.patch Patch5: ksh-20080202-manfix.patch #fedora/rhel specific, add info that linux does not have pfexec, rhbz#514485 Patch6: ksh-20091211-manfix2.patch #add RLIMIT_RTPRIO and RLIMIT_NICE support to ulimit, for ksh<2010-08-11 Patch7: ksh-20100202-ulimitrfe.patch # sent upstream, ksh << 20101212 Patch8: ksh-20100202-memleak.patch # for ksh <= 2010-08-26, rhbz#616684 Patch9: ksh-20100701-pipeio3.patch # for ksh <= 2010-08-11, rhbz#616691 Patch10: ksh-20100621-samesig.patch # for ksh <= 2010-09-08, rhbz#637052 Patch11: ksh-20100826-fixcrash.patch # for ksh << 2010-12-12, rhbz#642508 Patch12: ksh-20100202-funclose.patch # for ksh <= 2010-10-19, rhbz#644362 Patch13: ksh-20100621-iotry1.patch # for ksh <= 2010-11-08, rhbz#650998 Patch14: ksh-20100202-dotredir.patch # for ksh < 2010-12-12, rhbz#659459 Patch15: ksh-20100621-filerace.patch # for ksh <= 2011-02-08, rhbz#681478 Patch16: ksh-20110208-clist.patch # for ksh <= 2010-09-24, rhbz#640379 Patch17: ksh-20100202-pipefail.patch # for ksh <= 2010-10-28, rhbz#647524 Patch18: ksh-20100621-completion.patch # for ksh <= 2011-05-05, rhbz#699823 Patch19: ksh-20100621-chexitcode.patch # for ksh <= 2011-02-18, rhbz#691933 Patch20: ksh-20100621-argv0.patch # not upstream, rhbz#699641 Patch21: ksh-20100202-pathvar.patch # for ksh <= 2011-05-04, rhbz#691850 Patch22: ksh-20110415-fixkill.patch # for ksh < 2010-10-10, rhbz#683722 Patch23: ksh-20100621-ifs.patch # second part - for second reproducer, for ksh <= 2011-08-08 Patch24: ksh-20100621-ifsfix2.patch # for ksh < 2011-05-05, rhbz#690816 Patch25: ksh-20100202-arrayfix.patch # for ksh < 2011-08-06, rhbz#726199 Patch26: ksh-20100621-waitpid.patch # for ksh < 2011-09-21, rhbz#573936 Patch27: ksh-20110630-tmoutfix.patch # rhel-5 only, rhbz#736462 Patch28: ksh-20100202-secfiletime.patch # for ksh < 2011-06-30, rhbz#743302 Patch29: ksh-20100621-fixhang.patch # for ksh <= 2011-10-06, rhbz#743357 Patch30: ksh-20110630-joblimit.patch # for ksh <= 2010-09-02, rhbz#747249 Patch31: ksh-20100621-fixdll.patch # for ksh <= 2011-12-02, rhbz#759498 Patch32: ksh-20110630-dontstop.patch # for ksh <= 2012-02-14, rhbz#802565 Patch33: ksh-20120214-tildafix.patch #fix regression test suite to be usable during packagebuild - Fedora/RHEL specific Patch99: ksh-20100826-fixregr.patch BuildRoot: %{_tmppath}/%{name}-%{version}-root Provides: ksh93 Obsoletes: ksh93 PreReq: grep, coreutils Requires: chkconfig Requires(post): chkconfig Requires(preun): chkconfig %description KSH-93 is the most recent version of the KornShell by David Korn of AT&T Bell Laboratories. KornShell is a shell programming language, which is upward compatible with "sh" (the Bourne Shell). %prep %setup -q -c %setup -q -T -D -a 1 %setup -q -T -D -a 2 %patch1 -p1 -b .uname %patch2 -p1 -b .use_ex %patch3 -p1 -b .builtins %patch4 -p1 -b .ttou %patch5 -p1 -b .manfix %patch6 -p1 -b .manfix2 %patch7 -p1 -b .ulimitrfe %patch8 -p1 -b .memleak %patch9 -p1 -b .pipeio3 %patch10 -p1 -b .samesig %patch11 -p1 -b .fixcrash %patch12 -p1 -b .funclose %patch13 -p1 -b .iotry1 %patch14 -p1 -b .dotredir %patch15 -p1 -b .filerace %patch16 -p1 -b .clist %patch17 -p1 -b .pipefail %patch18 -p1 -b .completion %patch19 -p1 -b .chexitcode %patch20 -p1 -b .argv0 %patch21 -p1 -b .pathvar %patch22 -p1 -b .fixkill %patch23 -p1 -b .fixifs %patch24 -p1 -b .fixifs2 %patch25 -p1 -b .arrayfix %patch26 -p1 -b .waitpid %patch27 -p1 -b .tmoutfix %patch28 -p1 -b .secfiletime %patch29 -p1 -b .fixhang %patch30 -p1 -b .joblimit %patch31 -p1 -b .fixdll %patch32 -p1 -b .dontstop %patch33 -p1 -b .tildafix %patch99 -p1 -b .fixregr cp %{SOURCE3} . %build ./bin/package "read" ||: export CCFLAGS="-O2 -ggdb -DSHOPT_AUDIT" ./bin/package "make" # missing in 2010-06-21, check later if it's present again # cp lib/package/LICENSES/ast LICENSE %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT{/bin,/usr/bin,%{_mandir}/man1} mkdir -p $RPM_BUILD_ROOT%{_datadir}/locale/{C,pt,fr,de,it,es}/LC_MESSAGES install -c -m 755 arch/*/bin/ksh $RPM_BUILD_ROOT/bin/ksh93 install -c -m 644 arch/*/man/man1/sh.1 $RPM_BUILD_ROOT%{_mandir}/man1/ksh93.1 gzip $RPM_BUILD_ROOT%{_mandir}/man1/ksh93.1 for i in C pt fr de it es; do install -m 644 share/lib/locale/$i/LC_MESSAGES/* \ $RPM_BUILD_ROOT%{_datadir}/locale/$i/LC_MESSAGES/ done #fool rpmbuild about %ghost files (#495040) touch $RPM_BUILD_ROOT%{_bindir}/ksh touch $RPM_BUILD_ROOT/bin/ksh touch $RPM_BUILD_ROOT%{_mandir}/man1/ksh.1.gz %post if [ ! -f /etc/shells ]; then echo "/bin/ksh" > /etc/shells else if ! grep -q '^/bin/ksh$' /etc/shells ; then echo "/bin/ksh" >> /etc/shells fi fi %{_sbindir}/alternatives --install /bin/ksh ksh \ /bin/ksh93 50 \ --slave %{_bindir}/ksh ksh-usrbin \ /bin/ksh93 \ --slave %{_mandir}/man1/ksh.1.gz ksh-man \ %{_mandir}/man1/ksh93.1.gz #if not symlink we are updating ksh where there was no alternatives before #so replace with symlink and set alternatives if [ ! -L /bin/ksh ]; then %{_sbindir}/alternatives --auto ksh ln -sf /etc/alternatives/ksh /bin/ksh ln -sf /etc/alternatives/ksh-usrbin %{_bindir}/ksh ln -sf /etc/alternatives/ksh-man %{_mandir}/man1/ksh.1.gz fi %preun if [ $1 = 0 ]; then %{_sbindir}/alternatives --remove ksh /bin/ksh93 fi %postun if [ ! -f /bin/ksh ]; then grep -v '^/bin/ksh$' /etc/shells >/etc/shells.new mv /etc/shells.new /etc/shells chmod 644 /etc/shells fi %verifyscript echo -n "Looking for ksh in /etc/shells... " if ! grep '^/bin/ksh$' /etc/shells > /dev/null; then echo "missing" echo "ksh missing from /etc/shells" >&2 else echo "found" fi %check export SHELL=$(ls $(pwd)/arch/*/bin/ksh) cd src/cmd/ksh93/tests/ ulimit -c unlimited if [ ! -e /dev/fd ] then echo "ERROR: /dev/fd does not exist, regression tests skipped" exit 0 fi $SHELL ./shtests 2>&1 | tee testresults.log [ ! -f %{testresults} ] && exit 0 sed -e '/begins at/d' -e '/ 0 error/d' -e 's/at [^\[]*\[/\[/' testresults.log -e '/tests skipped/d' >filteredresults.log if [ -s filteredresults.log ] || ls core.* then echo "Regression tests failed" cat filteredresults.log exit -1 fi %files %defattr(-, root, root) #doc LICENSE %doc README src/cmd/ksh93/COMPATIBILITY src/cmd/ksh93/RELEASE ChangeLog /bin/ksh93 %ghost /bin/ksh %ghost %{_bindir}/ksh %{_datadir}/locale/*/LC_MESSAGES/* %{_mandir}/man1/ksh93.1.gz %ghost %{_mandir}/man1/ksh.1.gz %clean rm -rf $RPM_BUILD_ROOT %changelog * Mon Mar 21 2012 Michal Hlavinka <mhlavink@redhat.com> - 20100621-5.1 - fix tilda expansion in scripts (#805459) * Tue Dec 06 2011 Michal Hlavinka <mhlavink@redhat.com> - 20100621-5 - fix: ksh can exit prematurely without crash or any error (#759498) * Wed Oct 19 2011 Michal Hlavinka <mhlavink@redhat.com> - 20100621-4 - fix loading of dynamic builtins (#747249) * Tue Oct 11 2011 Michal Hlavinka <mhlavink@redhat.com> - 20100621-3 - ksh sometimes returns wrong exit code when pid numbers are being recycled (#743357) * Tue Oct 04 2011 Michal Hlavinka <mhlavink@redhat.com> - 20100621-2 - do not hang when pipes are used in eval argument (#743302) * Mon Oct 03 2011 Michal Hlavinka <mhlavink@redhat.com> 20100621-1 - restore tty settings after timed out read (#573936) - fix stdin for double command substitution (#584704) - fix infinite loop when whence builtin is used with -q option (#587127) - ksh did not wait for pipeline to complete when pipefail option was used (#640379) - fix bug when here document got sometimes truncated (#644362) - completion used after an environment variable reported bad susbstituion error (#647524) - do not forget to restore file handles after execution of sourced script (#650998) - do not use invalid PID values in ksh kill built-in (#701890) - do not change $0 in posix function (#691933) - fix man page information about default value for PATH variable (#699641) - ksh child exit code not preserved correctly (#699823) - ulimit -v limits cpu instead of virtual memory (#712349) - wait was returning incorrect value (#726199) - fix crash when unsetting IFS inside a function (2nd reproducer) (#727891) - Apparent race condition when using pipes in KSH scripts (#736195) - lower resolution of file time comparison (#736462) - do not create extra process when calling function defined with function keyword (#739664) * Fri Jun 24 2011 Michal Hlavinka <mhlavink@redhat.com> 20100202-7 - do not count empty array elements (#690816) * Thu May 05 2011 Michal Hlavinka <mhlavink@redhat.com> 20100202-6 - fix bug when nested sourced script did not execute all commands (#698874) * Mon Mar 14 2011 Michal Hlaivnka <mhlavink@redhat.com> 20100202-5 - fix crash when unsetting IFS inside a function - don't forget to close files including auto loaded function definition - fix file io race condition when file was created, but still does not exist * Fri Feb 04 2011 Michal Hlavinka <mhlavink@redhat.com> 20100202-4 - fix crash when ksh get SIGPIPE while already executing signal handler - fix wrong output redirection in SIGPIPE trap - fix wrong typeset handling of arrays that could caused a crash * Wed Feb 02 2011 Michal Hlavinka <mhlavink@redhat.com> 20100202-3 - fix memory leak slowing executions of scripts (#586923) * Thu Aug 19 2010 Michal Hlavinka <mhlavink@redhat.com> 20100202-2 - add RLIMIT_RTPRIO and RLIMIT_NICE support to ulimit * Tue Feb 09 2010 Michal Hlavinka <mhlavink@redhat.com> 20100202-1 - updated to 20100202 stable version * Mon Dec 14 2009 Michal Hlavinka <mhlavink@redhat.com> 20091206-1 - updated to 20091211 - fix looped job list (#435159) - fix error code when unsetting a variable that was already unset (#508869) - restore shell state when return was used in .profile (#506790) - wait for output of background process after foreground's completed (#509326) - fix parser failure when alias nested in emacs mode (#513967) - don't mention unavailable commands in man pages (#514485) - ship RELEASE in doc as change log (#541654) * Wed Dec 02 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-15 - fix wrong array size caused by typeset (#538857) - fix pids of forked commands (#520383) - fix memcmp-memcpy typo causing syntax error (#538655) * Fri Jul 10 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-14 - fix typeset value assign in an asynchronously called function (#507562) * Tue Jun 09 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-13 - build with the logging ability (#502747) * Thu May 07 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-12 - make braces non-optional for ${a[i]} inside [[...]] in the case where the argument can be a pattern. * Thu Apr 16 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-11 - prevent rpmbuild creating debuginfo for %ghost files (#488798) - don't segfault for inaccessible history file (#494363) - add COMPATIBILITY file to the %%doc (#494534) - use old language catalog, because the new one is broken (#493570) * Wed Apr 01 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-10 - fix wrong OPTIND values after return from subshell - resolves: #443889 * Tue Mar 31 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-9 - fix link for man page - resolves: #488798 * Mon Mar 30 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-8 - fix initial link for alternatives - resolves: #488798 * Fri Mar 16 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-7 - fix unexpected behaviour of typeset [options] name=value - resolves: #489516 - fix alternatives for ksh update, when there wasn't alternatives yet * Fri Mar 06 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-6 - update chkconfig - resolves: #488798 * Fri Mar 06 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-5 - fix #488798 - use 'alternatives' for ksh switching - fix #485030 - Umask value not restored when returning from a subshell - fix #488934 - ksh does not declare shell variables with hyphen * Tue Feb 23 2009 Michal Hlavinka <mhlavink@redhat.com> 20080202-4 - fix #465438 - builtins do not report errors on failed file operations * Tue Dec 02 2008 Michal Hlavinka <mhlavink@redhat.com> 20080202-3 - revert not working fix for #435159 * Wed Oct 01 2008 Tomas Smetana <tsmetana@redhat.com> 20080202-2 - fix #459228 - option -R not clear - fix #459566 - segfault on set -o vi - fix #456652 - exit shifts vi to background * Tue Jul 29 2008 Tomas Smetana <tsmetana@redhat.com> 20080202-1 - rebase to the new version - fix #371441 - can't display international characters - fix #429488 - ksh -R can cause segmentation fault - fix #435159 - scripts failing under ksh - fix #441557 - the -m option removed from the manual page * Thu Mar 13 2008 Tomas Smetana <tsmetana@redhat.com> 20060214-1.8 - fix #430955 - segaults on nget_optindex * Fri Jan 04 2008 Tomas Smetana <tsmetana@redhat.com> 20060214-1.7 - fix race condition in the exit19 patch that could cause a loss of a coprocess' exit value * Mon Dec 10 2007 Tomas Smetana <tsmetana@redhat.com> 20060214-1.6 - fix #250362 - update manpage about subscript of index array * Mon Aug 20 2007 Tomas Smetana <tsmetana@redhat.com> 20060214-1.5 - fix #242879 - memory leak - fix #232627 - call to exit(0) returns a status 19 to the calling shell script - fix #242878 - spins in stopped state - fix #243776 - ERR trap causes recursion - fix #219420 - unaligned access messages - fix #242877 - filesystem acl defaults are ignored - fix #278781 - fix handling of sigttou - fix #250362 - update manpage about subscript of index array * Tue Jan 16 2007 Phil Knirsch <pknirsch@redhat.com> 20060214-1.4 - Included fix for segfaults in subshells (#222654) * Fri Jan 12 2007 Karsten Hopp <karsten@redhat.com> 20060214-1.3 - Resolves: #222436 fix segfault on ppc * Thu Dec 21 2006 Karsten Hopp <karsten@redhat.com> 20060214-1.2 - Resolves: #220018 fix uname -m/-i output * Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 20060214-1.1 - rebuild * Thu Jun 01 2006 Karsten Hopp <karsten@redhat.de> 20060214-1 - new upstream source * Mon Feb 27 2006 Karsten Hopp <karsten@redhat.de> 20060124-3 - PreReq grep, coreutils (#182835) * Tue Feb 14 2006 Karsten Hopp <karsten@redhat.de> 20060124-2 - make it build in chroots (#180561) * Mon Feb 13 2006 Karsten Hopp <karsten@redhat.de> 20060124-1 - version 20060124 * Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 20050202-5.1 - bump again for double-long bug on ppc(64) * Fri Feb 10 2006 Karsten Hopp <karsten@redhat.de> 20050202-5 - rebuild * Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 20050202-4.1 - rebuilt for new gcc4.1 snapshot and glibc changes * Thu Feb 02 2006 Karsten Hopp <karsten@redhat.de> 20050202-4 - fix uname -i output - fix loop (*-path.patch) - conflict pdksh instead of obsoleting it * Fri Dec 16 2005 Jesse Keating <jkeating@redhat.com> 20050202-3.1 - rebuilt for new gcj * Tue May 10 2005 Karsten Hopp <karsten@redhat.de> 20050202-3 - enable debuginfo * Tue Mar 15 2005 Karsten Hopp <karsten@redhat.de> 20050202-2 - add /usr/bin/ksh link for compatibility with pdksh scripts (#151134) * Wed Mar 02 2005 Karsten Hopp <karsten@redhat.de> 20050202-1 - update and rebuild with gcc-4 * Tue Mar 01 2005 Karsten Hopp <karsten@redhat.de> 20041225-2 - fix gcc4 build * Fri Jan 21 2005 Karsten Hopp <karsten@redhat.de> 20041225-1 - rebuild with new ksh tarball (license change) * Tue Nov 02 2004 Karsten Hopp <karsten@redhat.de> 20040229-11 - disable ia64 for now * Fri Oct 15 2004 Karsten Hopp <karsten@redhat.de> 20040229-9 - rebuild * Thu Sep 02 2004 Nalin Dahyabhai <nalin@redhat.com> 20040229-8 - remove '&' from summary * Thu Sep 02 2004 Bill Nottingham <notting@redhat.com> 20040229-7 - obsolete pdksh (#131303) * Mon Aug 02 2004 Karsten Hopp <karsten@redhat.de> 20040229-6 - obsolete ksh93, provide ksh93 * Mon Jul 05 2004 Karsten Hopp <karsten@redhat.de> 20040229-3 - add /bin/ksh to /etc/shells * Wed Jun 16 2004 Karsten Hopp <karsten@redhat.de> 20040229-2 - add ppc64 patch to avoid ppc64 dot symbol problem * Fri May 28 2004 Karsten Hopp <karsten@redhat.de> 20040229-1 - initial version