‣ I was convinced by several that more magic is never the solution
• fix a comment: function cat already had precedence
• change cat loader to look for existence, FPATH included, before
ditching the builtin; note that in manpage
issue spotted by carstenh, could have been a documentation ambiguity issue
(as -N was designed to read and return exactly n bytes), but this resolves
it in a way both backwards-compatible and user-pleasing
in commitid 1004D8283F068C41C3C was bogus; it fixed Jb_boin’s issue
but izabers’s 「var=foo; echo "${var/*/x}"」 was broken; in fact we
only want to not do the looping for // if the pattern matches much.
Also, fix a spelling mistake in the manpage and change some wording
to also work with associative arrays (in the future; no change).
• support NSIG_MAX from http://austingroupbugs.net/view.php?id=741
and make a TODO for later to use sysconf(_SC_NSIG) at runtime
• bounds-check signals (e.g. no smaller than 1, but smaller than NSIG)
• align trap errorlevel with other shells
• make trap match what’s in POSIX and fixup the manpage
• refactor some code related to signals
• hide from kill builtin both EXIT and ERR pseudo-signals
GNU C11 (Debian 20150413-1) version 5.0.1 20150413 (prerelease) [gcc-5-branch revision 222050] (x86_64-linux-gnu)
including ASan (testsuite) and Valgrind (short)
for mksh but not lksh; bump to R51-alpha.
While here, tweak build scripts a bit, fixup MirBSD-specific Makefile
things, remove part of a comment that’s uninteresting.
‣ : → \:
‣ alias → \alias
⇒ except in some internally used cases, where we use \builtin alias
‣ command . → \command .
• protect Korn Shell builtins from aliases and functions, e.g:
‣ typeset → \builtin typeset
⇒ also unravels the “local” alias used
‣ print → \builtin print
• protect internally-used things from aliases
‣ “let]” is not a valid function name
‣ “set” is POSIX so we don’t expect anyone to override it in a function
• use “command -v” instead of “whence -p” (“which”) in most
places; thanks izabera from #ed on IRC for pointing out
that “command -v” is POSIX – except, “whence -p” a̲l̲w̲a̲y̲s̲ looks
for an executable and shows its full pathname; “command -v”
also resolves to aliases, functions and builtins, so only use
it where it makes any sense (both never output to stderr)
• make most of dot.mkshrc work in the face of such aliases
‣ “ulimit -c” is used; this is not POSIX, and not portable;
maybe we should make ulimit accept-and-ignore the most
common limits even if the OS doesn’t use them?
• update list of builtin aliases in the manpage
• keep the Kochan book at 3rd edition because 4th is not a paper book
• keep POSIX at 1993 because I’m actually unable to find an ISBN or
other bib ref for the 2013 version…
‣ not like oksh did, but using mksh’s built-in features
• handle suggested __pure additions
• revert cid 1004F7F096867C83CF0
‣ always use our wcwidth code
‣ only use our strlcpy code if none found
• fix a couple of gcc-snapshot and clang/scan-build warnings
• mksh R49~rc1
Add a proper suspend builtin that saves/restores the tty and pgrp
as needed instead of an alias that just sends SIGSTOP. Login shells
may be suspended if they are not running in an orphan process group.
TODO: I am seriously considering following Chet and changing
the way this works, by explicitly dropping privs unless the
shell is run with -p. Every other shell does it like mksh,
except Heirloom sh, which on the other hand doesn’t know any
explicit set -p or set +p (though it doesn’t know set +foo
for any foo either).
┌──┤ QUESTION: Do we need the ability to do this:
│ tg@blau:~ $ ./suidmksh -p -c 'whoami; set +p; whoami'
│ root
│ tg
If not, I’m seriously considering to drop set ±p as well,
only parse -p on the command line, with +p being the default,
and dropping FPRIVILEGED.
Thanks to RT for noticing and jilles for initial follow-up
discussion, as well as Chet Ramey for doing the sane/secure
thing instead of following Debian.
merged:
• new regression tests
• check.pl (tests/th) better tmpfile handling
• exec.c 1.50: POSIX specifies that for an AND/OR list,
only the last command's exit status matters for "set -e"
• ksh.1 1.147: document the above
• eval.c 1.39: “Make $(< /nonexistent) have the same behaviour
as $(cat /nonexistent) wrt. errors (do not unwind and do not
treat this as fatal if set -e is used).”
‣ additionally make shf_open() return errno and actually show
the error message from the system
• regression-39 test: remove the “maybe” marker
‣ but decide on correct POSIX behaviour
already been fixed in mksh:
• check.pl (tests/th) exit 1 if tests fail
not merged:
• main.c 1.52: run traps in unwind() before exiting;
I’m pretty sure this is already working as-should in mksh
• eval.c 1.38: “Commands executed via `foo` or $( bar ) should
not inherit "set -e" status.” As discussed in IRC, this is
just plainly WRONG.
• make parsing numbers with leading digit-zero as octal independent of
mksh/lksh and dependent on set -o posix; adjust manpages to match
• warn about these changes and why mksh uses 32-bit consistent arithmetics
and point people to lksh for host-long undefined-behaviour arithmetics
• point out, explicitly, that it is *legal* for the operating environment
to make 'print $((2147483647 + 1))' (on a 32-bit system; adjust for a
64-bit system) to run 'rm -rf ~ /' instead
• correct order of built-in commands; use POSIX special versus “all others”
plus “keeps assignments” as distinction, no longer play POSIX regular vs.
others game; sync manpage
• fix LP#1156707: map (( internally to “let]” which is no valid function
name and so can’t be overridden but is unlikely to be used otherwhere
and not strictly permitted (by POSIX) anyway
• we do not need -Wno-overflow any more, either
• bump to R45
do the correct operations for comparisons (just keep using the
signed/unsigned switch from bivui for them), division (by working
on absolutes and adding the sign at the end), modulo (stupidly by
divising in signed, multiplying and subtracting, to get the sign
of the result right)
also adds rotation
XXX to check: do we need to AND before assigning the result in division?
• tty_fd is now never closed
• new tty_hasstate tracks tty_state (cf. thread around
http://article.gmane.org/gmane.os.miros.mksh/79 and PLD bug)
• as users requested, importing COLUMNS or LINES from the environment
now removes its special-ness as does unsetting it
• otherwise, setting COLUMNS or LINES is honoured until the next SIGWINCH
arrives or change_winsz is otherwise run (e.g. before displaying the
prompt in the interactive command line editing modes)
• SIGWINCH is now honoured before each reading of $COLUMNS and $LINES too
• change the Uhr to match – it no longer calls stty(1) ☺