diff -Nru mksh-57/Build.sh mksh-58/Build.sh --- mksh-57/Build.sh 2019-03-01 16:18:40.000000000 +0000 +++ mksh-58/Build.sh 2020-03-27 10:16:19.000000000 +0000 @@ -1,8 +1,9 @@ #!/bin/sh -srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.734 2019/03/01 16:18:13 tg Exp $' +srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.752 2020/03/27 10:15:52 tg Exp $' #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012, 2013, 2014, 2015, 2016, 2017 +# 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019, +# 2020 # mirabilos # # Provided that these terms and disclaimer and all copyright notices @@ -25,8 +26,8 @@ # # Used environment documentation is at the end of this file. -LC_ALL=C -export LC_ALL +LC_ALL=C; LANGUAGE=C +export LC_ALL; unset LANGUAGE case $ZSH_VERSION:$VERSION in :zsh*) ZSH_VERSION=2 ;; @@ -53,6 +54,15 @@ alln=0123456789 alls=______________________________________________________________ +test_n() { + test x"$1" = x"" || return 0 + return 1 +} + +test_z() { + test x"$1" = x"" +} + case `echo a | tr '\201' X` in X) # EBCDIC build system @@ -64,11 +74,11 @@ esac genopt_die() { - if test -n "$1"; then - echo >&2 "E: $*" - echo >&2 "E: in '$srcfile': '$line'" - else + if test_z "$1"; then echo >&2 "E: invalid input in '$srcfile': '$line'" + else + echo >&2 "E: $*" + echo >&2 "N: in '$srcfile': '$line'" fi rm -f "$bn.gen" exit 1 @@ -172,9 +182,9 @@ esac IFS= read line || genopt_die Unexpected EOF IFS=$safeIFS - test -n "$cond" && o_gen=$o_gen$nl"$cond" + test_z "$cond" || o_gen=$o_gen$nl"$cond" o_gen=$o_gen$nl"$line, $optc)" - test -n "$cond" && o_gen=$o_gen$nl"#endif" + test_z "$cond" || o_gen=$o_gen$nl"#endif" ;; esac done @@ -185,11 +195,11 @@ esac echo "$o_str" | sort | while IFS='|' read x opts cond; do IFS=$safeIFS - test -n "$x" || continue + test_n "$x" || continue genopt_scond - test -n "$cond" && echo "$cond" + test_z "$cond" || echo "$cond" echo "\"$opts\"" - test -n "$cond" && echo "#endif" + test_z "$cond" || echo "#endif" done | { echo "$o_hdr" echo "#ifndef $o_sym$o_gen" @@ -234,7 +244,7 @@ rmf() { for _f in "$@"; do case $_f in - Build.sh|check.pl|check.t|dot.mkshrc|*.1|*.c|*.h|*.ico|*.opt) ;; + *.1|*.ico) ;; *) rm -f "$_f" ;; esac done @@ -343,7 +353,7 @@ test $ct = pcc && vscan='unsupported' test $ct = sunpro && vscan='-e ignored -e turned.off' fi - test -n "$vscan" && grep $vscan vv.out >/dev/null 2>&1 && fv=$fr + test_n "$vscan" && grep $vscan vv.out >/dev/null 2>&1 && fv=$fr return 0 } ac_testn() { @@ -406,10 +416,8 @@ test x"$ft" = x"" && ft="if $f can be used" save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $f" - if test -n "$fl"; then - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS $fl" - fi + save_LDFLAGS=$LDFLAGS + test_z "$fl" || LDFLAGS="$LDFLAGS $fl" if test 1 = $hf; then ac_testn can_$vn '' "$ft" else @@ -421,9 +429,7 @@ #' fi eval fv=\$HAVE_CAN_`upper $vn` - if test -n "$fl"; then - test 11 = $fa$fv || LDFLAGS=$save_LDFLAGS - fi + test_z "$fl" || test 11 = $fa$fv || LDFLAGS=$save_LDFLAGS test 11 = $fa$fv || CFLAGS=$save_CFLAGS } @@ -512,7 +518,7 @@ for i do case $last:$i in - c:combine|c:dragonegg|c:llvm|c:lto) + c:dragonegg|c:llvm) cm=$i last= ;; @@ -524,10 +530,6 @@ optflags=$i last= ;; - t:*) - tfn=$i - last= - ;; :-c) last=c ;; @@ -573,9 +575,6 @@ :+T) textmode=0 ;; - :-t) - last=t - ;; :-v) echo "Build.sh $srcversion" echo "for mksh $dstversion" @@ -591,12 +590,12 @@ ;; esac done -if test -n "$last"; then +if test_n "$last"; then echo "$me: Option -'$last' not followed by argument!" >&2 exit 1 fi -test -z "$tfn" && if test $legacy = 0; then +test_n "$tfn" || if test $legacy = 0; then tfn=mksh else tfn=lksh @@ -606,7 +605,7 @@ exit 1 fi rmf a.exe* a.out* conftest.c conftest.exe* *core core.* ${tfn}* *.bc *.dbg \ - *.ll *.o *.gen *.cat1 Rebuild.sh lft no signames.inc test.sh x vv.out + *.ll *.o *.gen *.cat1 Rebuild.sh lft no signames.inc test.sh x vv.out *.htm SRCS="lalloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c jobs.c" SRCS="$SRCS lex.c main.c misc.c shf.c syn.c tree.c var.c" @@ -634,17 +633,17 @@ else CPPFLAGS="-I. -I'$srcdir' $CPPFLAGS" fi -test -n "$LDSTATIC" && if test -n "$LDFLAGS"; then - LDFLAGS="$LDFLAGS $LDSTATIC" -else +test_z "$LDSTATIC" || if test_z "$LDFLAGS"; then LDFLAGS=$LDSTATIC +else + LDFLAGS="$LDFLAGS $LDSTATIC" fi -if test -z "$TARGET_OS"; then +if test_z "$TARGET_OS"; then x=`uname -s 2>/dev/null || uname` test x"$x" = x"`uname -n 2>/dev/null`" || TARGET_OS=$x fi -if test -z "$TARGET_OS"; then +if test_z "$TARGET_OS"; then echo "$me: Set TARGET_OS, your uname is broken!" >&2 exit 1 fi @@ -652,7 +651,7 @@ ccpc=-Wc, ccpl=-Wl, tsts= -ccpr='|| for _f in ${tcfn}*; do case $_f in Build.sh|check.pl|check.t|dot.mkshrc|*.1|*.c|*.h|*.ico|*.opt) ;; *) rm -f "$_f" ;; esac; done' +ccpr='|| for _f in ${tcfn}*; do case $_f in *.1|*.ico) ;; *) rm -f "$_f" ;; esac; done' # Evil hack if test x"$TARGET_OS" = x"Android"; then @@ -706,12 +705,12 @@ # Configuration depending on OS revision, on OSes that need them case $TARGET_OS in NEXTSTEP) - test x"$TARGET_OSREV" = x"" && TARGET_OSREV=`hostinfo 2>&1 | \ + test_n "$TARGET_OSREV" || TARGET_OSREV=`hostinfo 2>&1 | \ grep 'NeXT Mach [0-9][0-9.]*:' | \ sed 's/^.*NeXT Mach \([0-9][0-9.]*\):.*$/\1/'` ;; QNX|SCO_SV) - test x"$TARGET_OSREV" = x"" && TARGET_OSREV=`uname -r` + test_n "$TARGET_OSREV" || TARGET_OSREV=`uname -r` ;; esac @@ -847,6 +846,11 @@ LynxOS) oswarn="; it has minor issues" ;; +midipix) + add_cppflags -D_GNU_SOURCE + # their Perl (currently…) identifies as os:linux ☹ + check_categories="$check_categories os:midipix" + ;; MidnightBSD) ;; Minix-vmd) @@ -1037,11 +1041,11 @@ # generic target for SVR4 Unix with uname -s = uname -n # this duplicates the * target below oswarn='; it may or may not work' - test x"$TARGET_OSREV" = x"" && TARGET_OSREV=`uname -r` + test_n "$TARGET_OSREV" || TARGET_OSREV=`uname -r` ;; *) oswarn='; it may or may not work' - test x"$TARGET_OSREV" = x"" && TARGET_OSREV=`uname -r` + test_n "$TARGET_OSREV" || TARGET_OSREV=`uname -r` ;; esac @@ -1084,11 +1088,12 @@ vv '|' "uname -a >&2" ;; esac -test -z "$oswarn" || echo >&2 " +test_z "$oswarn" || echo >&2 " Warning: mksh has not yet been ported to or tested on your operating system '$TARGET_OS'$oswarn. If you can provide a shell account to the developer, this may improve; please -drop us a success or failure notice or even send in diffs. +drop us a success or failure notice or even send in diffs, +at the very least, complete logs (Build.sh + test.sh) will help. " $e "$bi$me: Building the MirBSD Korn Shell$ao $ui$dstversion$ao on $TARGET_OS ${TARGET_OSREV}..." @@ -1115,6 +1120,10 @@ ct="xlc" #elif defined(__SUNPRO_C) ct="sunpro" +#elif defined(__neatcc__) +ct="neatcc" +#elif defined(__lacc__) +ct="lacc" #elif defined(__ACK__) ct="ack" #elif defined(__BORLANDC__) @@ -1230,9 +1239,8 @@ ;; gcc) vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS" - vv '|' 'echo `$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS \ - -dumpmachine` gcc`$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN \ - $LIBS -dumpversion`' + vv '|' 'eval echo "\`$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -dumpmachine\`" \ + "gcc\`$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -dumpversion\`"' : "${HAVE_STRING_POOLING=i2}" ;; hpcc) @@ -1250,6 +1258,9 @@ kencc) vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS" ;; +lacc) + # no version information + ;; lcc) vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS" add_cppflags -D__inline__=__inline @@ -1266,21 +1277,27 @@ ccpr= # errorlevels are not reliable case $TARGET_OS in Interix) - if [[ -n $C89_COMPILER ]]; then - C89_COMPILER=`ntpath2posix -c "$C89_COMPILER"` - else + if test_z "$C89_COMPILER"; then C89_COMPILER=CL.EXE - fi - if [[ -n $C89_LINKER ]]; then - C89_LINKER=`ntpath2posix -c "$C89_LINKER"` else + C89_COMPILER=`ntpath2posix -c "$C89_COMPILER"` + fi + if test_z "$C89_LINKER"; then C89_LINKER=LINK.EXE + else + C89_LINKER=`ntpath2posix -c "$C89_LINKER"` fi vv '|' "$C89_COMPILER /HELP >&2" vv '|' "$C89_LINKER /LINK >&2" ;; esac ;; +neatcc) + add_cppflags -DMKSH_DONT_EMIT_IDSTRING + add_cppflags -DMKSH_NO_SIGSETJMP + add_cppflags -Dsig_atomic_t=int + vv '|' "$CC" + ;; nwcc) vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -version" ;; @@ -1333,7 +1350,7 @@ *) test x"$ct" = x"untested" && $e "!!! detecting preprocessor failed" ct=unknown - vv "$CC --version" + vv '|' "$CC --version" vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS" vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -V conftest.c $LIBS" ;; @@ -1376,14 +1393,14 @@ case $ct in dec) CFLAGS="$CFLAGS ${ccpl}-non_shared" - ac_testn can_delexe compiler_fails 0 'for the -non_shared linker option' <<-EOF + ac_testn can_delexe compiler_fails 0 'for the -non_shared linker option' <<-'EOF' #include int main(void) { return (isatty(0)); } EOF ;; dmc) CFLAGS="$CFLAGS ${ccpl}/DELEXECUTABLE" - ac_testn can_delexe compiler_fails 0 'for the /DELEXECUTABLE linker option' <<-EOF + ac_testn can_delexe compiler_fails 0 'for the /DELEXECUTABLE linker option' <<-'EOF' #include int main(void) { return (isatty(0)); } EOF @@ -1393,9 +1410,8 @@ ;; esac test 1 = $HAVE_CAN_DELEXE || CFLAGS=$save_CFLAGS - ac_testn compiler_still_fails '' 'if the compiler still does not fail correctly' <<-EOF - EOF - test 1 = $HAVE_COMPILER_STILL_FAILS && exit 1 + ac_ifcpp 'if 0' compiler_still_fails \ + 'if the compiler still does not fail correctly' && exit 1 fi if ac_ifcpp 'ifdef __TINYC__' couldbe_tcc '!' compiler_known 0 \ 'if this could be tcc'; then @@ -1478,7 +1494,7 @@ # i=`echo :"$orig_CFLAGS" | sed 's/^://' | tr -c -d $alll$allu$alln` # optimisation: only if orig_CFLAGS is empty -test x"$i" = x"" && case $ct in +test_n "$i" || case $ct in hpcc) phase=u ac_flags 1 otwo +O2 @@ -1526,6 +1542,7 @@ ac_flags 1 schk "${ccpc}-s" 'for stack overflow checking' ;; gcc) + ac_flags 1 fnolto -fno-lto 'whether we can explicitly disable buggy GCC LTO' -fno-lto # The following tests run with -Werror (gcc only) if possible NOWARN=$DOWARN; phase=u ac_flags 1 wnodeprecateddecls -Wno-deprecated-declarations @@ -1708,7 +1725,7 @@ #undef fprintf extern int fprintf(FILE *, const char *format, ...) __attribute__((__format__(__printf__, 2, 3))); - int main(int ac, char **av) { return (fprintf(stderr, "%s%d", *av, ac)); } + int main(int ac, char *av[]) { return (fprintf(stderr, "%s%d", *av, ac)); } #endif EOF ac_test attribute_noreturn '' 'for __attribute__((__noreturn__))' <<-'EOF' @@ -1733,7 +1750,7 @@ #include #undef __attribute__ int foo(const char *) __attribute__((__pure__)); - int main(int ac, char **av) { return (foo(av[ac - 1]) + isatty(0)); } + int main(int ac, char *av[]) { return (foo(av[ac - 1]) + isatty(0)); } int foo(const char *s) { return ((int)s[0]); } #endif EOF @@ -1745,7 +1762,7 @@ #else #include #undef __attribute__ - int main(int ac __attribute__((__unused__)), char **av + int main(int ac __attribute__((__unused__)), char *av[] __attribute__((__unused__))) { return (isatty(0)); } #endif EOF @@ -1863,22 +1880,22 @@ ac_test can_inttypes '!' stdint_h 1 "for standard 32-bit integer types" <<-'EOF' #include #include - int main(int ac, char **av) { return ((uint32_t)(size_t)*av + (int32_t)ac); } + int main(int ac, char *av[]) { return ((uint32_t)(size_t)*av + (int32_t)ac); } EOF ac_test can_ucbints '!' can_inttypes 1 "for UCB 32-bit integer types" <<-'EOF' #include #include - int main(int ac, char **av) { return ((u_int32_t)(size_t)*av + (int32_t)ac); } + int main(int ac, char *av[]) { return ((u_int32_t)(size_t)*av + (int32_t)ac); } EOF ac_test can_int8type '!' stdint_h 1 "for standard 8-bit integer type" <<-'EOF' #include #include - int main(int ac, char **av) { return ((uint8_t)(size_t)av[ac]); } + int main(int ac, char *av[]) { return ((uint8_t)(size_t)av[ac]); } EOF ac_test can_ucbint8 '!' can_int8type 1 "for UCB 8-bit integer type" <<-'EOF' #include #include - int main(int ac, char **av) { return ((u_int8_t)(size_t)av[ac]); } + int main(int ac, char *av[]) { return ((u_int8_t)(size_t)av[ac]); } EOF ac_test rlim_t <<-'EOF' @@ -1948,7 +1965,11 @@ #define MKSH_INCLUDES_ONLY #include "sh.h" __RCSID("$srcversion"); - int main(void) { printf("Hello, World!\\n"); return (isatty(0)); } + int main(void) { + struct timeval tv; + printf("Hello, World!\\n"); + return (time(&tv.tv_sec)); + } EOF case $cm in llvm) @@ -2005,15 +2026,15 @@ for what in name list; do uwhat=`upper $what` - ac_testn sys_sig$what '' "the sys_sig${what}[] array" <<-EOF - extern const char * const sys_sig${what}[]; + ac_testn sys_sig$what '' "the sys_sig$what[] array" <<-EOF + extern const char * const sys_sig$what[]; extern int isatty(int); - int main(void) { return (sys_sig${what}[0][0] + isatty(0)); } + int main(void) { return (sys_sig$what[0][0] + isatty(0)); } EOF - ac_testn _sys_sig$what '!' sys_sig$what 0 "the _sys_sig${what}[] array" <<-EOF - extern const char * const _sys_sig${what}[]; + ac_testn _sys_sig$what '!' sys_sig$what 0 "the _sys_sig$what[] array" <<-EOF + extern const char * const _sys_sig$what[]; extern int isatty(int); - int main(void) { return (_sys_sig${what}[0][0] + isatty(0)); } + int main(void) { return (_sys_sig$what[0][0] + isatty(0)); } EOF eval uwhat_v=\$HAVE__SYS_SIG$uwhat if test 1 = "$uwhat_v"; then @@ -2265,6 +2286,17 @@ int main(void) { return (sys_siglist[0][0] + isatty(0)); } EOF +ac_test st_mtim '' 'for struct stat.st_mtim.tv_nsec' <<-'EOF' + #define MKSH_INCLUDES_ONLY + #include "sh.h" + int main(void) { struct stat sb; return (sizeof(sb.st_mtim.tv_nsec)); } +EOF +ac_test st_mtimensec '!' st_mtim 0 'for struct stat.st_mtimensec' <<-'EOF' + #define MKSH_INCLUDES_ONLY + #include "sh.h" + int main(void) { struct stat sb; return (sizeof(sb.st_mtimensec)); } +EOF + # # other checks # @@ -2429,7 +2461,7 @@ addsrcs USE_PRINTF_BUILTIN printf.c test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose" -add_cppflags -DMKSH_BUILD_R=571 +add_cppflags -DMKSH_BUILD_R=581 $e $bi$me: Finished configuration testing, now producing output.$ao @@ -2452,7 +2484,10 @@ cat >test.sh <<-EOF $mkshshebang LC_ALL=C PATH='$PATH'; export LC_ALL PATH - test -n "\$KSH_VERSION" || exit 1 + case \$KSH_VERSION in + *MIRBSD*|*LEGACY*) ;; + *) exit 1 ;; + esac set -A check_categories -- $check_categories pflag='$curdir/$mkshexe' sflag='$srcdir/check.t' @@ -2614,8 +2649,8 @@ NONSRCS_INST= dot.mkshrc \$(MAN) NONSRCS_NOINST= Build.sh Makefile Rebuild.sh check.pl check.t test.sh CC= $CC -CFLAGS= $CFLAGS CPPFLAGS= $CPPFLAGS +CFLAGS= $CFLAGS LDFLAGS= $LDFLAGS LIBS= $LIBS @@ -2685,6 +2720,7 @@ test -f $tcfn || exit 1 test 1 = $r || v "$NROFF -mdoc <'$srcdir/lksh.1' >lksh.cat1" || rmf lksh.cat1 test 1 = $r || v "$NROFF -mdoc <'$srcdir/mksh.1' >mksh.cat1" || rmf mksh.cat1 +test 1 = $r || v "(set -- ''; . '$srcdir/FAQ2HTML.sh')" || rmf FAQ.htm test 0 = $eq && v $SIZE $tcfn i=install test -f /usr/ucb/$i && i=/usr/ucb/$i @@ -2698,7 +2734,13 @@ fi $e $e Installing the manual: +if test -e FAQ.htm; then + $e "# $i -c -o root -g bin -m 444 FAQ.htm /usr/share/doc/mksh/" +fi if test -f mksh.cat1; then + if test -e FAQ.htm; then + $e plus either + fi $e "# $i -c -o root -g bin -m 444 lksh.cat1" \ "/usr/share/man/cat1/lksh.0" $e "# $i -c -o root -g bin -m 444 mksh.cat1" \ @@ -2709,6 +2751,8 @@ $e $e Run the regression test suite: ./test.sh $e Please also read the sample file dot.mkshrc and the fine manual. +test -e FAQ.htm || \ + $e Run FAQ2HTML.sh and place FAQ.htm into a suitable location as well. exit 0 : <<'EOD' @@ -2740,6 +2784,7 @@ ==== cpp definitions ==== DEBUG dont use in production, wants gcc, implies: DEBUG_LEAKS enable freeing resources before exiting +KSH_VERSIONNAME_VENDOR_EXT when patching; space+plus+word (e.g. " +SuSE") MKSHRC_PATH "~/.mkshrc" (do not change) MKSH_A4PB force use of arc4random_pushb MKSH_ASSUME_UTF8 (0=disabled, 1=enabled; default: unset) @@ -2768,6 +2813,7 @@ MKSH_TYPEDEF_SIG_ATOMIC_T define to e.g. 'int' if sig_atomic_t is missing MKSH_TYPEDEF_SSIZE_T define to e.g. 'long' if your OS has no ssize_t MKSH_UNEMPLOYED disable job control (but not jobs/co-processes) +USE_REALLOC_MALLOC define as 0 to not use realloc as malloc === generic installation instructions === @@ -2777,15 +2823,15 @@ MKSH_SMALL but with Vi mode, add -DMKSH_S_NOVI=0 to CPPFLAGS as well. Normally, the following command is what you want to run, then: -$ (sh Build.sh -r -c lto && ./test.sh -f) 2>&1 | tee log +$ (sh Build.sh -r && ./test.sh -f) 2>&1 | tee log Copy dot.mkshrc to /etc/skel/.mkshrc; install mksh into $prefix/bin; or /bin; install the manpage, if omitting the -r flag a catmanpage is made using $NROFF. Consider using a forward script as /etc/skel/.mkshrc like -http://anonscm.debian.org/cgit/collab-maint/mksh.git/plain/debian/.mkshrc +https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=alioth/mksh.git;a=blob;f=debian/.mkshrc and put dot.mkshrc as /etc/mkshrc so users need not keep up their HOME. You may also want to install the lksh binary (also as /bin/sh) built by: -$ CPPFLAGS="$CPPFLAGS -DMKSH_BINSHPOSIX" sh Build.sh -L -r -c lto +$ CPPFLAGS="$CPPFLAGS -DMKSH_BINSHPOSIX" sh Build.sh -L -r EOD diff -Nru mksh-57/check.pl mksh-58/check.pl --- mksh-57/check.pl 2017-05-05 21:17:58.000000000 +0000 +++ mksh-58/check.pl 2019-08-01 20:06:22.000000000 +0000 @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.pl,v 1.49 2017/05/05 21:17:31 tg Exp $ +# $MirOS: src/bin/mksh/check.pl,v 1.50 2019/08/01 20:05:55 tg Exp $ # $OpenBSD: th,v 1.1 2013/12/02 20:39:44 millert Exp $ #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, @@ -292,7 +292,7 @@ # Set up a very minimal environment %new_env = (); foreach $env (('HOME', 'LD_LIBRARY_PATH', 'LOCPATH', 'LOGNAME', - 'PATH', 'SHELL', 'UNIXMODE', 'UNIXROOT', 'USER')) { + 'PATH', 'PERLIO', 'SHELL', 'UNIXMODE', 'UNIXROOT', 'USER')) { $new_env{$env} = $ENV{$env} if defined $ENV{$env}; } $new_env{'CYGWIN'} = 'nodosfilewarning'; diff -Nru mksh-57/check.t mksh-58/check.t --- mksh-57/check.t 2019-03-01 16:17:56.000000000 +0000 +++ mksh-58/check.t 2020-03-27 09:57:33.000000000 +0000 @@ -1,9 +1,9 @@ -# $MirOS: src/bin/mksh/check.t,v 1.812 2019/03/01 16:17:29 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.833 2020/03/27 09:57:06 tg Exp $ # -*- mode: sh -*- #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, -# 2019 +# 2019, 2020 # mirabilos # # Provided that these terms and disclaimer and all copyright notices @@ -31,20 +31,29 @@ # (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date expected-stdout: - @(#)MIRBSD KSH R57 2019/03/01 + KSH R58 2020/03/27 description: Check base version of full shell stdin: - echo ${KSH_VERSION%%' +'*} + vsn=${KSH_VERSION%%' +'*} + echo "${vsn#* }" name: KSH_VERSION +--- +expected-stdout: + @(#)MIRBSD +description: + Check this identifies as legacy shell +stdin: + echo "${KSH_VERSION%% *}" +name: KSH_VERSION-modern category: !shell:legacy-yes --- expected-stdout: - @(#)LEGACY KSH R57 2019/03/01 + @(#)LEGACY description: - Check base version of legacy shell + Check this identifies as legacy shell stdin: - echo ${KSH_VERSION%%' +'*} + echo "${KSH_VERSION%% *}" name: KSH_VERSION-legacy category: !shell:legacy-no --- @@ -53,6 +62,7 @@ Check that the shell version tag does not include EBCDIC category: !shell:ebcdic-yes stdin: + set -o noglob for x in $KSH_VERSION; do [[ $x = '+EBCDIC' ]] && exit 1 done @@ -63,6 +73,7 @@ Check that the shell version tag includes EBCDIC category: !shell:ebcdic-no stdin: + set -o noglob for x in $KSH_VERSION; do [[ $x = '+EBCDIC' ]] && exit 0 done @@ -73,6 +84,7 @@ Check that the shell version tag does not include TEXTMODE category: !shell:textmode-yes stdin: + set -o noglob for x in $KSH_VERSION; do [[ $x = '+TEXTMODE' ]] && exit 1 done @@ -83,6 +95,7 @@ Check that the shell version tag includes TEXTMODE category: !shell:textmode-no stdin: + set -o noglob for x in $KSH_VERSION; do [[ $x = '+TEXTMODE' ]] && exit 0 done @@ -178,7 +191,7 @@ expected-stdout: ok expected-stderr-pattern: - /mksh: warning: won't have full job control\nXX/ + /ksh: warning: won't have full job control\nXX/ --- name: selftest-tty-present description: @@ -1392,7 +1405,7 @@ # the mv command fails on Cygwin and z/OS # Hurd aborts the testsuite (permission denied) # QNX does not find subdir to cd into -category: !os:cygwin,!os:gnu,!os:msys,!os:nto,!os:os390,!nosymlink +category: !os:cygwin,!os:gnu,!os:midipix,!os:msys,!os:nto,!os:os390,!nosymlink file-setup: file 644 "x" mkdir noread noread/target noread/target/subdir ln -s noread link @@ -1999,7 +2012,7 @@ name: eglob-bad-1 description: Check that globbing isn't done when glob has syntax error -category: !os:cygwin,!os:msys,!os:os2 +category: !os:cygwin,!os:midipix,!os:msys,!os:os2 file-setup: file 644 "@(a[b|)c]foo" stdin: echo @(a[b|)c]* @@ -2491,7 +2504,7 @@ # breaks on Mac OSX (HFS+ non-standard UTF-8 canonical decomposition) # breaks on Cygwin 1.7 (files are now UTF-16 or something) # breaks on QNX 6.4.1 (says RT) -category: !os:cygwin,!os:darwin,!os:msys,!os:nto,!os:os2,!os:os390 +category: !os:cygwin,!os:midipix,!os:darwin,!os:msys,!os:nto,!os:os2,!os:os390 need-pass: no file-setup: file 644 "ac" stdin: @@ -2526,6 +2539,19 @@ -bc abc bbc cbc ebc @bc --- +name: glob-range-6 +description: + ksh93 fails this but POSIX probably demands it +file-setup: file 644 "abc" +file-setup: file 644 "cbc" +stdin: + echo *b* + [ '*b*' = *b* ] && echo yep; echo $? +expected-stdout: + abc cbc + 2 +expected-stderr-pattern: /.*/ +--- name: glob-word-1 description: Check BSD word boundary matches @@ -2721,7 +2747,7 @@ h\b done --- -name: heredoc-9a +name: heredoc-9 description: Check that here strings work. stdin: @@ -2736,6 +2762,19 @@ tr abcdefghijklmnopqrstuvwxyz nopqrstuvwxyzabcdefghijklm <<<"$(echo "foo bar")" tr abcdefghijklmnopqrstuvwxyz nopqrstuvwxyzabcdefghijklm <<<"A $(echo "foo bar") B" tr abcdefghijklmnopqrstuvwxyz nopqrstuvwxyzabcdefghijklm <<<\$b\$b$bar + fnord=42 + bar="bar + \$fnord baz" + tr abcdefghijklmnopqrstuvwxyz nopqrstuvwxyzabcdefghijklm <<<$bar + tr abcdefghijklmnopqrstuvwxyz nopqrstuvwxyzabcdefghijklm <<< bar + echo $(tr r z <<<'bar' 2>/dev/null) + cat <<< "$( : )aa" + IFS=$'\n' + x=(a "b c") + tr ac 12 <<< ${x[*]} + tr ac 34 <<< "${x[*]}" + tr ac 56 <<< ${x[@]} + tr ac 78 <<< "${x[@]}" expected-stdout: sbb sbb @@ -2748,54 +2787,17 @@ A sbb one B $o$oone onm ---- -name: heredoc-9b -description: - Check that a corner case of here strings works like bash -stdin: - fnord=42 - bar="bar - \$fnord baz" - tr abcdefghijklmnopqrstuvwxyz nopqrstuvwxyzabcdefghijklm <<<$bar -expected-stdout: - one $sabeq onm -category: bash ---- -name: heredoc-9c -description: - Check that a corner case of here strings works like ksh93, zsh -stdin: - fnord=42 - bar="bar - \$fnord baz" - tr abcdefghijklmnopqrstuvwxyz nopqrstuvwxyzabcdefghijklm <<<$bar -expected-stdout: one $sabeq onm ---- -name: heredoc-9d -description: - Check another corner case of here strings -stdin: - tr abcdefghijklmnopqrstuvwxyz nopqrstuvwxyzabcdefghijklm <<< bar -expected-stdout: one ---- -name: heredoc-9e -description: - Check here string related regression with multiple iops -stdin: - echo $(tr r z <<<'bar' 2>/dev/null) -expected-stdout: baz ---- -name: heredoc-9f -description: - Check long here strings -stdin: - cat <<< "$( : )aa" -expected-stdout: aa + 1 + b 2 + 3 + b 4 + 5 b 6 + 7 b 8 --- name: heredoc-10 description: @@ -4981,6 +4983,17 @@ var=onetwo threefour . --- +name: IFS-subst-11 +description: + Check leading non-whitespace after trim makes only one field +stdin: + showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; } + v="foo!one!two!three" + IFS="!" + showargs x ${v:3} y +expected-stdout: + <> . +--- name: IFS-arith-1 description: http://austingroupbugs.net/view.php?id=832 @@ -6653,12 +6666,35 @@ description: Check if test -nt/-ot succeeds if second(first) file is missing. stdin: + matrix() { + local a b c d e f g h + test a -nt b; a=$? + test b -nt a; b=$? + test a -ot b; c=$? + test b -ot a; d=$? + test a -nt a; e=$? + test b -nt b; f=$? + test a -ot a; g=$? + test b -ot b; h=$? + echo $1 $a $b $c $d / $e $f $g $h . + } + matrix a :>a - test a -nt b && echo nt OK || echo nt BAD - test b -ot a && echo ot OK || echo ot BAD -expected-stdout: - nt OK - ot OK + matrix b + sleep 1 + :>b + matrix c + sleep 1 + :>a + matrix d + rm a + matrix e +expected-stdout: + a 1 1 1 1 / 1 1 1 1 . + b 0 1 1 0 / 1 1 1 1 . + c 1 0 0 1 / 1 1 1 1 . + d 0 1 1 0 / 1 1 1 1 . + e 1 0 0 1 / 1 1 1 1 . --- name: regression-63 description: @@ -7118,13 +7154,13 @@ name: exec-function-environment-1 description: Check assignments in function calls and whether they affect - the current execution environment (ksh93, SUSv4) + the current execution environment stdin: f() { a=2; }; g() { b=3; echo y$c-; }; a=1 f; b=2; c=1 g echo x$a-$b- z$c- expected-stdout: y1- - x2-3- z1- + x-3- z- --- name: exec-modern-korn-shell description: @@ -7389,6 +7425,8 @@ name: xxx-stat-1 description: Check that tests on files are consistent + (fails when run as root, unfortunately) +category: disabled stdin: mkdir a echo x >a/b @@ -7761,6 +7799,32 @@ 1 ok expected-exit: 1 --- +name: exit-err-10 +description: + Debian #269067 (cf. regression-38 but with eval) +arguments: !-e! +stdin: + eval false || true + echo = $? . +expected-stdout: + = 0 . +--- +name: exit-err-11 +description: + Fix -e inside eval, from Martijn Dekker; expected-stdout from ksh93 +stdin: + "$__progname" -c 'eval '\''echo ${-//[!eh]}; false; echo phantom e'\''; echo x$?' + echo = $? + "$__progname" -ec 'eval '\''echo ${-//[!eh]}; false; echo phantom e'\''; echo x$?' + echo = $? +expected-stdout: + h + phantom e + x0 + = 0 + eh + = 1 +--- name: exit-enoent-1 description: SUSv4 says that the shell should exit with 126/127 in some situations @@ -7832,11 +7896,9 @@ --- name: exit-trap-2 description: - Check that ERR and EXIT traps are run just like ksh93 does. - GNU bash does not run ERtrap in ±e eval-undef but runs it - twice (bug?) in +e eval-false, so does ksh93 (bug?), which - also has a bug to continue execution (echoing "and out" and - returning 0) in +e eval-undef. + Check that ERR and EXIT traps are run just like GNU bash does. + ksh93 runs ERtrap after “parameter null or not set” (which mksh + used to do) but (bug) continues “and out”, exit 0, in +e eval-undef. file-setup: file 644 "x" v=; unset v trap 'echo EXtrap' EXIT @@ -7920,7 +7982,6 @@ = eval-false 1 . and run ${v?} x: v: parameter null or not set - ERtrap EXtrap = eval-undef 1 . and run true @@ -7942,12 +8003,12 @@ = eval-true 0 . and run false ERtrap + ERtrap and out EXtrap = eval-false 0 . and run ${v?} x: v: parameter null or not set - ERtrap EXtrap = eval-undef 1 . and run true @@ -8672,7 +8733,7 @@ note: Ultrix perl5 t4 returns 65280 (exit-code 255) and no text XXX fails when LD_PRELOAD is set with -e and Perl chokes it (ASan) need-pass: no -category: !os:cygwin,!os:msys,!os:ultrix,!os:uwin-nt,!smksh +category: !os:cygwin,!os:midipix,!os:msys,!os:ultrix,!os:uwin-nt,!smksh env-setup: !FOO=BAR! stdin: print '#!'"$__progname"'\nprint "1 a=$ENV{FOO}";' >t1 @@ -9621,8 +9682,7 @@ --- name: varexpand-substr-3 description: - Check that some things that work in bash fail. - This is by design. Oh and vice versa, nowadays. + Match bash5 stdin: export x=abcdefghi n=2 "$__progname" -c 'echo v${x:(n)}x' @@ -9630,15 +9690,15 @@ "$__progname" -c 'echo x${x:n}x' "$__progname" -c 'echo y${x:}x' "$__progname" -c 'echo z${x}x' - # next fails only in bash - "$__progname" -c 'x=abcdef;y=123;echo ${x:${y:2:1}:2}' >/dev/null 2>&1; echo $? + "$__progname" -c 'x=abcdef;y=123;echo q${x:${y:2:1}:2}q' expected-stdout: vcdefghix wcdefghix + xcdefghix zabcdefghix - 0 + qdeq expected-stderr-pattern: - /x:n.*bad substitution.*\n.*bad substitution/ + /x:}.*bad substitution/ --- name: varexpand-substr-4 description: @@ -10841,6 +10901,43 @@ expected-stdout: okay --- +name: ulimit-3 +description: + Check that there are no duplicate limits (if this fails, + immediately contact with system information the developers) +stdin: + [[ -z $(set | grep ^opt) ]]; mis=$? + set | grep ^opt | sed 's/^/unexpectedly set in environment: /' + opta='' + optH='' + optS='' + ulimit -a >tmpf + set -o noglob + while IFS= read -r line; do + x=${line:1:1} + if [[ -z $x || ${#x}/${%x} != 1/1 ]]; then + print -r -- "weird line: $line" + (( mis |= 1 )) + continue + fi + set -- $line + nameref v=opt$x + if [[ -n $v ]]; then + print -r -- "duplicate -$x \"$2\" already seen as \"$v\"" + (( mis |= 2 )) + fi + v=$2 + done &1 | sed -e 's/^[^]]*]//' -e 's/^[^:]*: *//' + ) 2>&1 | sed -e 's/^[A-Za-z]://' -e 's/^[^]]*]//' -e 's/^[^:]*: *//' exit ${PIPESTATUS[0]} expected-stdout: y @@ -13238,7 +13335,7 @@ Crashed during March 2011, fixed on vernal equinōx ☺ category: os:mirbsd,os:openbsd stdin: - export MALLOC_OPTIONS=FGJPRSX + export MALLOC_OPTIONS=FGJRSX "$__progname" -c 'x=$(tr z r << "; done; echo .; } + showargs 1 "$@" + set -- foo bar baz + showargs 2 "$@" + command set -- miau 'meow nyao' + showargs 3 "$@" +expected-stdout: + <1> . + <2> . + <3> . +--- +name: command-readonly +description: + These should not exit on error when prefixed +stdin: + exec 2>/dev/null + "$__progname" -c 'readonly v; export v=foo || echo ok' + echo ef=$? + "$__progname" -c 'readonly v; command export v=foo || echo ok' + echo en=$? + "$__progname" -c 'readonly v; readonly v=foo || echo ok' + echo rf=$? + "$__progname" -c 'readonly v; command readonly v=foo || echo ok' + echo rn=$? +expected-stdout: + ef=2 + ok + en=0 + rf=2 + ok + rn=0 +--- +name: command-dot-regression +description: + Check a regression in fixing the above does not appear +stdin: + cat >test.mksh <<\EOF + set -- one two + shift + for s_arg in "$#" "$@"; do echo -n "<$s_arg> "; done; echo . + EOF + "$__progname" -c '. ./test.mksh' dummy oh dear this is not good + echo = + "$__progname" -c 'command . ./test.mksh' dummy oh dear this is not good +expected-stdout: + <1> . + = + <1> . +--- name: command-pvV-posix-priorities description: For POSIX compatibility, command -v should find aliases and reserved diff -Nru mksh-57/debian/changelog mksh-58/debian/changelog --- mksh-57/debian/changelog 2020-03-14 01:29:40.000000000 +0000 +++ mksh-58/debian/changelog 2020-03-27 11:59:25.000000000 +0000 @@ -1,3 +1,17 @@ +mksh (58-1) unstable; urgency=medium + + * New upstream release + - [tg] Improve code performance, quality, robustness and correctness + - [multiplexd] Add vi mode PgDn, similar to PgUp doing history search + - [tg] Build.sh fixup unreliable test -n / -z + - [multiplexd] Correct documentation of vi mode @c + - [tg] Update to UCD 13.0.0 + - [tg] Use nanoseconds in test -nt / -ot (LP#1855325) + * Work around debhelper issue #908845 (Niels Thykier) + * Update lintian overrides + + -- Thorsten Glaser Fri, 27 Mar 2020 12:59:25 +0100 + mksh (57-7) unstable; urgency=low * Update from MirBSD CVS HEAD diff -Nru mksh-57/debian/copyright mksh-58/debian/copyright --- mksh-57/debian/copyright 2020-03-13 21:55:29.000000000 +0000 +++ mksh-58/debian/copyright 2020-03-27 11:46:15.000000000 +0000 @@ -2,7 +2,7 @@ Sat, 28 May 2005 22:02:17 +0000. It was downloaded from: -https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R57.tgz +https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R58.tgz It was updated via anonymous CVS over SSH from: server _anoncvs@anoncvs.mirbsd.org:/cvs @@ -31,10 +31,10 @@ 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 mirabilos -Copyright (c) 2015 - Daniel Richard G. Copyright (c) 2015, 2017 KO Myung-Hun +Copyright (c) 2015 + Daniel Richard G. Copyright (c) 2017 Giacomo Tesio All rights reserved. @@ -108,3 +108,36 @@ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Parts Copyright © 1991–2020 Unicode, Inc. All rights reserved. +Distributed under the Terms of Use in https://www.unicode.org/copyright.html. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Unicode data files and any associated documentation +(the "Data Files") or Unicode software and any associated documentation +(the "Software") to deal in the Data Files or Software +without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, and/or sell copies of +the Data Files or Software, and to permit persons to whom the Data Files +or Software are furnished to do so, provided that either +(a) this copyright and permission notice appear with all copies +of the Data Files or Software, or +(b) this copyright and permission notice appear in associated +Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT OF THIRD PARTY RIGHTS. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS +NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL +DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THE DATA FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in these Data Files or Software without prior +written authorization of the copyright holder. diff -Nru mksh-57/debian/mksh.lintian-overrides mksh-58/debian/mksh.lintian-overrides --- mksh-57/debian/mksh.lintian-overrides 2020-03-13 21:55:29.000000000 +0000 +++ mksh-58/debian/mksh.lintian-overrides 2020-03-27 11:59:24.000000000 +0000 @@ -15,3 +15,8 @@ # false positive, presence is tested mksh: missing-depends-on-sensible-utils + +# correct placement +mksh: executable-in-usr-lib usr/lib/diet/bin/mksh +mksh: executable-in-usr-lib usr/lib/klibc/bin/mksh +mksh: executable-in-usr-lib usr/lib/*-linux-musl/bin/mksh diff -Nru mksh-57/debian/patches/debian-changes mksh-58/debian/patches/debian-changes --- mksh-57/debian/patches/debian-changes 2020-03-14 01:29:40.000000000 +0000 +++ mksh-58/debian/patches/debian-changes 1970-01-01 00:00:00.000000000 +0000 @@ -1,4732 +0,0 @@ -Please review changes against upstream code using SCM, -see the Vcs-* tags in debian/control for its location. - ---- mksh-57.orig/Build.sh -+++ mksh-57/Build.sh -@@ -1,8 +1,9 @@ - #!/bin/sh --srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.734 2019/03/01 16:18:13 tg Exp $' -+srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.749 2020/02/03 22:25:12 tg Exp $' - #- - # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, --# 2011, 2012, 2013, 2014, 2015, 2016, 2017 -+# 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019, -+# 2020 - # mirabilos - # - # Provided that these terms and disclaimer and all copyright notices -@@ -25,8 +26,8 @@ srcversion='$MirOS: src/bin/mksh/Build.s - # - # Used environment documentation is at the end of this file. - --LC_ALL=C --export LC_ALL -+LC_ALL=C; LANGUAGE=C -+export LC_ALL; unset LANGUAGE - - case $ZSH_VERSION:$VERSION in - :zsh*) ZSH_VERSION=2 ;; -@@ -234,7 +235,7 @@ vq() { - rmf() { - for _f in "$@"; do - case $_f in -- Build.sh|check.pl|check.t|dot.mkshrc|*.1|*.c|*.h|*.ico|*.opt) ;; -+ *.1|*.ico) ;; - *) rm -f "$_f" ;; - esac - done -@@ -512,7 +513,7 @@ ebcdic=false - for i - do - case $last:$i in -- c:combine|c:dragonegg|c:llvm|c:lto) -+ c:dragonegg|c:llvm) - cm=$i - last= - ;; -@@ -524,10 +525,6 @@ do - optflags=$i - last= - ;; -- t:*) -- tfn=$i -- last= -- ;; - :-c) - last=c - ;; -@@ -573,9 +570,6 @@ do - :+T) - textmode=0 - ;; -- :-t) -- last=t -- ;; - :-v) - echo "Build.sh $srcversion" - echo "for mksh $dstversion" -@@ -606,7 +600,7 @@ if test -d $tfn || test -d $tfn.exe; the - exit 1 - fi - rmf a.exe* a.out* conftest.c conftest.exe* *core core.* ${tfn}* *.bc *.dbg \ -- *.ll *.o *.gen *.cat1 Rebuild.sh lft no signames.inc test.sh x vv.out -+ *.ll *.o *.gen *.cat1 Rebuild.sh lft no signames.inc test.sh x vv.out *.htm - - SRCS="lalloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c jobs.c" - SRCS="$SRCS lex.c main.c misc.c shf.c syn.c tree.c var.c" -@@ -652,7 +646,7 @@ oswarn= - ccpc=-Wc, - ccpl=-Wl, - tsts= --ccpr='|| for _f in ${tcfn}*; do case $_f in Build.sh|check.pl|check.t|dot.mkshrc|*.1|*.c|*.h|*.ico|*.opt) ;; *) rm -f "$_f" ;; esac; done' -+ccpr='|| for _f in ${tcfn}*; do case $_f in *.1|*.ico) ;; *) rm -f "$_f" ;; esac; done' - - # Evil hack - if test x"$TARGET_OS" = x"Android"; then -@@ -847,6 +841,11 @@ Linux) - LynxOS) - oswarn="; it has minor issues" - ;; -+midipix) -+ add_cppflags -D_GNU_SOURCE -+ # their Perl (currently…) identifies as os:linux ☹ -+ check_categories="$check_categories os:midipix" -+ ;; - MidnightBSD) - ;; - Minix-vmd) -@@ -1088,7 +1087,8 @@ test -z "$oswarn" || echo >&2 " - Warning: mksh has not yet been ported to or tested on your - operating system '$TARGET_OS'$oswarn. If you can provide - a shell account to the developer, this may improve; please --drop us a success or failure notice or even send in diffs. -+drop us a success or failure notice or even send in diffs, -+at the very least, complete logs (Build.sh + test.sh) will help. - " - $e "$bi$me: Building the MirBSD Korn Shell$ao $ui$dstversion$ao on $TARGET_OS ${TARGET_OSREV}..." - -@@ -1115,6 +1115,10 @@ ct="icc" - ct="xlc" - #elif defined(__SUNPRO_C) - ct="sunpro" -+#elif defined(__neatcc__) -+ct="neatcc" -+#elif defined(__lacc__) -+ct="lacc" - #elif defined(__ACK__) - ct="ack" - #elif defined(__BORLANDC__) -@@ -1230,9 +1234,8 @@ dmc) - ;; - gcc) - vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS" -- vv '|' 'echo `$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS \ -- -dumpmachine` gcc`$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN \ -- $LIBS -dumpversion`' -+ vv '|' 'eval echo "\`$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -dumpmachine\`" \ -+ "gcc\`$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -dumpversion\`"' - : "${HAVE_STRING_POOLING=i2}" - ;; - hpcc) -@@ -1250,6 +1253,9 @@ icc) - kencc) - vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS" - ;; -+lacc) -+ # no version information -+ ;; - lcc) - vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS" - add_cppflags -D__inline__=__inline -@@ -1281,6 +1287,12 @@ msc) - ;; - esac - ;; -+neatcc) -+ add_cppflags -DMKSH_DONT_EMIT_IDSTRING -+ add_cppflags -DMKSH_NO_SIGSETJMP -+ add_cppflags -Dsig_atomic_t=int -+ vv '|' "$CC" -+ ;; - nwcc) - vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -version" - ;; -@@ -1333,7 +1345,7 @@ xlc) - *) - test x"$ct" = x"untested" && $e "!!! detecting preprocessor failed" - ct=unknown -- vv "$CC --version" -+ vv '|' "$CC --version" - vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS" - vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -V conftest.c $LIBS" - ;; -@@ -1376,14 +1388,14 @@ if ac_ifcpp 'if 0' compiler_fails '' \ - case $ct in - dec) - CFLAGS="$CFLAGS ${ccpl}-non_shared" -- ac_testn can_delexe compiler_fails 0 'for the -non_shared linker option' <<-EOF -+ ac_testn can_delexe compiler_fails 0 'for the -non_shared linker option' <<-'EOF' - #include - int main(void) { return (isatty(0)); } - EOF - ;; - dmc) - CFLAGS="$CFLAGS ${ccpl}/DELEXECUTABLE" -- ac_testn can_delexe compiler_fails 0 'for the /DELEXECUTABLE linker option' <<-EOF -+ ac_testn can_delexe compiler_fails 0 'for the /DELEXECUTABLE linker option' <<-'EOF' - #include - int main(void) { return (isatty(0)); } - EOF -@@ -1393,9 +1405,8 @@ if ac_ifcpp 'if 0' compiler_fails '' \ - ;; - esac - test 1 = $HAVE_CAN_DELEXE || CFLAGS=$save_CFLAGS -- ac_testn compiler_still_fails '' 'if the compiler still does not fail correctly' <<-EOF -- EOF -- test 1 = $HAVE_COMPILER_STILL_FAILS && exit 1 -+ ac_ifcpp 'if 0' compiler_still_fails \ -+ 'if the compiler still does not fail correctly' && exit 1 - fi - if ac_ifcpp 'ifdef __TINYC__' couldbe_tcc '!' compiler_known 0 \ - 'if this could be tcc'; then -@@ -1526,6 +1537,7 @@ dmc) - ac_flags 1 schk "${ccpc}-s" 'for stack overflow checking' - ;; - gcc) -+ ac_flags 1 fnolto -fno-lto 'whether we can explicitly disable buggy GCC LTO' -fno-lto - # The following tests run with -Werror (gcc only) if possible - NOWARN=$DOWARN; phase=u - ac_flags 1 wnodeprecateddecls -Wno-deprecated-declarations -@@ -1708,7 +1720,7 @@ ac_test attribute_format '' 'for __attri - #undef fprintf - extern int fprintf(FILE *, const char *format, ...) - __attribute__((__format__(__printf__, 2, 3))); -- int main(int ac, char **av) { return (fprintf(stderr, "%s%d", *av, ac)); } -+ int main(int ac, char *av[]) { return (fprintf(stderr, "%s%d", *av, ac)); } - #endif - EOF - ac_test attribute_noreturn '' 'for __attribute__((__noreturn__))' <<-'EOF' -@@ -1733,7 +1745,7 @@ ac_test attribute_pure '' 'for __attribu - #include - #undef __attribute__ - int foo(const char *) __attribute__((__pure__)); -- int main(int ac, char **av) { return (foo(av[ac - 1]) + isatty(0)); } -+ int main(int ac, char *av[]) { return (foo(av[ac - 1]) + isatty(0)); } - int foo(const char *s) { return ((int)s[0]); } - #endif - EOF -@@ -1745,7 +1757,7 @@ ac_test attribute_unused '' 'for __attri - #else - #include - #undef __attribute__ -- int main(int ac __attribute__((__unused__)), char **av -+ int main(int ac __attribute__((__unused__)), char *av[] - __attribute__((__unused__))) { return (isatty(0)); } - #endif - EOF -@@ -1863,22 +1875,22 @@ rmf lft* # end of large file support tes - ac_test can_inttypes '!' stdint_h 1 "for standard 32-bit integer types" <<-'EOF' - #include - #include -- int main(int ac, char **av) { return ((uint32_t)(size_t)*av + (int32_t)ac); } -+ int main(int ac, char *av[]) { return ((uint32_t)(size_t)*av + (int32_t)ac); } - EOF - ac_test can_ucbints '!' can_inttypes 1 "for UCB 32-bit integer types" <<-'EOF' - #include - #include -- int main(int ac, char **av) { return ((u_int32_t)(size_t)*av + (int32_t)ac); } -+ int main(int ac, char *av[]) { return ((u_int32_t)(size_t)*av + (int32_t)ac); } - EOF - ac_test can_int8type '!' stdint_h 1 "for standard 8-bit integer type" <<-'EOF' - #include - #include -- int main(int ac, char **av) { return ((uint8_t)(size_t)av[ac]); } -+ int main(int ac, char *av[]) { return ((uint8_t)(size_t)av[ac]); } - EOF - ac_test can_ucbint8 '!' can_int8type 1 "for UCB 8-bit integer type" <<-'EOF' - #include - #include -- int main(int ac, char **av) { return ((u_int8_t)(size_t)av[ac]); } -+ int main(int ac, char *av[]) { return ((u_int8_t)(size_t)av[ac]); } - EOF - - ac_test rlim_t <<-'EOF' -@@ -1948,7 +1960,11 @@ else - #define MKSH_INCLUDES_ONLY - #include "sh.h" - __RCSID("$srcversion"); -- int main(void) { printf("Hello, World!\\n"); return (isatty(0)); } -+ int main(void) { -+ struct timeval tv; -+ printf("Hello, World!\\n"); -+ return (time(&tv.tv_sec)); -+ } - EOF - case $cm in - llvm) -@@ -2005,15 +2021,15 @@ ac_cppflags SYS_ERRLIST - - for what in name list; do - uwhat=`upper $what` -- ac_testn sys_sig$what '' "the sys_sig${what}[] array" <<-EOF -- extern const char * const sys_sig${what}[]; -+ ac_testn sys_sig$what '' "the sys_sig$what[] array" <<-EOF -+ extern const char * const sys_sig$what[]; - extern int isatty(int); -- int main(void) { return (sys_sig${what}[0][0] + isatty(0)); } -+ int main(void) { return (sys_sig$what[0][0] + isatty(0)); } - EOF -- ac_testn _sys_sig$what '!' sys_sig$what 0 "the _sys_sig${what}[] array" <<-EOF -- extern const char * const _sys_sig${what}[]; -+ ac_testn _sys_sig$what '!' sys_sig$what 0 "the _sys_sig$what[] array" <<-EOF -+ extern const char * const _sys_sig$what[]; - extern int isatty(int); -- int main(void) { return (_sys_sig${what}[0][0] + isatty(0)); } -+ int main(void) { return (_sys_sig$what[0][0] + isatty(0)); } - EOF - eval uwhat_v=\$HAVE__SYS_SIG$uwhat - if test 1 = "$uwhat_v"; then -@@ -2614,8 +2630,8 @@ INDSRCS= $extras - NONSRCS_INST= dot.mkshrc \$(MAN) - NONSRCS_NOINST= Build.sh Makefile Rebuild.sh check.pl check.t test.sh - CC= $CC --CFLAGS= $CFLAGS - CPPFLAGS= $CPPFLAGS -+CFLAGS= $CFLAGS - LDFLAGS= $LDFLAGS - LIBS= $LIBS - -@@ -2685,6 +2701,7 @@ test $cm = combine || v "$CC $CFLAGS $LD - test -f $tcfn || exit 1 - test 1 = $r || v "$NROFF -mdoc <'$srcdir/lksh.1' >lksh.cat1" || rmf lksh.cat1 - test 1 = $r || v "$NROFF -mdoc <'$srcdir/mksh.1' >mksh.cat1" || rmf mksh.cat1 -+test 1 = $r || v "(set -- ''; . '$srcdir/FAQ2HTML.sh')" || rmf FAQ.htm - test 0 = $eq && v $SIZE $tcfn - i=install - test -f /usr/ucb/$i && i=/usr/ucb/$i -@@ -2698,7 +2715,13 @@ if test $legacy = 0; then - fi - $e - $e Installing the manual: -+if test -e FAQ.htm; then -+ $e "# $i -c -o root -g bin -m 444 FAQ.htm /usr/share/doc/mksh/" -+fi - if test -f mksh.cat1; then -+ if test -e FAQ.htm; then -+ $e plus either -+ fi - $e "# $i -c -o root -g bin -m 444 lksh.cat1" \ - "/usr/share/man/cat1/lksh.0" - $e "# $i -c -o root -g bin -m 444 mksh.cat1" \ -@@ -2709,6 +2732,8 @@ $e "# $i -c -o root -g bin -m 444 lksh.1 - $e - $e Run the regression test suite: ./test.sh - $e Please also read the sample file dot.mkshrc and the fine manual. -+test -e FAQ.htm || \ -+ $e Run FAQ2HTML.sh and place FAQ.htm into a suitable location as well. - exit 0 - - : <<'EOD' -@@ -2740,6 +2765,7 @@ HAVE_CAN_FSTACKPROTECTORALL ac_flags - ==== cpp definitions ==== - DEBUG dont use in production, wants gcc, implies: - DEBUG_LEAKS enable freeing resources before exiting -+KSH_VERSIONNAME_VENDOR_EXT when patching; space+plus+word (e.g. " +SuSE") - MKSHRC_PATH "~/.mkshrc" (do not change) - MKSH_A4PB force use of arc4random_pushb - MKSH_ASSUME_UTF8 (0=disabled, 1=enabled; default: unset) -@@ -2768,6 +2794,7 @@ MKSH_S_NOVI=1 disable Vi editing mode - MKSH_TYPEDEF_SIG_ATOMIC_T define to e.g. 'int' if sig_atomic_t is missing - MKSH_TYPEDEF_SSIZE_T define to e.g. 'long' if your OS has no ssize_t - MKSH_UNEMPLOYED disable job control (but not jobs/co-processes) -+USE_REALLOC_MALLOC define as 0 to not use realloc as malloc - - === generic installation instructions === - -@@ -2777,15 +2804,15 @@ them, set to a value other than 0 or 1. - MKSH_SMALL but with Vi mode, add -DMKSH_S_NOVI=0 to CPPFLAGS as well. - - Normally, the following command is what you want to run, then: --$ (sh Build.sh -r -c lto && ./test.sh -f) 2>&1 | tee log -+$ (sh Build.sh -r && ./test.sh -f) 2>&1 | tee log - - Copy dot.mkshrc to /etc/skel/.mkshrc; install mksh into $prefix/bin; or - /bin; install the manpage, if omitting the -r flag a catmanpage is made - using $NROFF. Consider using a forward script as /etc/skel/.mkshrc like --http://anonscm.debian.org/cgit/collab-maint/mksh.git/plain/debian/.mkshrc -+https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=alioth/mksh.git;a=blob;f=debian/.mkshrc - and put dot.mkshrc as /etc/mkshrc so users need not keep up their HOME. - - You may also want to install the lksh binary (also as /bin/sh) built by: --$ CPPFLAGS="$CPPFLAGS -DMKSH_BINSHPOSIX" sh Build.sh -L -r -c lto -+$ CPPFLAGS="$CPPFLAGS -DMKSH_BINSHPOSIX" sh Build.sh -L -r - - EOD ---- /dev/null -+++ mksh-57/FAQ2HTML.sh -@@ -0,0 +1,136 @@ -+#!/bin/mksh -+rcsid='$MirOS: src/bin/mksh/FAQ2HTML.sh,v 1.1 2020/02/03 22:23:33 tg Exp $' -+#- -+# Copyright © 2020 -+# mirabilos -+# -+# Provided that these terms and disclaimer and all copyright notices -+# are retained or reproduced in an accompanying document, permission -+# is granted to deal in this work without restriction, including un‐ -+# limited rights to use, publicly perform, distribute, sell, modify, -+# merge, give away, or sublicence. -+# -+# This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to -+# the utmost extent permitted by applicable law, neither express nor -+# implied; without malicious intent or gross negligence. In no event -+# may a licensor, author or contributor be held liable for indirect, -+# direct, other damage, loss, or other issues arising in any way out -+# of dealing in the work, even if advised of the possibility of such -+# damage or existence of a defect, except proven that it results out -+# of said person’s immediate fault when using the work as intended. -+#- -+ -+set -e -+LC_ALL=C; LANGUAGE=C -+export LC_ALL; unset LANGUAGE -+nl=' -+' -+srcdir=$(dirname "$0") -+ -+p=--posix -+sed $p -e q /dev/null 2>&1 || p= -+ -+v=$1 -+if test -z "$v"; then -+ v=$(sed $p -n '/^#define MKSH_VERSION "\(.*\)"$/s//\1/p' "$srcdir"/sh.h) -+fi -+src_id=$(sed $p -n '/^RCSID: /s///p' "$srcdir"/mksh.faq) -+# sanity check -+case $src_id in -+(*"$nl"*) -+ echo >&2 "E: more than one RCSID in mksh.faq?" -+ exit 1 ;; -+esac -+ -+sed $p \ -+ -e '/^RCSID: \$/s/^.*$/----/' \ -+ -e 's!@@RELPATH@@!http://www.mirbsd.org/!g' \ -+ -e 's^  ' \ -+ "$srcdir"/mksh.faq | tr '\n' '' | sed $p \ -+ -e 'sg' \ -+ -e 's----g' \ -+ -e 's\([^]*\)\1g' \ -+ -e 's\([^]*\)\1g' \ -+ -e 's\([^]*\)*ToC: \([^]*\)Title: \([^]*\)\([^]*\)\{0,1\}

\3


g' \ -+ -e 's[^]*

g' \ -+ -e 's^
*' \ -+ -e 's$' \ -+ -e 's<><>g' \ -+ -e 'sg' | tr '' '\n' >FAQ.tmp -+ -+exec >FAQ.htm~ -+cat < -+ -+ -+ mksh $v FAQ (local copy) -+ -+ -+ -+ -+

Note: Links marked like this -+ one to the mksh IRC channel connect to external resources.

-+

Notice: the website will have the latest version of the -+ mksh FAQ online.

-+

Table of Contents

-+