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> <shift> <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> <> <foo> <bar>
+---
 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", "<stdout>",
 					    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
