diff -Nru mksh-50/Build.sh mksh-50d/Build.sh --- mksh-50/Build.sh 2014-06-29 10:56:33.000000000 +0000 +++ mksh-50d/Build.sh 2014-10-07 15:23:02.000000000 +0000 @@ -1,5 +1,5 @@ #!/bin/sh -srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.662 2014/06/29 10:56:08 tg Exp $' +srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.669 2014/10/07 15:22:12 tg Exp $' #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013, 2014 @@ -1784,7 +1784,7 @@ #define EXTERN #define MKSH_INCLUDES_ONLY #include "sh.h" - __RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.662 2014/06/29 10:56:08 tg Exp $"); + __RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.669 2014/10/07 15:22:12 tg Exp $"); int main(void) { printf("Hello, World!\n"); return (isatty(0)); } EOF case $cm in @@ -1904,6 +1904,11 @@ int main(void) { struct timeval tv; return (gettimeofday(&tv, NULL)); } EOF +ac_test issetugid <<-'EOF' + #include + int main(void) { return (issetugid()); } +EOF + ac_test killpg <<-'EOF' #include int main(int ac, char *av[]) { return (av[0][killpg(123, ac)]); } @@ -2273,6 +2278,7 @@ sigs="ABRT FPE ILL INT SEGV TERM ALRM BUS CHLD CONT HUP KILL PIPE QUIT" sigs="$sigs STOP TSTP TTIN TTOU USR1 USR2 POLL PROF SYS TRAP URG VTALRM" sigs="$sigs XCPU XFSZ INFO WINCH EMT IO DIL LOST PWR SAK CLD IOT RESV" + sigs="$sigs STKFLT UNUSED" test 1 = $HAVE_CPP_DD && test $NSIG -gt 1 && sigs="$sigs "`vq \ "$CPP $CFLAGS $CPPFLAGS $NOWARN -dD conftest.c" | \ grep '[ ]SIG[A-Z0-9][A-Z0-9]*[ ]' | \ @@ -2310,7 +2316,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=501 +add_cppflags -DMKSH_BUILD_R=504 $e $bi$me: Finished configuration testing, now producing output.$ao @@ -2620,7 +2626,7 @@ MKSH_DONT_EMIT_IDSTRING omit RCS IDs from binary MKSH_MIDNIGHTBSD01ASH_COMPAT set -o sh: additional compatibility quirk MKSH_NOPROSPECTOFWORK disable jobs, co-processes, etc. (do not use) -MKSH_NOPWNAM skip PAM calls, for -static on eglibc, Solaris +MKSH_NOPWNAM skip PAM calls, for -static on glibc or Solaris MKSH_NO_CMDLINE_EDITING disable command line editing code entirely MKSH_NO_DEPRECATED_WARNING omit warning when deprecated stuff is run MKSH_NO_EXTERNAL_CAT omit hack to skip cat builtin when flags passed @@ -2647,7 +2653,7 @@ 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 -https://www.mirbsd.org/cvs.cgi/contrib/hosted/tg/deb/mksh/debian/.mkshrc?rev=HEAD +http://anonscm.debian.org/cgit/collab-maint/mksh.git/plain/debian/.mkshrc and put dot.mkshrc as /etc/mkshrc so users need not keep up their HOME. EOD diff -Nru mksh-50/check.pl mksh-50d/check.pl --- mksh-50/check.pl 2014-06-09 13:26:15.000000000 +0000 +++ mksh-50d/check.pl 2014-08-19 07:44:22.000000000 +0000 @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.pl,v 1.36 2014/06/09 13:25:50 tg Exp $ +# $MirOS: src/bin/mksh/check.pl,v 1.37 2014/08/19 07:43:32 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, @@ -348,6 +348,7 @@ print " ($nifailed ignored)" if $nifailed; print " ($nxfailed unexpected)" if $nxfailed; print " (as expected)" if $nfailed && !$nxfailed && !$nifailed; + print " ($nfailed expected)" if $nfailed && ($nxfailed || $nifailed); print "\nTotal passed: $tot_passed"; print " ($nxpassed unexpected)" if $nxpassed; print "\n"; diff -Nru mksh-50/check.t mksh-50d/check.t --- mksh-50/check.t 2014-06-29 11:28:51.000000000 +0000 +++ mksh-50d/check.t 2014-10-07 15:23:04.000000000 +0000 @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.654 2014/06/29 11:28:26 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.661 2014/10/07 15:22:14 tg Exp $ # OpenBSD src/regress/bin/ksh updated: 2013/12/02 20:39:44 #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -27,7 +27,7 @@ # http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD expected-stdout: - @(#)MIRBSD KSH R50 2014/06/29 + @(#)MIRBSD KSH R50 2014/10/07 description: Check version of shell. stdin: @@ -36,7 +36,7 @@ category: shell:legacy-no --- expected-stdout: - @(#)LEGACY KSH R50 2014/06/29 + @(#)LEGACY KSH R50 2014/10/07 description: Check version of legacy shell. stdin: @@ -3733,6 +3733,406 @@ expected-stdout: <1> <1> <2> --- +name: IFS-subst-3 +description: + Check leading IFS non-whitespace after trim does make a field + but leading IFS whitespace does not, nor empty replacements +stdin: + showargs() { for i; do echo -n " <$i>"; done; echo; } + showargs 0 ${-+} + IFS=: + showargs 1 ${-+:foo:bar} + IFS=' ' + showargs 2 ${-+ foo bar} +expected-stdout: + <0> + <1> <> + <2> +--- +name: IFS-subst-4-1 +description: + reported by mikeserv +stdin: + a='space divded argument + here' + IFS=\ ; set -- $a + IFS= ; q="$*" ; nq=$* + printf '<%s>\n' "$*" $* "$q" "$nq" + [ "$q" = "$nq" ] && echo =true || echo =false +expected-stdout: + + + + + + + =true +--- +name: IFS-subst-4-2 +description: + extended testsuite based on problem by mikeserv +stdin: + a='space divded argument + here' + IFS=\ ; set -- $a + IFS= ; q="$@" ; nq=$@ + printf '<%s>\n' "$*" $* "$q" "$nq" + [ "$q" = "$nq" ] && echo =true || echo =false +expected-stdout: + + + + + + + =true +--- +name: IFS-subst-4-3 +description: + extended testsuite based on problem by mikeserv +stdin: + a='space divded argument + here' + IFS=\ ; set -- $a; IFS= + qs="$*" + nqs=$* + qk="$@" + nqk=$@ + printf '= qs '; printf '<%s>\n' "$qs" + printf '=nqs '; printf '<%s>\n' "$nqs" + printf '= qk '; printf '<%s>\n' "$qk" + printf '=nqk '; printf '<%s>\n' "$nqk" + printf '~ qs '; printf '<%s>\n' "$*" + printf '~nqs '; printf '<%s>\n' $* + printf '~ qk '; printf '<%s>\n' "$@" + printf '~nqk '; printf '<%s>\n' $@ +expected-stdout: + = qs + =nqs + = qk + =nqk + ~ qs + ~nqs + + + ~ qk + + + ~nqk + + +--- +name: IFS-subst-4-4 +description: + extended testsuite based on problem by mikeserv +stdin: + a='space divded argument + here' + IFS=\ ; set -- $a; IFS= + qs="$*" + printf '= qs '; printf '<%s>\n' "$qs" + printf '~ qs '; printf '<%s>\n' "$*" + nqs=$* + printf '=nqs '; printf '<%s>\n' "$nqs" + printf '~nqs '; printf '<%s>\n' $* + qk="$@" + printf '= qk '; printf '<%s>\n' "$qk" + printf '~ qk '; printf '<%s>\n' "$@" + nqk=$@ + printf '=nqk '; printf '<%s>\n' "$nqk" + printf '~nqk '; printf '<%s>\n' $@ +expected-stdout: + = qs + ~ qs + =nqs + ~nqs + + + = qk + ~ qk + + + =nqk + ~nqk + + +--- +name: IFS-subst-4-4p +description: + extended testsuite based on problem by mikeserv +stdin: + a='space divded argument + here' + IFS=\ ; set -- $a; IFS= + unset v + qs=${v:-"$*"} + printf '= qs '; printf '<%s>\n' "$qs" + printf '~ qs '; printf '<%s>\n' ${v:-"$*"} + nqs=${v:-$*} + printf '=nqs '; printf '<%s>\n' "$nqs" + printf '~nqs '; printf '<%s>\n' ${v:-$*} + qk=${v:-"$@"} + printf '= qk '; printf '<%s>\n' "$qk" + printf '~ qk '; printf '<%s>\n' ${v:-"$@"} + nqk=${v:-$@} + printf '=nqk '; printf '<%s>\n' "$nqk" + printf '~nqk '; printf '<%s>\n' ${v:-$@} +expected-stdout: + = qs + ~ qs + =nqs + ~nqs + + + = qk + ~ qk + + + =nqk + ~nqk + + +--- +name: IFS-subst-4-5 +description: + extended testsuite based on problem by mikeserv +stdin: + a='space divded argument + here' + IFS=\ ; set -- $a; IFS=, + qs="$*" + printf '= qs '; printf '<%s>\n' "$qs" + printf '~ qs '; printf '<%s>\n' "$*" + nqs=$* + printf '=nqs '; printf '<%s>\n' "$nqs" + printf '~nqs '; printf '<%s>\n' $* + qk="$@" + printf '= qk '; printf '<%s>\n' "$qk" + printf '~ qk '; printf '<%s>\n' "$@" + nqk=$@ + printf '=nqk '; printf '<%s>\n' "$nqk" + printf '~nqk '; printf '<%s>\n' $@ +expected-stdout: + = qs + ~ qs + =nqs + ~nqs + + + = qk + ~ qk + + + =nqk + ~nqk + + +--- +name: IFS-subst-4-5p +description: + extended testsuite based on problem by mikeserv +stdin: + a='space divded argument + here' + IFS=\ ; set -- $a; IFS=, + unset v + qs=${v:-"$*"} + printf '= qs '; printf '<%s>\n' "$qs" + printf '~ qs '; printf '<%s>\n' ${v:-"$*"} + nqs=${v:-$*} + printf '=nqs '; printf '<%s>\n' "$nqs" + printf '~nqs '; printf '<%s>\n' ${v:-$*} + qk=${v:-"$@"} + printf '= qk '; printf '<%s>\n' "$qk" + printf '~ qk '; printf '<%s>\n' ${v:-"$@"} + nqk=${v:-$@} + printf '=nqk '; printf '<%s>\n' "$nqk" + printf '~nqk '; printf '<%s>\n' ${v:-$@} +expected-stdout: + = qs + ~ qs + =nqs + ~nqs + + + = qk + ~ qk + + + =nqk + ~nqk + + +--- +name: IFS-subst-5 +description: + extended testsuite based on IFS-subst-3 + differs slightly from ksh93: + - omit trailing field in a3zna, a7ina (unquoted $@ expansion) + - has extra middle fields in b5ins, b7ina (IFS_NWS unquoted expansion) + differs slightly from bash: + - omit leading field in a5ins, a7ina (IFS_NWS unquoted expansion) + differs slightly from zsh: + - differs in assignment, not expansion; probably zsh bug + - has extra middle fields in b5ins, b7ina (IFS_NWS unquoted expansion) + 'emulate sh' zsh has extra fields in + - a5ins (IFS_NWS unquoted $*) + - b5ins, matching mksh’s +stdin: + "$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"' + echo '=a1zns' + "$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"' + echo '=a2zqs' + "$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"' + echo '=a3zna' + "$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"' + echo '=a4zqa' + "$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"' + echo '=a5ins' + "$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"' + echo '=a6iqs' + "$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"' + echo '=a7ina' + "$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"' + echo '=a8iqa' + "$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"' + echo '=b1zns' + "$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"' + echo '=b2zqs' + "$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"' + echo '=b3zna' + "$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"' + echo '=b4zqa' + "$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"' + echo '=b5ins' + "$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"' + echo '=b6iqs' + "$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"' + echo '=b7ina' + "$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"' + echo '=b8iqa' +expected-stdout: + [2] + <2> + =a1zns + [2] + <2> + =a2zqs + [2] + < 2 > + =a3zna + [] + [2] + [] + < 2 > + =a4zqa + [2] + <,2,> + =a5ins + [,2,] + <,2,> + =a6iqs + [2] + < 2 > + =a7ina + [] + [2] + [] + < 2 > + =a8iqa + [A] + [B] + [C] + + =b1zns + [ABC] + + =b2zqs + [A] + [B] + [C] + + =b3zna + [A] + [B] + [] + [] + [C] + + =b4zqa + [A] + [B] + [] + [] + [C] + + =b5ins + [A,B,,,C] + + =b6iqs + [A] + [B] + [] + [] + [C] + + =b7ina + [A] + [B] + [] + [] + [C] + + =b8iqa +--- name: IFS-arith-1 description: http://austingroupbugs.net/view.php?id=832 @@ -7791,6 +8191,17 @@ expected-stdout: <1> <> <2> <> <+> <> <3> <> <+> <> . --- +name: varexpand-null-3 +description: + Ensure concatenating behaviour matches other shells + although the line 2<> is probably wrong? XNULLSUB case. +stdin: + x=; printf "1<%s>\n" "$x$@" + set A; printf "2<%s>\n" "${@:+}" +expected-stdout: + 1<> + 2<> +--- name: print-funny-chars description: Check print builtin's capability to output designated characters diff -Nru mksh-50/debian/.mkshrc mksh-50d/debian/.mkshrc --- mksh-50/debian/.mkshrc 2014-08-22 08:14:20.000000000 +0000 +++ mksh-50d/debian/.mkshrc 2014-10-07 16:28:41.000000000 +0000 @@ -22,6 +22,10 @@ PS1=$p$'\r${debian_chroot:+'$p$'\e[0;1m'$p'($debian_chroot)'$p$'\e[0m'$p'}'$PS1 unset p +# force sane environment +#export LC_ALL=C.UTF-8 +#set -U + : put your local alias/function definitions, patches, etc. here #unset LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_IDENTIFICATION LC_MONETARY \ diff -Nru mksh-50/debian/README.Debian mksh-50d/debian/README.Debian --- mksh-50/debian/README.Debian 2014-08-22 08:14:20.000000000 +0000 +++ mksh-50d/debian/README.Debian 2014-10-07 18:40:16.000000000 +0000 @@ -2,7 +2,7 @@ ===================================== Please read the links on https://www.mirbsd.org/ksh-chan.htm and peek at: -https://freewrt.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=shellsnippets/shellsnippets.git +https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=shellsnippets/shellsnippets.git Reporting bugs diff -Nru mksh-50/debian/changelog mksh-50d/debian/changelog --- mksh-50/debian/changelog 2014-08-28 12:07:00.000000000 +0000 +++ mksh-50d/debian/changelog 2014-10-07 20:50:39.000000000 +0000 @@ -1,3 +1,59 @@ +mksh (50d-1ubuntu1) utopic; urgency=high + + * Merge from Debian (LP: #1377295), remaining changes: + - Omit dietlibc builds on Ubuntu, where it is not in main + - Maintainer change for Ubuntu + + -- Thorsten Glaser Tue, 07 Oct 2014 20:50:33 +0000 + +mksh (50d-1) unstable; urgency=high + + * QA upload. + * New upstream regression bugfix release: + - [Goodbox] Fix NULL pointer dereference on “unset x; nameref x” + - [tg] Fix severe regression in field splitting (LP#1378208) + - [tg] Add a warning about not using tainted user input (including + from the environment) in arithmetics, until Stéphane writes it up + * Enable klibc builds on arm64 and ppc64el + * Disable LTO build, it is still too unreliable + * Orphan the package. + + -- Thorsten Glaser Tue, 07 Oct 2014 17:21:21 +0000 + +mksh (50c-1) unstable; urgency=high + + * New upstream security release: + - [tg] Know more rare signals when generating sys_signame[] replacement + - [tg] OpenBSD sync (mostly RCSID only) + - [tg] Document HISTSIZE limit; found by luigi_345 on IRC + - [zacts] Fix link to Debian .mkshrc + - [tg] Cease exporting $RANDOM (Debian #760857) + - [tg] Fix C99 compatibility + - [tg] Work around klibc bug causing a coredump (Debian #763842) + - [tg] Use [197]issetugid(2) as additional check if we are FPRIVILEGED + - [tg] SECURITY: do not permit += from environment + - [tg] Fix more field splitting bugs reported by Stephane Chazelas and + mikeserv; document current status wrt. ambiguous ones as testcases too + * Policy 3.9.6, no changes + * Use klibc on x32 again, to be binNMUable, and since it works good enough + * Update lintian overrides + + -- Thorsten Glaser Fri, 03 Oct 2014 18:56:34 +0000 + +mksh (50b-1) unstable; urgency=high + + * Bring back accidentally lost changelog entry for version 49-2 + * Note what was actually imported from CVS in the 50-4 changelog + * Disable klibc builds on x32 for now, they’re essentially amd64 + * New upstream version; remaining change: + - [tg, Jb_boin] Relax overzealous nameref RHS checks + * Update /etc/skel/.mkshrc with example how to force UTF-8 + * Fix gitweb URL in README.Debian + * Urgency high due to script regression since 50-1 + * Add NEWS entry for mksh script language changes in 50-1 + + -- Thorsten Glaser Wed, 03 Sep 2014 22:30:55 +0200 + mksh (50-4ubuntu1) utopic; urgency=medium * Merge from Debian (LP: #1362164), remaining changes: @@ -11,6 +67,21 @@ * The “Wollknäuel” upload, while preparing FrOSCon… * Update uhr to CVS HEAD, fixes a usage error * Update mksh to CVS HEAD, while here + - [Ypnose] Fix operator description in the manpage + - [tg] Change all mention of “eglibc” to “glibc”, it is merged back + - [Colona] Fix rare infinite loop with invalid UTF-8 in the edit buffer + - [tg] Make more clear when a shell is interactive in the manpage + - [tg] Document that % is a symmetric remainder operation, and how to get + a mathematical modulus from it, in the manpage + - [tg, Christopher Ferris, Elliott Hughes] Make the cat(1) builtin also + interruptible in the write loop, not just in the read loop, and avoid + it getting SIGPIPE in the smores function in dot.mkshrc by terminating + cat upon user quit + - [tg] Make some comments match the code, after jaredy from obsd changed + IFS split handling + - [tg] Fix some IFS-related mistakes in the manual page + - [tg] Document another issue as known-to-fail test IFS-subst-3 + - [tg] Improve check.pl output in some cases -- Thorsten Glaser Fri, 22 Aug 2014 10:17:11 +0200 @@ -64,6 +135,17 @@ -- Thorsten Glaser Sun, 29 Jun 2014 13:17:35 +0000 +mksh (49-2) unstable; urgency=medium + + * The “waiting for $customer_project to be ready” upload + * Update to upstream CVS HEAD: + - [tg] MKSH_BINSHREDUCED no longer mistakenly enables brace expansion + - [tg] Explain more clearly Vi input mode limitations in the manpage + - [tg] Improve error reporting of the check.pl script (which needs a + maintainer since I don’t speak any perl(1), really), for lewellyn + + -- Thorsten Glaser Fri, 31 Jan 2014 17:19:27 +0100 + mksh (49-1) unstable; urgency=medium * The “10 years EarthCache” upload (well, I was busy yesterday) diff -Nru mksh-50/debian/control mksh-50d/debian/control --- mksh-50/debian/control 2014-08-28 12:03:50.000000000 +0000 +++ mksh-50d/debian/control 2014-10-07 20:49:59.000000000 +0000 @@ -2,7 +2,6 @@ Section: shells Priority: optional Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Thorsten Glaser Homepage: http://mirbsd.de/mksh # We build-depend on dietlibc-dev and libklibc-dev for mksh-static and link # it against glibc if neither is usable for a given architecture. The meat @@ -11,14 +10,14 @@ # is run to determine bad builds. Really, do run the testsuite! (Even then, # versioned B-D may be used to remove known bogus versions.) Build-Depends: bsdmainutils, debhelper (>= 5), ed, - libklibc-dev [alpha amd64 armel armhf arm64 hppa i386 ia64 m68k mips mipsel powerpc powerpcspe ppc64 ppc64el s390 s390x sh4 sparc sparc64 x32], + libklibc-dev [alpha amd64 arm64 armel armhf hppa i386 ia64 m68k mips mipsel powerpc powerpcspe ppc64 ppc64el s390 s390x sh4 sparc sparc64 x32], # dietlibc-dev (>= 0.33~cvs20111108-5~) [hppa] | dietlibc-doc [hppa], # dietlibc-dev [alpha amd64 arm armeb armel armhf i386 ia64 mips mipsel powerpc powerpcspe ppc64 s390 s390x sparc sparc64], # # also for the testsuite (could switch to C.UTF-8 nowadays, though) locales [!avr32] | belocs-locales-bin [!avr32] # # hard to test against bug Build-Conflicts: dietlibc-dev (<< 0.33~cvs20111108-5~) [hppa] -Standards-Version: 3.9.5 +Standards-Version: 3.9.6 VCS-git: git://anonscm.debian.org/collab-maint/mksh.git VCS-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/mksh.git diff -Nru mksh-50/debian/copyright mksh-50d/debian/copyright --- mksh-50/debian/copyright 2014-08-22 08:14:20.000000000 +0000 +++ mksh-50d/debian/copyright 2014-10-07 16:28:41.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-R50.tgz +https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R50c.tgz Licence: diff -Nru mksh-50/debian/meat mksh-50d/debian/meat --- mksh-50/debian/meat 2014-08-22 08:14:20.000000000 +0000 +++ mksh-50d/debian/meat 2014-10-07 20:49:03.000000000 +0000 @@ -69,7 +69,7 @@ eval x=\$$v echo "| $v='$x'" done - echo "Actual compilation options (except combine, if used):" + echo "Actual compilation options:" fgrep main builddir/$where/Rebuild.sh | sed 's/^/] /' echo "Resulting binary:" size builddir/$where/?ksh 2>&1 | sed 's/^/| /' @@ -90,7 +90,7 @@ echo "LDFLAGS='$LDFLAGS' LDSTATIC='$LDSTATIC' LIBS='$LIBS'" buildok=0 - arg="-r $*" + arg=-r testwrap=0 if test x"$where" = x"legacy"; then arg="$arg -L" @@ -109,12 +109,6 @@ LDSTATIC="$LDSTATIC" LIBS="$LIBS" sh ../../Build.sh $arg && \ test -f $tfn && gotbin=1 set +x - test -f Rebuild.sh && test x"$HAVE_CAN_COMBINE" != x"0" && \ - if test $gotbin = 0; then - echo 'Build with combine *FAILED*, retrying without.' - echo '=== note: for better optimisation, fix your gcc! ===' - sh Rebuild.sh && test -f $tfn && gotbin=1 - fi if test $gotbin = 0; then echo "Build attempt failed." cd ../.. @@ -326,7 +320,7 @@ unset LDSTATIC LIBS= echo Building mksh-full... -trybuild full -c lto +trybuild full if test $buildok = 0; then echo Build of mksh-full failed. exit 1 @@ -371,12 +365,10 @@ LDFLAGS="$sLDFLAGS" LDSTATIC="-static" LIBS=$sLIBS - HAVE_CAN_COMBINE=0; export HAVE_CAN_COMBINE HAVE_CAN_FSTACKPROTECTORSTRONG=0; export HAVE_CAN_FSTACKPROTECTORSTRONG HAVE_CAN_FSTACKPROTECTORALL=0; export HAVE_CAN_FSTACKPROTECTORALL trybuild static unset HAVE_CAN_FSTACKPROTECTORSTRONG HAVE_CAN_FSTACKPROTECTORALL - unset HAVE_CAN_COMBINE # Collect gcc and klibc packages for Built-Using if test $buildok = 1; then x=$(dpkg -S "$(readlink -f "$($CC -print-libgcc-file-name)")") @@ -415,7 +407,7 @@ LDFLAGS="$sLDFLAGS" LDSTATIC="-static" LIBS=$sLIBS - trybuild static -c lto + trybuild static # Collect gcc and glibc packages for Built-Using if test $buildok = 1; then x=$(dpkg -S "$(readlink -f "$($CC -print-file-name=libgcc.a)")") @@ -465,12 +457,10 @@ done LDSTATIC="-static" LIBS=$lLIBS - HAVE_CAN_COMBINE=0; export HAVE_CAN_COMBINE HAVE_CAN_FSTACKPROTECTORSTRONG=0; export HAVE_CAN_FSTACKPROTECTORSTRONG HAVE_CAN_FSTACKPROTECTORALL=0; export HAVE_CAN_FSTACKPROTECTORALL trybuild legacy unset HAVE_CAN_FSTACKPROTECTORSTRONG HAVE_CAN_FSTACKPROTECTORALL - unset HAVE_CAN_COMBINE # Collect gcc and klibc packages for Built-Using if test $buildok = 1; then x=$(dpkg -S "$(readlink -f "$($CC -print-libgcc-file-name)")") @@ -520,7 +510,7 @@ LDFLAGS=$lLDFLAGS LDSTATIC= LIBS=$lLIBS - trybuild legacy -c lto + trybuild legacy ;; esac; test $buildok = 0 || break; done if test $buildok = 0; then diff -Nru mksh-50/debian/mksh.NEWS mksh-50d/debian/mksh.NEWS --- mksh-50/debian/mksh.NEWS 2014-08-22 08:14:20.000000000 +0000 +++ mksh-50d/debian/mksh.NEWS 2014-10-07 16:28:41.000000000 +0000 @@ -1,3 +1,18 @@ +mksh (50-1) unstable; urgency=medium + + The right-hand side of “nameref” (typeset -n) expressions + is now checked for validity. (Although, this is only fixed + for positional parameters and other special variables in + mksh 50b-1.) + + The “arr=([index]=value)” syntax is gone because of severe + bugs in its implementation and regressions in other places. + It will eventually be brought back, but not right now. Use + of “set -A arr -- [index]=value” has not been historically + supported by ksh and will not be brought back in mksh either. + + -- Thorsten Glaser Wed, 03 Sep 2014 22:22:44 +0200 + mksh (46-2) unstable; urgency=low The mksh and mksh-static binaries no longer come with the diff -Nru mksh-50/debian/patches/debian-changes mksh-50d/debian/patches/debian-changes --- mksh-50/debian/patches/debian-changes 2014-08-22 08:22:05.000000000 +0000 +++ mksh-50d/debian/patches/debian-changes 1970-01-01 00:00:00.000000000 +0000 @@ -1,305 +0,0 @@ -Please review changes against upstream code using SCM, -see the Vcs-* tags in debian/control for its location. - ---- mksh-50.orig/Build.sh -+++ mksh-50/Build.sh -@@ -1,5 +1,5 @@ - #!/bin/sh --srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.662 2014/06/29 10:56:08 tg Exp $' -+srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.663 2014/07/04 11:03:52 tg Exp $' - #- - # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, - # 2011, 2012, 2013, 2014 -@@ -1784,7 +1784,7 @@ else - #define EXTERN - #define MKSH_INCLUDES_ONLY - #include "sh.h" -- __RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.662 2014/06/29 10:56:08 tg Exp $"); -+ __RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.663 2014/07/04 11:03:52 tg Exp $"); - int main(void) { printf("Hello, World!\n"); return (isatty(0)); } - EOF - case $cm in -@@ -2620,7 +2620,7 @@ MKSH_DISABLE_TTY_WARNING shut up warning - MKSH_DONT_EMIT_IDSTRING omit RCS IDs from binary - MKSH_MIDNIGHTBSD01ASH_COMPAT set -o sh: additional compatibility quirk - MKSH_NOPROSPECTOFWORK disable jobs, co-processes, etc. (do not use) --MKSH_NOPWNAM skip PAM calls, for -static on eglibc, Solaris -+MKSH_NOPWNAM skip PAM calls, for -static on glibc or Solaris - MKSH_NO_CMDLINE_EDITING disable command line editing code entirely - MKSH_NO_DEPRECATED_WARNING omit warning when deprecated stuff is run - MKSH_NO_EXTERNAL_CAT omit hack to skip cat builtin when flags passed ---- mksh-50.orig/check.pl -+++ mksh-50/check.pl -@@ -1,4 +1,4 @@ --# $MirOS: src/bin/mksh/check.pl,v 1.36 2014/06/09 13:25:50 tg Exp $ -+# $MirOS: src/bin/mksh/check.pl,v 1.37 2014/08/19 07:43:32 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, -@@ -348,6 +348,7 @@ if ($tot_failed || $tot_passed) { - print " ($nifailed ignored)" if $nifailed; - print " ($nxfailed unexpected)" if $nxfailed; - print " (as expected)" if $nfailed && !$nxfailed && !$nifailed; -+ print " ($nfailed expected)" if $nfailed && ($nxfailed || $nifailed); - print "\nTotal passed: $tot_passed"; - print " ($nxpassed unexpected)" if $nxpassed; - print "\n"; ---- mksh-50.orig/check.t -+++ mksh-50/check.t -@@ -1,4 +1,4 @@ --# $MirOS: src/bin/mksh/check.t,v 1.654 2014/06/29 11:28:26 tg Exp $ -+# $MirOS: src/bin/mksh/check.t,v 1.657 2014/07/29 17:56:31 tg Exp $ - # OpenBSD src/regress/bin/ksh updated: 2013/12/02 20:39:44 - #- - # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -@@ -27,7 +27,7 @@ - # http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD - - expected-stdout: -- @(#)MIRBSD KSH R50 2014/06/29 -+ @(#)MIRBSD KSH R50 2014/07/28 - description: - Check version of shell. - stdin: -@@ -36,7 +36,7 @@ name: KSH_VERSION - category: shell:legacy-no - --- - expected-stdout: -- @(#)LEGACY KSH R50 2014/06/29 -+ @(#)LEGACY KSH R50 2014/07/28 - description: - Check version of legacy shell. - stdin: -@@ -3733,6 +3733,17 @@ stdin: - expected-stdout: - <1> <1> <2> - --- -+name: IFS-subst-3 -+description: -+ Check leading IFS non-whitespace after trim does make a field -+expected-fail: yes -+stdin: -+ showargs() { for i; do echo -n " <$i>"; done; echo; } -+ IFS=: -+ showargs 1 ${-+:foo:bar} -+expected-stdout: -+ <1> <> -+--- - name: IFS-arith-1 - description: - http://austingroupbugs.net/view.php?id=832 ---- mksh-50.orig/dot.mkshrc -+++ mksh-50/dot.mkshrc -@@ -1,5 +1,5 @@ - # $Id$ --# $MirOS: src/bin/mksh/dot.mkshrc,v 1.88 2014/01/11 18:09:39 tg Exp $ -+# $MirOS: src/bin/mksh/dot.mkshrc,v 1.89 2014/07/28 21:45:44 tg Exp $ - #- - # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, - # 2011, 2012, 2013, 2014 -@@ -242,20 +242,23 @@ function pushd { - - # pager (not control character safe) - function smores { -- local dummy line llen curlin=0 -- -- cat "$@" | while IFS= read -r line; do -- llen=${%line} -- (( llen == -1 )) && llen=${#line} -- (( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 )) -- if (( (curlin += llen) >= LINES )); then -- print -n -- '\033[7m--more--\033[0m' -- read -u1 dummy -- [[ $dummy = [Qq]* ]] && return 0 -- curlin=$llen -- fi -- print -r -- "$line" -- done -+ ( -+ set +m -+ cat "$@" |& -+ trap "rv=\$?; kill $! >/dev/null 2>&1; exit \$rv" EXIT -+ while IFS= read -pr line; do -+ llen=${%line} -+ (( llen == -1 )) && llen=${#line} -+ (( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 )) -+ if (( (curlin += llen) >= LINES )); then -+ print -n -- '\033[7m--more--\033[0m' -+ read -u1 || exit $? -+ [[ $REPLY = [Qq]* ]] && exit 0 -+ curlin=$llen -+ fi -+ print -r -- "$line" -+ done -+ ) - } - - # base64 encoder and decoder, RFC compliant, NUL safe ---- mksh-50.orig/edit.c -+++ mksh-50/edit.c -@@ -28,7 +28,7 @@ - - #ifndef MKSH_NO_CMDLINE_EDITING - --__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.275 2014/01/05 21:57:24 tg Exp $"); -+__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.276 2014/07/13 11:34:28 tg Exp $"); - - /* - * in later versions we might use libtermcap for this, but since external -@@ -1628,7 +1628,7 @@ x_zots(char *str) - int adj = x_adj_done; - - x_lastcp(); -- while (*str && str < xlp && adj == x_adj_done) -+ while (*str && str < xlp && x_col < xx_cols && adj == x_adj_done) - x_zotc3(&str); - } - ---- mksh-50.orig/eval.c -+++ mksh-50/eval.c -@@ -23,7 +23,7 @@ - - #include "sh.h" - --__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.150 2014/06/09 11:16:07 tg Exp $"); -+__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.151 2014/07/29 16:29:11 tg Exp $"); - - /* - * string expansion -@@ -897,14 +897,14 @@ expand( - * word | ws nws 0 - * ----------------------------------- - * IFS_WORD w/WS w/NWS w -- * IFS_WS -/WS w/NWS - -- * IFS_NWS -/NWS w/NWS w -+ * IFS_WS -/WS -/NWS - -+ * IFS_NWS -/NWS w/NWS - - * (w means generate a word) - * Note that IFS_NWS/0 generates a word (AT&T ksh - * doesn't do this, but POSIX does). - */ - if (word == IFS_WORD || -- (!ctype(c, C_IFSWS) && c && word == IFS_NWS)) { -+ (word == IFS_NWS && c && !ctype(c, C_IFSWS))) { - emit_word: - *dp++ = '\0'; - cp = Xclose(ds, dp); ---- mksh-50.orig/funcs.c -+++ mksh-50/funcs.c -@@ -38,7 +38,7 @@ - #endif - #endif - --__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.256 2014/06/09 13:25:52 tg Exp $"); -+__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.257 2014/07/28 21:45:44 tg Exp $"); - - #if HAVE_KILLPG - /* -@@ -3643,12 +3643,14 @@ c_cat(const char **wp) - break; - while (n) { - w = write(STDOUT_FILENO, cp, n); -+ eno = errno; -+ /* give the user a chance to ^C out */ -+ intrcheck(); - if (w == -1) { -- if (errno == EINTR) -+ if (eno == EINTR) - /* interrupted, try again */ - continue; - /* an error occured during writing */ -- eno = errno; - bi_errorf("%s: %s", "", - cstrerror(eno)); - rv = 1; ---- mksh-50.orig/mksh.1 -+++ mksh-50/mksh.1 -@@ -1,4 +1,4 @@ --.\" $MirOS: src/bin/mksh/mksh.1,v 1.336 2014/06/24 20:47:44 tg Exp $ -+.\" $MirOS: src/bin/mksh/mksh.1,v 1.340 2014/07/29 17:26:24 tg Exp $ - .\" $OpenBSD: ksh.1,v 1.152 2014/02/12 16:28:13 schwarze Exp $ - .\"- - .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, -@@ -74,7 +74,7 @@ - .\" with -mandoc, it might implement .Mx itself, but we want to - .\" use our own definition. And .Dd must come *first*, always. - .\" --.Dd $Mdocdate: June 24 2014 $ -+.Dd $Mdocdate: July 29 2014 $ - .\" - .\" Check which macro package we use, and do other -mdoc setup. - .\" -@@ -208,7 +208,7 @@ will execute the command(s) contained in - .Ar string . - .It Fl i - Interactive shell. --A shell is -+A shell that reads commands from standard input is - .Dq interactive - if this - option is used or if both standard input and standard error are attached -@@ -1232,10 +1232,8 @@ whitespace octets, in combination with z - whitespace octets, delimit a field. - As a special case, leading and trailing - .Ev IFS --whitespace and trailing --.Ev IFS --non-whitespace are stripped (i.e. no leading or trailing empty field --is created by it); leading -+whitespace is stripped (i.e. no leading or trailing empty field -+is created by it); leading or trailing - .Pf non- Ev IFS - whitespace does create an empty field. - .Pp -@@ -2697,7 +2695,7 @@ Not equal; the result is 0 if both argum - Less than; the result is 1 if the left argument is less than the right, 0 if - not. - .It \*(Lt= \*(Gt \*(Gt= --Less than or equal, greater than or equal, greater than. -+Less than or equal, greater than, greater than or equal. - See - .Ic \*(Lt . - .It \*(Lt\*(Lt\*(Lt \*(Gt\*(Gt\*(Gt -@@ -2711,8 +2709,15 @@ Shift left (right); the result is the le - .It + \- * / - Addition, subtraction, multiplication, and division. - .It % --Remainder; the result is the remainder of the division of the left argument by --the right. -+Remainder; the result is the symmetric remainder of the division of the left -+argument by the right. -+To get the mathematical modulus of -+.Dq a Ic mod No b , -+use the formula -+.Do -+.Pq a % b + b -+.No % b -+.Dc . - .It Xo - .Sm off - .Aq Ar arg1 ? -@@ -6436,8 +6441,8 @@ foo \*(Ba bar \*(Ba& read \-p baz - .Pp - .Nm mksh - provides a consistent set of 32-bit integer arithmetics, both signed --and unsigned, with defined wraparound and sign of the result of a modulo --operation, even (defying POSIX) on 64-bit systems. -+and unsigned, with defined wraparound and sign of the result of a -+remainder operation, even (defying POSIX) on 64-bit systems. - If you require 64-bit integer arithmetics, use - .Nm lksh Pq legacy mksh - instead, but be aware that, in POSIX, it's legal for the OS to make ---- mksh-50.orig/sh.h -+++ mksh-50/sh.h -@@ -169,9 +169,9 @@ - #endif - - #ifdef EXTERN --__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.691 2014/06/29 11:28:28 tg Exp $"); -+__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.693 2014/07/28 21:45:45 tg Exp $"); - #endif --#define MKSH_VERSION "R50 2014/06/29" -+#define MKSH_VERSION "R50 2014/07/28" - - /* arithmetic types: C implementation */ - #if !HAVE_CAN_INTTYPES diff -Nru mksh-50/debian/patches/series mksh-50d/debian/patches/series --- mksh-50/debian/patches/series 2014-08-22 08:22:05.000000000 +0000 +++ mksh-50d/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -debian-changes diff -Nru mksh-50/debian/source.lintian-overrides mksh-50d/debian/source.lintian-overrides --- mksh-50/debian/source.lintian-overrides 2014-08-22 08:14:20.000000000 +0000 +++ mksh-50d/debian/source.lintian-overrides 2014-10-07 16:28:41.000000000 +0000 @@ -1,2 +1,5 @@ # there is only gzsig, not pgp mksh source: debian-watch-may-check-gpg-signature + +# never! +mksh source: no-dep5-copyright diff -Nru mksh-50/dot.mkshrc mksh-50d/dot.mkshrc --- mksh-50/dot.mkshrc 2014-01-11 18:10:04.000000000 +0000 +++ mksh-50d/dot.mkshrc 2014-07-28 21:46:34.000000000 +0000 @@ -1,5 +1,5 @@ # $Id$ -# $MirOS: src/bin/mksh/dot.mkshrc,v 1.88 2014/01/11 18:09:39 tg Exp $ +# $MirOS: src/bin/mksh/dot.mkshrc,v 1.89 2014/07/28 21:45:44 tg Exp $ #- # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013, 2014 @@ -242,20 +242,23 @@ # pager (not control character safe) function smores { - local dummy line llen curlin=0 - - cat "$@" | while IFS= read -r line; do - llen=${%line} - (( llen == -1 )) && llen=${#line} - (( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 )) - if (( (curlin += llen) >= LINES )); then - print -n -- '\033[7m--more--\033[0m' - read -u1 dummy - [[ $dummy = [Qq]* ]] && return 0 - curlin=$llen - fi - print -r -- "$line" - done + ( + set +m + cat "$@" |& + trap "rv=\$?; kill $! >/dev/null 2>&1; exit \$rv" EXIT + while IFS= read -pr line; do + llen=${%line} + (( llen == -1 )) && llen=${#line} + (( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 )) + if (( (curlin += llen) >= LINES )); then + print -n -- '\033[7m--more--\033[0m' + read -u1 || exit $? + [[ $REPLY = [Qq]* ]] && exit 0 + curlin=$llen + fi + print -r -- "$line" + done + ) } # base64 encoder and decoder, RFC compliant, NUL safe diff -Nru mksh-50/edit.c mksh-50d/edit.c --- mksh-50/edit.c 2014-01-05 21:57:49.000000000 +0000 +++ mksh-50d/edit.c 2014-07-13 11:35:18.000000000 +0000 @@ -28,7 +28,7 @@ #ifndef MKSH_NO_CMDLINE_EDITING -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.275 2014/01/05 21:57:24 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.276 2014/07/13 11:34:28 tg Exp $"); /* * in later versions we might use libtermcap for this, but since external @@ -1628,7 +1628,7 @@ int adj = x_adj_done; x_lastcp(); - while (*str && str < xlp && adj == x_adj_done) + while (*str && str < xlp && x_col < xx_cols && adj == x_adj_done) x_zotc3(&str); } diff -Nru mksh-50/eval.c mksh-50d/eval.c --- mksh-50/eval.c 2014-06-09 11:16:32.000000000 +0000 +++ mksh-50d/eval.c 2014-10-07 15:23:06.000000000 +0000 @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.150 2014/06/09 11:16:07 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.153 2014/10/07 15:22:16 tg Exp $"); /* * string expansion @@ -62,6 +62,7 @@ #define IFS_WORD 0 /* word has chars (or quotes) */ #define IFS_WS 1 /* have seen IFS white-space */ #define IFS_NWS 2 /* have seen IFS non-white-space */ +#define IFS_IWS 3 /* begin of word, ignore IFS WS */ static int varsub(Expand *, const char *, const char *, int *, int *); static int comsub(Expand *, const char *, int); @@ -244,8 +245,8 @@ internal_errorf("expand(NULL)"); /* for alias, readonly, set, typeset commands */ if ((f & DOVACHECK) && is_wdvarassign(ccp)) { - f &= ~(DOVACHECK|DOBLANK|DOGLOB|DOTILDE); - f |= DOASNTILDE; + f &= ~(DOVACHECK | DOBLANK | DOGLOB | DOTILDE); + f |= DOASNTILDE | DOASNFIELD; } if (Flag(FNOGLOB)) f &= ~DOGLOB; @@ -261,7 +262,7 @@ fdo = 0; saw_eq = false; /* must be 1/0 */ - tilde_ok = (f & (DOTILDE|DOASNTILDE)) ? 1 : 0; + tilde_ok = (f & (DOTILDE | DOASNTILDE)) ? 1 : 0; doblank = 0; make_magic = false; word = (f&DOBLANK) ? IFS_WS : IFS_WORD; @@ -422,7 +423,7 @@ print_value_quoted(&shf, str_val(st->var)); x.str = shf_sclose(&shf); break; - } + } case '0': { char *beg, *mid, *end, *stg; mksh_ari_t from = 0, num = -1, flen, finc = 0; @@ -472,7 +473,7 @@ utfincptr(beg, &num); strndupx(x.str, beg, num, ATEMP); goto do_CSUBST; - } + } case '/': { char *s, *p, *d, *sbeg, *end; char *pat, *rrep; @@ -616,7 +617,7 @@ if (rrep != null) afree(rrep, ATEMP); goto do_CSUBST; - } + } case '#': case '%': /* ! DOBLANK,DOBRACE,DOTILDE */ @@ -649,7 +650,7 @@ * a arithmetic operator. */ if (!(x.var->flag & INTEGER)) - f |= DOASNTILDE|DOTILDE; + f |= DOASNTILDE | DOTILDE; f |= DOTEMP; /* * These will be done after the @@ -663,6 +664,7 @@ f |= DOTEMP; /* FALLTHROUGH */ default: + word = quote ? IFS_WORD : IFS_IWS; /* Enable tilde expansion */ tilde_ok = 1; f |= DOTILDE; @@ -671,7 +673,7 @@ /* skip word */ sp += wdscan(sp, CSUBST) - sp; continue; - } + } case CSUBST: /* only get here if expanding word */ do_CSUBST: @@ -741,6 +743,7 @@ if (f & DOBLANK) doblank++; st = st->prev; + word = quote || (!*x.str && (f & DOASNFIELD)) ? IFS_WORD : IFS_WS; continue; case '?': { char *s = Xrestpos(ds, dp, st->base); @@ -749,13 +752,14 @@ dp == s ? "parameter null or not set" : (debunk(s, s, strlen(s) + 1), s)); - } + } case '0': case '/': case 0x100 | '#': case 0x100 | 'Q': dp = Xrestpos(ds, dp, st->base); type = XSUB; + word = quote || (!*x.str && (f & DOASNFIELD)) ? IFS_WORD : IFS_WS; if (f & DOBLANK) doblank++; st = st->prev; @@ -795,13 +799,6 @@ type = XBASE; if (f & DOBLANK) { doblank--; - /* - * XXX not really correct: - * x=; "$x$@" - * should generate a null argument and - * set A; "${@:+}" - * shouldn't. - */ if (dp == Xstring(ds, dp)) word = IFS_WS; } @@ -825,7 +822,7 @@ if ((c = *x.str++) == '\0') { /* * force null words to be created so - * set -- '' 2 ''; foo "$@" will do + * set -- "" 2 ""; echo "$@" will do * the right thing */ if (quote && x.split) @@ -837,9 +834,21 @@ continue; } c = ifs0; + if ((f & DOASNFIELD)) { + /* assignment, do not field-split */ + if (x.split) { + c = ' '; + break; + } + if (c == 0) { + continue; + } + } if (c == 0) { if (quote && !x.split) continue; + if (!quote && word == IFS_WS) + continue; /* this is so we don't terminate */ c = ' '; /* now force-emit a word */ @@ -897,14 +906,14 @@ * word | ws nws 0 * ----------------------------------- * IFS_WORD w/WS w/NWS w - * IFS_WS -/WS w/NWS - - * IFS_NWS -/NWS w/NWS w + * IFS_WS -/WS -/NWS - + * IFS_NWS -/NWS w/NWS - + * IFS_IWS -/WS w/NWS - * (w means generate a word) - * Note that IFS_NWS/0 generates a word (AT&T ksh - * doesn't do this, but POSIX does). */ - if (word == IFS_WORD || - (!ctype(c, C_IFSWS) && c && word == IFS_NWS)) { + if ((word == IFS_WORD) || (c && + (word == IFS_IWS || word == IFS_NWS) && + !ctype(c, C_IFSWS))) { emit_word: *dp++ = '\0'; cp = Xclose(ds, dp); @@ -922,7 +931,8 @@ strlen(cp) + 1)); fdo = 0; saw_eq = false; - tilde_ok = (f & (DOTILDE|DOASNTILDE)) ? 1 : 0; + /* must be 1/0 */ + tilde_ok = (f & (DOTILDE | DOASNTILDE)) ? 1 : 0; if (c == 0) return; Xinit(ds, dp, 128, ATEMP); @@ -1006,7 +1016,7 @@ * through the sequence ${A=a=}~ */ if (type == XBASE && - (f & (DOTILDE|DOASNTILDE)) && + (f & (DOTILDE | DOASNTILDE)) && (tilde_ok & 2)) { const char *tcp; char *tdp = dp; diff -Nru mksh-50/exec.c mksh-50d/exec.c --- mksh-50/exec.c 2014-06-24 18:38:56.000000000 +0000 +++ mksh-50d/exec.c 2014-10-03 17:33:01.000000000 +0000 @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.132 2014/06/24 18:38:31 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.133 2014/10/03 17:32:11 tg Exp $"); #ifndef MKSH_DEFAULT_EXECSHELL #define MKSH_DEFAULT_EXECSHELL "/bin/sh" @@ -635,7 +635,7 @@ for (i = 0; t->vars[i]; i++) { /* do NOT lookup in the new var/fn block just created */ e->loc = l_expand; - cp = evalstr(t->vars[i], DOASNTILDE); + cp = evalstr(t->vars[i], DOASNTILDE | DOASNFIELD); e->loc = l_assign; if (Flag(FXTRACE)) { const char *ccp; diff -Nru mksh-50/funcs.c mksh-50d/funcs.c --- mksh-50/funcs.c 2014-06-09 13:26:17.000000000 +0000 +++ mksh-50d/funcs.c 2014-09-03 19:56:41.000000000 +0000 @@ -1,5 +1,5 @@ /* $OpenBSD: c_ksh.c,v 1.34 2013/12/17 16:37:05 deraadt Exp $ */ -/* $OpenBSD: c_sh.c,v 1.44 2013/09/04 15:49:18 millert Exp $ */ +/* $OpenBSD: c_sh.c,v 1.45 2014/08/27 08:26:04 jmc Exp $ */ /* $OpenBSD: c_test.c,v 1.18 2009/03/01 20:11:06 otto Exp $ */ /* $OpenBSD: c_ulimit.c,v 1.19 2013/11/28 10:33:37 sobrado Exp $ */ @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.256 2014/06/09 13:25:52 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.258 2014/09/03 19:55:51 tg Exp $"); #if HAVE_KILLPG /* @@ -3643,12 +3643,14 @@ break; while (n) { w = write(STDOUT_FILENO, cp, n); + eno = errno; + /* give the user a chance to ^C out */ + intrcheck(); if (w == -1) { - if (errno == EINTR) + if (eno == EINTR) /* interrupted, try again */ continue; /* an error occured during writing */ - eno = errno; bi_errorf("%s: %s", "", cstrerror(eno)); rv = 1; diff -Nru mksh-50/jobs.c mksh-50d/jobs.c --- mksh-50/jobs.c 2014-06-10 22:17:34.000000000 +0000 +++ mksh-50d/jobs.c 2014-10-03 12:33:38.000000000 +0000 @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.104 2014/06/10 22:17:09 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.105 2014/10/03 12:32:48 tg Exp $"); #if HAVE_KILLPG #define mksh_killpg killpg @@ -1339,7 +1339,7 @@ do { #ifndef MKSH_NOPROSPECTOFWORK pid = waitpid(-1, &status, (WNOHANG | -#ifdef WCONTINUED +#if defined(WCONTINUED) && defined(WIFCONTINUED) WCONTINUED | #endif WUNTRACED)); @@ -1381,7 +1381,7 @@ if (WIFSTOPPED(status)) p->state = PSTOPPED; else -#ifdef WIFCONTINUED +#if defined(WCONTINUED) && defined(WIFCONTINUED) if (WIFCONTINUED(status)) { p->state = j->state = PRUNNING; /* skip check_job(), no-op in this case */ diff -Nru mksh-50/main.c mksh-50d/main.c --- mksh-50/main.c 2014-06-09 12:28:42.000000000 +0000 +++ mksh-50d/main.c 2014-10-03 17:20:17.000000000 +0000 @@ -1,6 +1,6 @@ /* $OpenBSD: main.c,v 1.54 2013/11/28 10:33:37 sobrado Exp $ */ -/* $OpenBSD: tty.c,v 1.9 2006/03/14 22:08:01 deraadt Exp $ */ -/* $OpenBSD: io.c,v 1.23 2013/12/17 16:37:06 deraadt Exp $ */ +/* $OpenBSD: tty.c,v 1.10 2014/08/10 02:44:26 guenther Exp $ */ +/* $OpenBSD: io.c,v 1.25 2014/08/11 20:28:47 guenther Exp $ */ /* $OpenBSD: table.c,v 1.15 2012/02/19 07:52:30 otto Exp $ */ /*- @@ -34,7 +34,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.280 2014/06/09 12:28:17 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.284 2014/10/03 17:19:27 tg Exp $"); extern char **environ; @@ -63,7 +63,7 @@ static const char *initcoms[] = { Ttypeset, "-r", initvsn, NULL, - Ttypeset, "-x", "HOME", "PATH", "RANDOM", "SHELL", NULL, + Ttypeset, "-x", "HOME", "PATH", "SHELL", NULL, Ttypeset, "-i10", "COLUMNS", "LINES", "SECONDS", "TMOUT", NULL, Talias, "integer=typeset -i", @@ -184,7 +184,7 @@ int argi, i; Source *s = NULL; struct block *l; - unsigned char restricted, errexit, utf_flag; + unsigned char restricted_shell, errexit, utf_flag; char *cp; const char *ccp, **wp; struct tbl *vp; @@ -407,7 +407,11 @@ setint_n((vp_pipest = global("PIPESTATUS")), 0, 10); /* Set this before parsing arguments */ - Flag(FPRIVILEGED) = (kshuid != ksheuid || kshgid != kshegid) ? 2 : 0; + Flag(FPRIVILEGED) = ( +#if HAVE_ISSETUGID + issetugid() || +#endif + kshuid != ksheuid || kshgid != kshegid) ? 2 : 0; /* this to note if monitor is set on command line (see below) */ #ifndef MKSH_UNEMPLOYED @@ -573,7 +577,7 @@ } /* Disable during .profile/ENV reading */ - restricted = Flag(FRESTRICTED); + restricted_shell = Flag(FRESTRICTED); Flag(FRESTRICTED) = 0; errexit = Flag(FERREXIT); Flag(FERREXIT) = 0; @@ -603,7 +607,7 @@ change_flag(FPRIVILEGED, OF_INTERNAL, false); } - if (restricted) { + if (restricted_shell) { shcomexec(restr_com); /* After typeset command... */ Flag(FRESTRICTED) = 1; diff -Nru mksh-50/mirhash.h mksh-50d/mirhash.h --- mksh-50/mirhash.h 2014-06-29 11:48:30.000000000 +0000 +++ mksh-50d/mirhash.h 2014-10-02 19:34:56.000000000 +0000 @@ -30,6 +30,12 @@ * for speed reasons, specified for the regular stable hash, but very * much recommended if the actual output value may differ across runs * (so is using a random value instead of 0 for the IV). + *- + * Little quote gem: + * We are looking into it. Changing the core + * hash function in PHP isn't a trivial change + * and will take us some time. + * -- Rasmus Lerdorf */ #ifndef SYSKERN_MIRHASH_H @@ -38,7 +44,7 @@ #include -__RCSID("$MirOS: src/bin/mksh/mirhash.h,v 1.2 2014/06/29 11:48:05 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/mirhash.h,v 1.3 2014/10/02 19:34:06 tg Exp $"); /*- * BAFH itself is defined by the following primitives: diff -Nru mksh-50/mksh.1 mksh-50d/mksh.1 --- mksh-50/mksh.1 2014-06-24 20:48:09.000000000 +0000 +++ mksh-50d/mksh.1 2014-10-07 15:31:02.000000000 +0000 @@ -1,5 +1,5 @@ -.\" $MirOS: src/bin/mksh/mksh.1,v 1.336 2014/06/24 20:47:44 tg Exp $ -.\" $OpenBSD: ksh.1,v 1.152 2014/02/12 16:28:13 schwarze Exp $ +.\" $MirOS: src/bin/mksh/mksh.1,v 1.344 2014/10/07 15:30:12 tg Exp $ +.\" $OpenBSD: ksh.1,v 1.153 2014/08/17 07:15:41 jmc Exp $ .\"- .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, .\" 2010, 2011, 2012, 2013, 2014 @@ -74,7 +74,7 @@ .\" with -mandoc, it might implement .Mx itself, but we want to .\" use our own definition. And .Dd must come *first*, always. .\" -.Dd $Mdocdate: June 24 2014 $ +.Dd $Mdocdate: October 7 2014 $ .\" .\" Check which macro package we use, and do other -mdoc setup. .\" @@ -208,7 +208,7 @@ .Ar string . .It Fl i Interactive shell. -A shell is +A shell that reads commands from standard input is .Dq interactive if this option is used or if both standard input and standard error are attached @@ -1232,10 +1232,8 @@ whitespace octets, delimit a field. As a special case, leading and trailing .Ev IFS -whitespace and trailing -.Ev IFS -non-whitespace are stripped (i.e. no leading or trailing empty field -is created by it); leading +whitespace is stripped (i.e. no leading or trailing empty field +is created by it); leading or trailing .Pf non- Ev IFS whitespace does create an empty field. .Pp @@ -1877,6 +1875,9 @@ .It Ev HISTSIZE The number of commands normally stored for history. The default is 2047. +Do not set this value to insanely high values such as 1000000000 because +.Nm +can then not allocate enough memory for the history and will not start. .It Ev HOME The default directory for the .Ic cd @@ -2529,6 +2530,12 @@ as numeric arguments to the .Ic test command, and as the value of an assignment to an integer parameter. +.Em Warning : +This also affects implicit conversion to integer, for example as done by the +.Ic let +command. +.Em Never +use unchecked user input, e.g. from the environment, in arithmetics! .Pp Expressions are calculated using signed arithmetic and the .Vt mksh_ari_t @@ -2697,7 +2704,7 @@ Less than; the result is 1 if the left argument is less than the right, 0 if not. .It \*(Lt= \*(Gt \*(Gt= -Less than or equal, greater than or equal, greater than. +Less than or equal, greater than, greater than or equal. See .Ic \*(Lt . .It \*(Lt\*(Lt\*(Lt \*(Gt\*(Gt\*(Gt @@ -2711,8 +2718,15 @@ .It + \- * / Addition, subtraction, multiplication, and division. .It % -Remainder; the result is the remainder of the division of the left argument by -the right. +Remainder; the result is the symmetric remainder of the division of the left +argument by the right. +To get the mathematical modulus of +.Dq a Ic mod No b , +use the formula +.Do +.Pq a % b + b +.No % b +.Dc . .It Xo .Sm off .Aq Ar arg1 ? @@ -6436,8 +6450,8 @@ .Pp .Nm mksh provides a consistent set of 32-bit integer arithmetics, both signed -and unsigned, with defined wraparound and sign of the result of a modulo -operation, even (defying POSIX) on 64-bit systems. +and unsigned, with defined wraparound and sign of the result of a +remainder operation, even (defying POSIX) on 64-bit systems. If you require 64-bit integer arithmetics, use .Nm lksh Pq legacy mksh instead, but be aware that, in POSIX, it's legal for the OS to make diff -Nru mksh-50/sh.h mksh-50d/sh.h --- mksh-50/sh.h 2014-06-29 11:28:53.000000000 +0000 +++ mksh-50d/sh.h 2014-10-07 15:23:07.000000000 +0000 @@ -169,9 +169,9 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.691 2014/06/29 11:28:28 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.697 2014/10/07 15:22:17 tg Exp $"); #endif -#define MKSH_VERSION "R50 2014/06/29" +#define MKSH_VERSION "R50 2014/10/07" /* arithmetic types: C implementation */ #if !HAVE_CAN_INTTYPES @@ -533,7 +533,7 @@ #define mkssert(e) do { } while (/* CONSTCOND */ 0) #endif -#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 501) +#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 504) #error Must run Build.sh to compile this. extern void thiswillneverbedefinedIhope(void); int @@ -1396,6 +1396,7 @@ #define DOVACHECK BIT(9) /* var assign check (for typeset, set, etc) */ #define DOMARKDIRS BIT(10) /* force markdirs behaviour */ #define DOTCOMEXEC BIT(11) /* not an eval flag, used by sh -c hack */ +#define DOASNFIELD BIT(12) /* is assignment, change field handling */ #define X_EXTRA 20 /* this many extra bytes in X string */ diff -Nru mksh-50/var.c mksh-50d/var.c --- mksh-50/var.c 2014-06-26 20:36:27.000000000 +0000 +++ mksh-50d/var.c 2014-10-04 11:48:09.000000000 +0000 @@ -28,7 +28,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/var.c,v 1.180 2014/06/26 20:36:02 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/var.c,v 1.183 2014/10/04 11:47:19 tg Exp $"); /*- * Variables @@ -751,18 +751,18 @@ } val += len; } - if (val[0] == '=' || (val[0] == '+' && val[1] == '=')) { + if (val[0] == '=') { strndupx(tvar, var, val - var, ATEMP); - if (*val++ == '+') { - ++val; - vappend = true; - } - } else if ((val[0] != '\0') || (set & IMPORT)) { - /* - * must have a = when setting a variable by importing - * the original environment, otherwise be empty; we - * also end up here when a variable name was invalid - */ + ++val; + } else if (set & IMPORT) { + /* environment invalid variable name or no assignment */ + return (NULL); + } else if (val[0] == '+' && val[1] == '=') { + strndupx(tvar, var, val - var, ATEMP); + val += 2; + vappend = true; + } else if (val[0] != '\0') { + /* other invalid variable names (not from environment) */ return (NULL); } else { /* just varname with no value part nor equals sign */ @@ -784,13 +784,29 @@ /* find value if variable already exists */ if ((qval = val) == NULL) { varsearch(e->loc, &vp, tvar, hash(tvar)); - if (vp != NULL) - qval = str_val(vp); + if (vp == NULL) + goto nameref_empty; + qval = str_val(vp); } /* check target value for being a valid variable name */ ccp = skip_varname(qval, false); - if (ccp == qval) + if (ccp == qval) { + if (ksh_isdigit(qval[0])) { + int c; + + if (getn(qval, &c)) + goto nameref_rhs_checked; + } else if (qval[1] == '\0') switch (qval[0]) { + case '$': + case '!': + case '?': + case '#': + case '-': + goto nameref_rhs_checked; + } + nameref_empty: errorf("%s: %s", var, "empty nameref target"); + } len = (*ccp == '[') ? array_ref_len(ccp) : 0; if (ccp[len]) { /* @@ -801,6 +817,7 @@ errorf("%s: %s", qval, "nameref target not a valid parameter name"); } + nameref_rhs_checked: /* prevent nameref loops */ while (qval) { if (!strcmp(qval, tvar))