package created by autospec [release 20110208-1mamba;Sat Feb 12 2011]

This commit is contained in:
gil 2024-01-06 02:55:10 +01:00
parent 7ea598e97c
commit be90895332
7 changed files with 257 additions and 0 deletions

View File

@ -1,2 +1,7 @@
# ksh # ksh
KSH-93 is the most recent version of the Korn Shell by David Korn of
AT&T Bell Laboratories.
Korn Shell is a shell programming language, which is upward compatible
with "sh" (the Bourne Shell).

8
dotkshrc Normal file
View File

@ -0,0 +1,8 @@
# .kshrc
# Source global definitions
if [ -f /etc/kshrc ]; then
. /etc/kshrc
fi
# User specific aliases and functions

0
expectedresults.log Normal file
View File

View File

@ -0,0 +1,32 @@
diff -up ksh-20100924/src/cmd/ksh93/data/builtins.c.builtins ksh-20100924/src/cmd/ksh93/data/builtins.c
--- ksh-20100924/src/cmd/ksh93/data/builtins.c.builtins 2010-08-10 20:58:54.000000000 +0200
+++ ksh-20100924/src/cmd/ksh93/data/builtins.c 2010-10-08 18:08:35.118675557 +0200
@@ -125,20 +125,28 @@ const struct shtable3 shtab_builtins[] =
#ifdef SHOPT_CMDLIB_HDR
#include SHOPT_CMDLIB_HDR
#else
+#if 1
CMDLIST(basename)
CMDLIST(chmod)
CMDLIST(dirname)
CMDLIST(getconf)
CMDLIST(head)
+#if 0
+does not work when ACLs are used
CMDLIST(mkdir)
+#endif
CMDLIST(logname)
+#if 1
+//does not work in chrooted environments, because /dev/fd/? is missing
CMDLIST(cat)
+#endif
CMDLIST(cmp)
CMDLIST(cut)
CMDLIST(uname)
CMDLIST(wc)
CMDLIST(sync)
#endif
+#endif
#if SHOPT_REGRESS
"__regress__", NV_BLTIN|BLT_ENV, bltin(__regress__),
#endif

View File

@ -0,0 +1,59 @@
diff -up ksh-20101122/src/cmd/ksh93/tests/builtins.sh.fixregr ksh-20101122/src/cmd/ksh93/tests/builtins.sh
--- ksh-20101122/src/cmd/ksh93/tests/builtins.sh.fixregr 2010-10-27 08:52:38.000000000 +0200
+++ ksh-20101122/src/cmd/ksh93/tests/builtins.sh 2010-11-26 10:17:05.653551931 +0100
@@ -291,9 +291,9 @@ then err_exit "printf '%..*s' not workin
fi
[[ $(printf '%q\n') == '' ]] || err_exit 'printf "%q" with missing arguments'
# we won't get hit by the one second boundary twice, right?
-[[ $(printf '%T\n' now) == "$(date)" ]] ||
-[[ $(printf '%T\n' now) == "$(date)" ]] ||
-err_exit 'printf "%T" now'
+[[ $(printf '%T\n' now | sed 's/GMT/UTC/') == "$(date)" ]] ||
+[[ $(printf '%T\n' now | sed 's/GMT/UTC/') == "$(date)" ]] ||
+err_exit 'printf "%T" now = '"$(printf '%T\n' now) != $(date)"
behead()
{
read line
diff -up ksh-20101122/src/cmd/ksh93/tests/locale.sh.fixregr ksh-20101122/src/cmd/ksh93/tests/locale.sh
--- ksh-20101122/src/cmd/ksh93/tests/locale.sh.fixregr 2010-11-13 01:29:23.000000000 +0100
+++ ksh-20101122/src/cmd/ksh93/tests/locale.sh 2010-11-26 10:08:17.334737934 +0100
@@ -104,6 +104,7 @@ if (( $($SHELL -c $'export LC_ALL='$loca
then LC_ALL=$locale $SHELL -c b1=$'"\342\202\254\342\202\254\342\202\254\342\202\254w\342\202\254\342\202\254\342\202\254\342\202\254"; [[ ${b1:4:1} == w ]]' || err_exit 'multibyte ${var:offset:len} not working correctly'
fi
+locale=en_US.UTF-8
#$SHELL -c 'export LANG='$locale'; printf "\u[20ac]\u[20ac]" > $tmp/two_euro_chars.txt'
printf $'\342\202\254\342\202\254' > $tmp/two_euro_chars.txt
exp="6 2 6"
@@ -111,11 +112,11 @@ set -- $($SHELL -c "
unset LC_CTYPE
export LANG=$locale
export LC_ALL=C
- command wc -C < $tmp/two_euro_chars.txt
+ command wc -m < $tmp/two_euro_chars.txt
unset LC_ALL
- command wc -C < $tmp/two_euro_chars.txt
+ command wc -m < $tmp/two_euro_chars.txt
export LC_ALL=C
- command wc -C < $tmp/two_euro_chars.txt
+ command wc -m < $tmp/two_euro_chars.txt
")
got=$*
[[ $got == $exp ]] || err_exit "command wc LC_ALL default failed -- expected '$exp', got '$got'"
@@ -134,6 +135,8 @@ set -- $($SHELL -c "
got=$*
[[ $got == $exp ]] || err_exit "builtin wc LC_ALL default failed -- expected '$exp', got '$got'"
+locale=C_EU.UTF-8
+
# multibyte char straddling buffer boundary
{
@@ -190,6 +193,7 @@ do exp=$1
done
# setocale(LC_ALL,"") after setlocale() initialization
+locale=en_US.UTF-8
printf 'f1\357\274\240f2\n' > input1
printf 't2\357\274\240f1\n' > input2

113
ksh.spec Normal file
View File

@ -0,0 +1,113 @@
%define pkg_version %(echo %version | tr . - )
Name: ksh
Version: 2011.02.08
Release: 1mamba
Summary: The Original ATT Korn Shell
Group: Applications/Shells
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.kornshell.com/
Source0: http://www2.research.att.com/~gsf/download/tgz/ast-ksh.%{pkg_version}.tgz
Source1: http://www2.research.att.com/~gsf/download/tgz/INIT.%{pkg_version}.tgz
# from fedora
Source2: dotkshrc
Source3: kshrc.mamba
Source4: expectedresults.log
Patch0: ksh-20070328-builtins.patch
Patch1: ksh-20100826-fixregr.patch
License: Common Public License Version 1.0
BuildRequires: bison
BuildRequires: diffutils
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
## AUTOBUILDREQ-END
BuildRequires: procps
Requires: coreutils
Requires: grep
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
KSH-93 is the most recent version of the Korn Shell by David Korn of
AT&T Bell Laboratories.
Korn Shell is a shell programming language, which is upward compatible
with "sh" (the Bourne Shell).
%prep
%setup -q -c %{name}-%{version}
%setup -q -T -D -a 1
%patch0 -p1
%patch1 -p1
sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options
%build
./bin/package
./bin/package make mamake ||:
./bin/package make mamake ||:
export CCFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CC=gcc
./bin/package "make"
cp lib/package/LICENSES/ast LICENSE
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
mkdir -p %{buildroot}{/bin,%{_bindir},%{_mandir}/man1}
install -c -m 755 arch/*/bin/ksh %{buildroot}/bin/ksh
install -c -m 755 arch/*/bin/shcomp %{buildroot}%{_bindir}/shcomp
install -c -m 644 arch/*/man/man1/sh.1 %{buildroot}%{_mandir}/man1/ksh.1
mkdir -p %{buildroot}%{_sysconfdir}/skel
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/skel/.kshrc
install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/kshrc
%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
sed -e '/begins at/d' -e '/ 0 error/d' -e 's/at [^\[]*\[/\[/' testresults.log -e '/tests skipped/d' >filteredresults.log
if ! cmp filteredresults.log %{SOURCE4} >/dev/null || ls core.*
then
echo "Regression tests failed (ignoring)"
diff -Naurp %{SOURCE4} filteredresults.log || true
# exit -1
fi
:
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post
if [ ! -f %{_sysconfdir}/shells ]; then
echo "/bin/ksh" > %{_sysconfdir}/shells
else
if ! grep -q '^/bin/ksh$' %{_sysconfdir}/shells ; then
echo "/bin/ksh" >> %{_sysconfdir}/shells
fi
fi
%postun
if [ ! -f /bin/ksh ]; then
sed -i '/^\/bin\/ksh$/ d' %{_sysconfdir}/shells
fi
%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/skel/.kshrc
%config(noreplace) %{_sysconfdir}/kshrc
/bin/ksh
%{_bindir}/shcomp
%{_mandir}/man1/ksh.1.gz
%doc LICENSE README
%changelog
* Sat Feb 12 2011 gil <puntogil@libero.it> 20110208-1mamba
- package created by autospec

40
kshrc.mamba Normal file
View File

@ -0,0 +1,40 @@
#
# /etc/kshrc is sourced in interactive shells. It
# should contain commands to set up aliases, functions,
# options, key bindings, etc.
#
# Set prompts
#PROMPT='[%n@%m]%~%# ' # default prompt
#RPROMPT=' %~' # prompt for right side of screen
_src_etc_profile_d()
{
# from zshrc, with ksh fixes
if [[ ! -o login ]]; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
fi
}
pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ]; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}
_src_etc_profile_d
unset -f _src_etc_profile_d
unset -f pathmunge