From d2b09f5207ba7354cacdf0f93e206c7e771de713 Mon Sep 17 00:00:00 2001 From: Lev Kujawski Date: Thu, 11 Feb 2021 21:39:56 -0700 Subject: [PATCH] Upgrade the Korn shell to the new upstream The Korn shell 2020 project has ground to a halt and AT&T has reverted its changes due to numerous unfixed performance regressions and bugs. The new Korn shell project at github.com/ksh93/ksh has restarted development with a focus on bug fixing and preserving Korn shell functionality. --- ...s-when-dev-tty-is-broken-such-as-on-.patch | 40 +++++++++++++++ srcpkgs/ksh/template | 51 ++++++++----------- 2 files changed, 61 insertions(+), 30 deletions(-) create mode 100644 srcpkgs/ksh/patches/0004-Skip-comsub-tests-when-dev-tty-is-broken-such-as-on-.patch diff --git a/srcpkgs/ksh/patches/0004-Skip-comsub-tests-when-dev-tty-is-broken-such-as-on-.patch b/srcpkgs/ksh/patches/0004-Skip-comsub-tests-when-dev-tty-is-broken-such-as-on-.patch new file mode 100644 index 00000000000..1927d37429b --- /dev/null +++ b/srcpkgs/ksh/patches/0004-Skip-comsub-tests-when-dev-tty-is-broken-such-as-on-.patch @@ -0,0 +1,40 @@ +From 8dda3d1d8cd27ed312f4a605d71d0f95fffa3eb5 Mon Sep 17 00:00:00 2001 +From: Lev Kujawski +Date: Fri, 12 Feb 2021 00:38:47 -0700 +Subject: [PATCH 4/4] Skip comsub tests when /dev/tty is broken, such as on CI + servers + +src/cmd/ksh93/tests/bracket.sh: +- Test for the existence of /dev/tty as a writable character device + and skip comsub tests in its absence. +- Issue a diagnostic if tests are skipped. +--- + src/cmd/ksh93/tests/bracket.sh | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/cmd/ksh93/tests/bracket.sh b/src/cmd/ksh93/tests/bracket.sh +index 02d76d6..cb83e52 100755 +--- a/src/cmd/ksh93/tests/bracket.sh ++++ b/src/cmd/ksh93/tests/bracket.sh +@@ -388,6 +388,10 @@ actual=$(echo begin; [ -n X -a -t ] || test -n X -a -t && echo -t is true; echo + [[ $actual == "$expect" ]] || err_exit 'test -t in comsub fails (compound expression)' \ + "(expected $(printf %q "$expect"), got $(printf %q "$actual"))" + ++if [[ ! -c /dev/tty ]] || [[ ! -w /dev/tty ]] ++then ++ print -u2 "\t${Command}[$LINENO]: warning: /dev/tty broken: skipping comsub tests" ++else + # This is the more complex case that does redirect stdout within the command substitution to the + # actual tty. Thus the [ -t 1 ] test should be true. + actual=$(echo begin; exec >/dev/tty; [ -t 1 ] && test -t 1 && [[ -t 1 ]]) \ +@@ -399,6 +403,7 @@ actual=$(echo begin; exec >/dev/tty; [ -t ] && test -t) \ + || err_exit 'test -t in comsub with exec >/dev/tty fails' + actual=$(echo begin; exec >/dev/tty; [ -n X -a -t ] && test -n X -a -t) \ + || err_exit 'test -t in comsub with exec >/dev/tty fails (compound expression)' ++fi + + # The POSIX mode should disable the ancient 'test -t' compatibility hack. + if [[ -o ?posix ]] +-- +2.24.3 (Apple Git-128) + diff --git a/srcpkgs/ksh/template b/srcpkgs/ksh/template index 2709dacc0b0..0232b8454f8 100644 --- a/srcpkgs/ksh/template +++ b/srcpkgs/ksh/template @@ -1,16 +1,15 @@ # Template file for 'ksh' pkgname=ksh -version=2020.0.0 -revision=1 -wrksrc="ast-${version}" -build_style=meson -configure_args="-Dbuild-api-tests=false -Dbuild-api-tests-only=true" +version=1.0.0a +revision=2 +_commit="37a18bab7173427ce045c9a67772cb98eb678cb7" +wrksrc="${pkgname}-${_commit}" short_desc="AT&T's Korn shell (ksh93)" maintainer="Leah Neukirchen " license="EPL-1.0" homepage="http://www.kornshell.com/" -distfiles="https://github.com/att/ast/archive/${version}.tar.gz" -checksum=76597c96c4f94423b9225b5de50ea54be08d5bbaa1e0e594a7eec603bd60ecaf +distfiles="https://github.com/ksh93/ksh/archive/${_commit}.tar.gz" +checksum=2ec6700a3c1ef688409a9339acb745e72902717b9e719e7937cdcccaa140e16d nocross=yes register_shell="/bin/ksh" @@ -19,30 +18,22 @@ alternatives=" ksh:ksh.1:/usr/share/man/man1/ksh93.1 " -build_options="static" -if [ "$build_option_static" ]; then - LDFLAGS+=" -static" -fi - -case "$XBPS_TARGET_MACHINE" in -*-musl) - makedepends+=" musl-fts-devel" -esac +do_build() { + ./bin/package make +} -post_extract() { - sed -i -e 's/= library/= static_library/' \ - -e 's/install: true/install: false/' src/lib/*/meson.build - sed -i 's/vpoi/void*/g' src/cmd/ksh93/include/name.h - if [ "$build_option_static" ]; then - # Drop tests that use .so - sed -i '/some tests/,$d' src/cmd/ksh93/meson.build - sed -i '/libsample_files/,$d' src/lib/libdll/meson.build - fi +do_check() { + ./bin/shtests } -post_install() { - mv ${DESTDIR}/usr/bin/ksh ${DESTDIR}/usr/bin/ksh93 - mv ${DESTDIR}/usr/share/man/man1/ksh.1 ${DESTDIR}/usr/share/man/man1/ksh93.1 + +do_install() { + ARCH=$(./bin/package) + vmkdir usr/bin + mv arch/${ARCH}/bin/ksh ${DESTDIR}/usr/bin/ksh93 + vmkdir usr/share/man/man1 + mv arch/${ARCH}/man/man1/sh.1 ${DESTDIR}/usr/share/man/man1/ksh93.1 vmkdir usr/share/ksh - vcopy src/cmd/ksh93/fun usr/share/ksh/functions - vlicense LICENSE + vcopy arch/${ARCH}/fun usr/share/ksh/functions + rmdir ${DESTDIR}/usr/lib + vlicense LICENSE.md }