• ord() new, From: Daniel Richard G. <skunk@iSKUNK.ORG>
‣ used in some places
• (c - '0') → ksh_numdig(c) # may take *x++ argument
• (c - 'A') → ksh_numuc(c) # may NOT take *x+= argument
‣ idem for ksh_numlc(c) and 'a'
‣ these need changing for EBCDIC
‣ add testsuite for this
• use macros more, they exist already often
• use digits_lc[foo] instead of ('0' + foo), especially for letters
• caught another ksh_eq case…
• also caught a maybe-UB overflow check, but we don’t have TIME_T_MAX ☹
so we mitigate a bit (in var.c mostly) and tweak another type already, and
add some checks (mksh_{,u}ari_t must fit into {,unsigned }long) and print
line numbers with %lu already
bug initially found by Pawel Wylecial (LP#1440685)
additional bug found and suggested fix by enh (elliott hughes)
This commit also renames struct ioword.flag to ioflag to disambiguate
it from other members named “flag”, changes it to an unsigned type,
and packs ioflag and unit into shorts each, to make the struct smaller
(aligned even: 16 bytes on 32-bit systems) and reviews some of the
code involved in fd handling, though there wasn’t much to be found.
‣ : → \:
‣ 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
• all: bump version to R50-current; add more comments; whitespace
• all: remove all mkssert(); we’ll do full re-runs of scan-build and,
hopefully, Coverity Scan/Prevent
• check.t: fix a testcase (sed could exit false, but we don’t care)
• eval.c: fix tilde_ok data type (only unsigned may shl constantly)
• exec.c: fix shebang buf array accesses to always go via uint8_t *
‣ 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.
Whenever the SIGEXIT trap was set (to anything, really)
syntax errors and interruptions were not ignored any more
in an interactive shell (where they should be, unless
set -e is used); fix that.
tbd: traps should probably only be marked as pending
and run for LLEAVE/E_NONE
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.
• sig_t detection was a bit insane, it is a function-pointer type after all
• fix uninitialised variable in c_select which led to mistakenly accepting
invalid (nōn-numeric) input and acting, randomly, upon it
• keep SIGCHLD blocked in child after forking longer, for job list manip
• block SIGCHLD ifdef DEBUG_LEAKS to not run job foo during/after afreeall
• fix annoying ISO C90 vs. C99 (un)signed constant warning
command; setting one still unsets the other at first)
• Change subst_exstat to be conformant unless -o sh is set and -o posix isn’t
• In lksh, make subst_exstat (newly) conformant if -o posix
• New MKSH_BINSHPOSIX to accompany MKSH_BINSHREDUCED
• Sync lksh manpage precisely
• 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
that get used, plus one for the realpath-1 regression test; also make
sys_siglist_decl detection nicer and poison strerror() with non-const
return value ifdef DEBUG, make it always const