eaf6cb5
%define _bindir   /bin
eaf6cb5
Summary:          MirBSD enhanced version of the Korn Shell
eaf6cb5
Name:             mksh
a2e7a9c
Version:          50
97e4a72
Release:          2%{?dist}
e2f293d
# BSD (setmode.c), ISC (strlcpy.c), MirOS (the rest)
e2f293d
License:          MirOS and ISC and BSD
eaf6cb5
Group:            System Environment/Shells
b3a1ea2
URL:              https://www.mirbsd.org/mksh.htm
30f711a
Source0:          https://www.mirbsd.org/MirOS/dist/mir/%{name}/%{name}-R%{version}.tgz
e2f293d
Source1:          dot-mkshrc
037b08e
Source2:          rtchecks.expected
eaf6cb5
Requires(post):   grep
e2f293d
Requires(postun): sed
b07ea31
BuildRequires:    util-linux, ed
eaf6cb5
BuildRoot:        %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
eaf6cb5
eaf6cb5
%description
eaf6cb5
mksh is the MirBSD enhanced version of the Public Domain Korn shell (pdksh),
eaf6cb5
a bourne-compatible shell which is largely similar to the original AT&T Korn
eaf6cb5
shell. It includes bug fixes and feature improvements in order to produce a
eaf6cb5
modern, robust shell good for interactive and especially script use, being a
eaf6cb5
bourne shell replacement, pdksh successor and an alternative to the C shell.
eaf6cb5
eaf6cb5
%prep
9854216
%setup -q -n %{name}
eaf6cb5
ee681d0
# we'll need this later
9854216
cat >rtchecks <<'EOF'
9854216
typeset -i sari=0
9854216
typeset -Ui uari=0
9854216
typeset -i x=0
ee681d0
print -r -- $((x++)):$sari=$uari. #0
9854216
let --sari --uari
ee681d0
print -r -- $((x++)):$sari=$uari. #1
9854216
sari=2147483647 uari=2147483647
ee681d0
print -r -- $((x++)):$sari=$uari. #2
9854216
let ++sari ++uari
ee681d0
print -r -- $((x++)):$sari=$uari. #3
9854216
let --sari --uari
9854216
let 'sari *= 2' 'uari *= 2'
9854216
let ++sari ++uari
ee681d0
print -r -- $((x++)):$sari=$uari. #4
9854216
let ++sari ++uari
ee681d0
print -r -- $((x++)):$sari=$uari. #5
9854216
sari=-2147483648 uari=-2147483648
ee681d0
print -r -- $((x++)):$sari=$uari. #6
9854216
let --sari --uari
ee681d0
print -r -- $((x++)):$sari=$uari. #7
ee681d0
(( sari = -5 >> 1 ))
ee681d0
((# uari = -5 >> 1 ))
ee681d0
print -r -- $((x++)):$sari=$uari. #8
ee681d0
(( sari = -2 ))
ee681d0
((# uari = sari ))
ee681d0
print -r -- $((x++)):$sari=$uari. #9
9854216
EOF
eaf6cb5
eaf6cb5
%build
968f662
# Work around RHBZ #922974 on Fedora 19 and later
968f662
%if 0%{?fedora} >= 19
ee681d0
CFLAGS="$RPM_OPT_FLAGS -DMKSH_DISABLE_EXPERIMENTAL" sh Build.sh -r
968f662
%else
ee681d0
CFLAGS="$RPM_OPT_FLAGS -DMKSH_DISABLE_EXPERIMENTAL" sh Build.sh -r -c lto
968f662
%endif
70f5739
cp test.sh test_mksh.sh
968f662
# Work around RHBZ #922974 on Fedora 19 and later
968f662
%if 0%{?fedora} >= 19
ee681d0
CFLAGS="$RPM_OPT_FLAGS -DMKSH_DISABLE_EXPERIMENTAL" sh Build.sh -L -r
968f662
%else
ee681d0
CFLAGS="$RPM_OPT_FLAGS -DMKSH_DISABLE_EXPERIMENTAL" sh Build.sh -L -r -c lto
968f662
%endif
70f5739
cp test.sh test_lksh.sh
eaf6cb5
eaf6cb5
%install
eaf6cb5
rm -rf $RPM_BUILD_ROOT
eaf6cb5
install -D -m 755 %{name} $RPM_BUILD_ROOT%{_bindir}/%{name}
70f5739
install -D -m 755 lksh $RPM_BUILD_ROOT%{_bindir}/lksh
eaf6cb5
install -D -m 644 %{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1
037b08e
install -D -m 644 lksh.1 $RPM_BUILD_ROOT%{_mandir}/man1/lksh.1
e2f293d
install -D -p -m 644 dot.mkshrc $RPM_BUILD_ROOT%{_sysconfdir}/mkshrc
e2f293d
install -D -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/skel/.mkshrc
eaf6cb5
eaf6cb5
%check
9854216
./mksh rtchecks >rtchecks.got 2>&1
037b08e
if ! cmp --quiet rtchecks.got %{SOURCE2}
9854216
then
9854216
  echo "rtchecks failed"
037b08e
  diff -Naurp %{SOURCE2} rtchecks.got
9854216
  exit 1
9854216
fi
9854216
70f5739
for tf in test_mksh.sh test_lksh.sh
70f5739
do
70f5739
  echo > test.wait
70f5739
  script -qc "./$tf"' -v; x=$?; rm -f test.wait; exit $x'
70f5739
  maxwait=0
70f5739
  while test -e test.wait; do
70f5739
    sleep 1
70f5739
    maxwait=$(expr $maxwait + 1)
70f5739
    test $maxwait -lt 900 || break
70f5739
  done
9f20604
done
eaf6cb5
eaf6cb5
%post
e2f293d
grep -q "^%{_bindir}/%{name}$" %{_sysconfdir}/shells 2>/dev/null || \
eaf6cb5
  echo "%{_bindir}/%{name}" >> %{_sysconfdir}/shells
eaf6cb5
eaf6cb5
%postun
eaf6cb5
if [ ! -x %{_bindir}/%{name} ]; then
e2f293d
  sed -e 's@^%{_bindir}/%{name}$@POSTUNREMOVE@' -e '/^POSTUNREMOVE$/d' -i %{_sysconfdir}/shells
eaf6cb5
fi
eaf6cb5
eaf6cb5
%clean
eaf6cb5
rm -rf $RPM_BUILD_ROOT
eaf6cb5
eaf6cb5
%files
c142085
%defattr(-,root,root,-)
8a4f27b
%doc dot.mkshrc
eaf6cb5
%{_bindir}/%{name}
70f5739
%{_bindir}/lksh
e2f293d
%config(noreplace) %{_sysconfdir}/mkshrc
e2f293d
%config(noreplace) %{_sysconfdir}/skel/.mkshrc
eaf6cb5
%{_mandir}/man1/%{name}.1*
70f5739
%{_mandir}/man1/lksh.1*
eaf6cb5
eaf6cb5
%changelog
97e4a72
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 50-2
97e4a72
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
97e4a72
a2e7a9c
* Thu Jul 03 2014 Robert Scheck <robert@fedoraproject.org> 50-1
a2e7a9c
- Upgrade to 50
a2e7a9c
0df96e9
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 49-2
0df96e9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
0df96e9
b3a1ea2
* Tue Jan 14 2014 Robert Scheck <robert@fedoraproject.org> 49-1
b3a1ea2
- Upgrade to 49
b3a1ea2
faab609
* Sun Aug 25 2013 Robert Scheck <robert@fedoraproject.org> 48b-1
faab609
- Upgrade to 48b
faab609
ef93752
* Sat Aug 03 2013 Robert Scheck <robert@fedoraproject.org> 47-1
ef93752
- Upgrade to 47
ef93752
c06572f
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 46-2
c06572f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
c06572f
037b08e
* Fri May 03 2013 Thorsten Glaser <tg@mirbsd.org> 46-1
037b08e
- Upgrade mksh to R46
037b08e
ee681d0
* Wed May 01 2013 Thorsten Glaser <tg@mirbsd.org> 45-1
ee681d0
- Upgrade mksh to R45 and the other files to the accompanying versions
ee681d0
- Drop workaround for GCC PR55009 (no longer needed)
ee681d0
- Use https for homepage
ee681d0
968f662
* Mon Mar 18 2013 Robert Scheck <robert@fedoraproject.org> 44-1
968f662
- Upgrade to 44 and work around bug in GCC 4.8 (#922974)
968f662
30780ef
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 41-2
30780ef
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
30780ef
9854216
* Mon Dec 03 2012 Michal Hlavinka <mhlavink@redhat.com> - 41-1
9854216
- Upgrade to 41
9854216
70f5739
* Fri Jul 20 2012 Michal Hlavinka <mhlavink@redhat.com> - 40i-0.20120630
70f5739
- Upgrade to pre-release of 40i
70f5739
- includes new legacy shell lksh for old scripts requiring pdksh or similar old
70f5739
  ksh-88 shell, see man lksh for differences
70f5739
2c26a0c
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 40d-3
2c26a0c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
2c26a0c
cbbcec1
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 40d-2
cbbcec1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
cbbcec1
c473ffd
* Sun Dec 11 2011 Robert Scheck <robert@fedoraproject.org> 40d-1
c473ffd
- Upgrade to 40d
c473ffd
16eae96
* Tue Nov 22 2011 Robert Scheck <robert@fedoraproject.org> 40c-1
16eae96
- Upgrade to 40c
16eae96
a43097b
* Thu Jul 28 2011 Robert Scheck <robert@fedoraproject.org> 40b-2
a43097b
- Use new "Build.sh -r -c lto" rather "Build.sh -r -combine"
a43097b
c271438
* Thu Jul 28 2011 Robert Scheck <robert@fedoraproject.org> 40b-1
c271438
- Upgrade to 40b
c271438
fe4e10b
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 39c-5
fe4e10b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
fe4e10b
a3f709b
* Tue Jan 04 2011 Michal Hlavinka <mhlavink@redhat.com> 39c-4
a3f709b
- fix crash when bad substitution is used
a3f709b
5f11470
* Wed Jul 21 2010 Michal Hlavinka <mhlavink@redhat.com> 39c-3
5f11470
- fix crash when alias contains alias
5f11470
- fix crash when xtrace is enabled
5f11470
e2f293d
* Sun Jul 11 2010 Robert Scheck <robert@fedoraproject.org> 39c-2
e2f293d
- Added default configuration /etc/mkshrc & /etc/skel/.mkshrc
e2f293d
  as default skel (like at bash; thanks to Michal Hlavinka)
e2f293d
- Corrected the license tag (thanks to Michal Hlavinka)
e2f293d
- Removed the arc4random.c file (upstream is phasing it out)
e2f293d
c142085
* Sat Feb 27 2010 Robert Scheck <robert@fedoraproject.org> 39c-1
c142085
- Upgrade to 39c and updated arc4random.c file
c142085
3c7016b
* Thu Aug 13 2009 Robert Scheck <robert@fedoraproject.org> 39-1
3c7016b
- Upgrade to 39 and updated arc4random.c file
3c7016b
3909539
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 38b-2
3909539
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
3909539
d2c52f7
* Sun May 31 2009 Robert Scheck <robert@fedoraproject.org> 38b-1
d2c52f7
- Upgrade to 38b
d2c52f7
8a4f27b
* Sun May 31 2009 Robert Scheck <robert@fedoraproject.org> 38-1
8a4f27b
- Upgrade to 38 and updated arc4random.c file
8a4f27b
- Used -combine (-fwhole-program) rather the old -j switch
8a4f27b
0d04dc8
* Sun Apr 05 2009 Robert Scheck <robert@fedoraproject.org> 37b-1
0d04dc8
- Upgrade to 37b
0d04dc8
eb6975b
* Mon Feb 23 2009 Robert Scheck <robert@fedoraproject.org> 36b-2
eb6975b
- Rebuild against gcc 4.4 and rpm 4.6
eb6975b
f3c9d1d
* Sun Dec 14 2008 Robert Scheck <robert@fedoraproject.org> 36b-1
f3c9d1d
- Upgrade to 36b and updated arc4random.c file
f3c9d1d
58cf9f6
* Tue Dec 02 2008 Robert Scheck <robert@fedoraproject.org> 36-2
58cf9f6
- Upstream patch for command hang/high cpu workload (#474115)
58cf9f6
be846bc
* Sat Oct 25 2008 Robert Scheck <robert@fedoraproject.org> 36-1
be846bc
- Upgrade to 36
be846bc
0f795b1
* Sat Jul 19 2008 Robert Scheck <robert@fedoraproject.org> 35b-1
0f795b1
- Upgrade to 35b
0f795b1
90ac14e
* Sun Jul 13 2008 Robert Scheck <robert@fedoraproject.org> 35-1
90ac14e
- Upgrade to 35
90ac14e
cdc3b30
* Sat Apr 12 2008 Robert Scheck <robert@fedoraproject.org> 33d-1
cdc3b30
- Upgrade to 33d
cdc3b30
4a8a846
* Fri Apr 04 2008 Robert Scheck <robert@fedoraproject.org> 33c-1
4a8a846
- Upgrade to 33c and updated arc4random.c file
4a8a846
0227da7
* Mon Mar 03 2008 Robert Scheck <robert@fedoraproject.org> 33-1
0227da7
- Upgrade to 33
0227da7
9ed6b26
* Sun Feb 10 2008 Robert Scheck <robert@fedoraproject.org> 32-2
9ed6b26
- Rebuild against gcc 4.3
9ed6b26
9f20604
* Sat Nov 10 2007 Robert Scheck <robert@fedoraproject.org> 32-1
9f20604
- Upgrade to 32
9f20604
- Solved fork problems in %%check (thanks to Thorsten Glaser)
9f20604
5d8bd45
* Mon Oct 15 2007 Robert Scheck <robert@fedoraproject.org> 31d-1
5d8bd45
- Upgrade to 31d
5d8bd45
b07ea31
* Wed Sep 12 2007 Robert Scheck <robert@fedoraproject.org> 31c-1
b07ea31
- Upgrade to 31c
b07ea31
- Added a buildrequirement to ed, added arc4random.c file
b07ea31
9254e33
* Tue Sep 11 2007 Robert Scheck <robert@fedoraproject.org> 31b-1
9254e33
- Upgrade to 31b
9254e33
- Use script to get %%check happy (thanks to Thorsten Glaser)
9254e33
c987a09
* Sat Sep 08 2007 Robert Scheck <robert@fedoraproject.org> 31-1
c987a09
- Upgrade to 31
c987a09
2d7354a
* Tue Aug 28 2007 Robert Scheck <robert@fedoraproject.org> 30-2
2d7354a
- Updated the license tag according to the guidelines
2d7354a
40990d7
* Sat Jul 28 2007 Robert Scheck <robert@fedoraproject.org> 30-1
40990d7
- Upgrade to 30
40990d7
835ef0f
* Sat Jul 14 2007 Robert Scheck <robert@fedoraproject.org> 29g-1
835ef0f
- Upgrade to 29g
835ef0f
eaf6cb5
* Sun Jun 03 2007 Robert Scheck <robert@fedoraproject.org> 29f-1
eaf6cb5
- Upgrade to 29f
eaf6cb5
- Initial spec file for Fedora and Red Hat Enterprise Linux