diff -Nru mksh-59c/debian/changelog mksh-59c/debian/changelog
--- mksh-59c/debian/changelog 2021-05-31 00:42:55.000000000 +0000
+++ mksh-59c/debian/changelog 2021-07-10 20:08:30.000000000 +0000
@@ -1,3 +1,21 @@
+mksh (59c-9) unstable; urgency=medium
+
+ * Cherry-pick bugfixes from CVS HEAD:
+ - stop referring to dead IRC network
+ - check lower bounds of input line array when backspacing
+ - protect against hi-bit7 (stty) EOF character
+ - show error message and exit nōn-zero on stdout write failure
+ for builtin calls (Closes: #990265) + display correct errno
+ - show error message in echo/print builtin on output write failure
+ (it exits 1 already in that case)
+ - ensure macro calls don’t have side effects in arguments
+ - properly flush stderr and unwind for direct builtin calls
+ (“ln -s /bin/mksh echo; ./echo …”)
+ - fix truncation behaviour for internal snprintf equivalent
+ * Update upstream contact info accordingly
+
+ -- Thorsten Glaser Note: Links marked like this
++ Note: Links marked like this
+ one to the mksh IRC channel connect to external resources. SKsh is an AmigaOS-specific Korn Shell-lookalike by Steve Koren. The Homepage of the #ksh
+- channel on Freenode IRC contains more information about the Korn
+- Shell in general and its flavours.
First, make sure that either you’re using a UTF-8 terminal and system ++ and the shell’s UTF-8 mode is on (set -U) or that you’re using ++ an 8-bit codepage/CCSID and the UTF-8 mode is off (set +U). If ++ you’re on an EBCDIC system ensure to pick a codepage that has a bijective ++ mapping to (Extended) ASCII and in which all necessary characters are ++ present, for example 1047. Furthermore ensure the compile-time and runtime ++ codepages match. (Other encoding schemes, e.g. DBCS or ISO-2022-JP, are ++ not supported.) This should already fix most relevant issues.
++If using an 8-bit coding system that (unlike e.g. ISO 8859 or EBCDIC) ++ does not assign control characters to “Extended ASCII” codepoints 0x80‥0x9F, ++ such as codepages 437, 850, 1252, … (usually on OS/2 or DOS-based systems), ++ enable the option set -o asis (new in R60); otherwise, they will ++ be escaped to avoid accidentally setting off terminal control sequences.
++Note that escaping of characters is, at runtime, dependent on whether the ++ shell was compiled for EBCDIC and/or utf8-mode and/or asis ++ are enabled, the latter being ignored if either of the former two are true ++ (in UTF-8 mode, UCS C1 codepoints are always escaped).
++---- + ToC: ctrl-l-cls + Title: ^L (Ctrl-L) does not clear the screen + +@@ -329,9 +376,15 @@ Use ^[^L (Escape+Ctrl-L) or rebind it:evaluate-region @@ -2806,7 +3072,7 @@ implement a programmable completion engine. Multiple people have been considering doing so in our IRC channel; we’ll hyperlink to these engines when they are available. -@@ -398,7 +430,12 @@ Title: How POSIX compliant is mksh? Also +@@ -398,7 +451,12 @@ Title: How POSIX compliant is mksh? Also utf8-mode (which only supports the BMP (Basic Multilingual Plane) of UCS and maps raw octets into the U+EF80‥U+EFFF wide character range; see Arithmetic expressions in mksh(1) for details) must stay @@ -2820,7 +3086,7 @@The following POSIX sh-compatible code toggles the utf8-mode option dependent on the current POSIX locale, for mksh to allow using the UTF-8 mode, within the constraints outlined above, in -@@ -414,7 +451,7 @@ Title: How POSIX compliant is mksh? Also +@@ -414,7 +472,7 @@ Title: How POSIX compliant is mksh? Also esac
In near future, (UTF-8) locale tracking will @@ -2829,7 +3095,7 @@
The shell is pretty close to POSIX, when run as lksh -o posix under the "C" locale it is intended to match. It does not do everything like other POSIX-compatible or ‑compliant shells, though.
-@@ -532,6 +569,15 @@ This is because AT&T ksh93 ships a p +@@ -532,6 +590,15 @@ This is because AT&T ksh93 ships a p put this into your ~/.mkshrc (note the space before the closing single quote) ---- @@ -2845,7 +3111,7 @@ ToC: builtin-rename Title: “rename” doesn’t work as expected! -@@ -546,23 +592,39 @@ Title: “rename” doesn’t work as ex +@@ -546,23 +613,39 @@ Title: “rename” doesn’t work as exalias rename="$(whence -p rename)"---- ToC: builtin-sleep @@ -2901,6 +3167,40 @@ ---- ToC: string-concat Title: “+=” behaves differently from other shells +@@ -635,18 +718,22 @@ Title: I use “set -eo pipefail” and + ToC: faq + Title: My question is not answered here! + +-Do read the mksh(1) manual page. You might also wish to read the homepage of the #ksh IRC channel +-on Freenode which lists several resources for Korn or POSIX-compatible +-shells in general. Or, contact us (developer and +-users), for example via IRC. ++Do read the mksh(1) and lksh(1) manual page. You might also wish to read the homepage of the #ksh IRC channel ++which lists several resources for Korn or POSIX-compatible shells in general. ++Or, contact us (developer and users). + ---- + ToC: contact +-Title: How do I contact you (to say thanks)? ++Title: How do I contact you (to say thanks, for bugreports and questions)? + +-You can say hi in the #!/bin/mksh channel on Freenode IRC, although a donation wouldn’t be amiss ☺ The mailing +-list can also be used. ++
You can say hi in the #!/bin/mksh channel on IRC (OFTC, for now), although… a
++ donation wouldn’t be amiss ☻
++
The mailing list can also
++ be used for this. The extra resources from the FAQ
++ entry just one above should also be considered ;-)
If you insist on sending a bugreport, IRC and the mailing list are ++ great places for that; Launchpad, ++ an external gratis service provided by a company, can also be used if you ++ like web-based issue trackers better.
+ ---- --- mksh-59c.orig/rlimits.opt +++ mksh-59c/rlimits.opt @@ -1,5 +1,5 @@ @@ -2939,7 +3239,7 @@ +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.906 2021/01/24 19:37:31 tg Exp $"); #endif -#define MKSH_VERSION "R59 2020/10/31" -+#define MKSH_VERSION "R59 2021/05/30" ++#define MKSH_VERSION "R59 2021/07/10" /* arithmetic types: C implementation */ #if !HAVE_CAN_INTTYPES @@ -3043,7 +3343,42 @@ FN("bgnice", FBGNICE, OF_ANY --- mksh-59c.orig/shf.c +++ mksh-59c/shf.c -@@ -1206,7 +1206,7 @@ const uint32_t tpl_ctypes[128] = { +@@ -383,6 +383,8 @@ shf_emptybuf(struct shf *shf, int flags) + memmove(shf->buf, buf, + ntowrite); + shf->wp = shf->buf + ntowrite; ++ /* restore errno for caller */ ++ errno = shf->errnosv; + } + return (-1); + } +@@ -681,8 +683,13 @@ shf_write(const char *buf, ssize_t nbyte + if (shf->flags & SHF_STRING) { + /* resize buffer until there's enough space left */ + while (nbytes > shf->wnleft) +- if (shf_emptybuf(shf, EB_GROW) == -1) +- return (-1); ++ if (shf_emptybuf(shf, EB_GROW) == -1) { ++ /* truncate if possible */ ++ if (shf->wnleft == 0) ++ return (-1); ++ nbytes = shf->wnleft; ++ break; ++ } + /* then write everything into the buffer */ + } else { + /* flush deals with sticky errors */ +@@ -1063,8 +1070,7 @@ shf_vfprintf(struct shf *shf, const char + + nwritten += precision; + precision = utf_skipcols(s, precision, &tmp) - s; +- while (precision--) +- shf_putc(*s++, shf); ++ shf_write(s, precision, shf); + + nwritten += field; + while (field--) +@@ -1206,7 +1212,7 @@ const uint32_t tpl_ctypes[128] = { CiLOWER, CiLOWER, CiLOWER, CiLOWER, CiLOWER, CiLOWER, CiLOWER, CiLOWER, CiLOWER, CiLOWER, CiLOWER, CiCURLY, diff -Nru mksh-59c/debian/README.Debian mksh-59c/debian/README.Debian --- mksh-59c/debian/README.Debian 2021-05-31 00:40:08.000000000 +0000 +++ mksh-59c/debian/README.Debian 2021-07-10 20:06:04.000000000 +0000 @@ -16,12 +16,12 @@ they may be ignored and closed if reported as Debian bugs. The contact info for upstream is: -* #!/bin/mksh (or #ksh) IRC channel - at irc.freenode.net (Port 6697 SSL, 6667 unencrypted) +* #!/bin/mksh IRC channel + at irc.oftc.net (Port 6697 SSL, 6667 unencrypted) currently * mksh mailing list