• in interactive mode, always look up {LC_{ALL,CTYPE},LANG} environment
variables if setlocale/nl_langinfo(CODESET) doesn’t suffice
• add the ability to call any builtin (some don't make sense or wouldn't
work) directly by analysing argv[0]
• for direct builtin calls, the {LC_{ALL,CTYPE},LANG} environment
variables determine utf8-mode, even if MKSH_ASSUME_UTF8 was set
• when called as builtin, echo behaves POSIXish
• add domainname as alias for true on MirBSD only, to be able to link it
• sync mksh Makefiles with Build.sh output
• adjust manpage wrt release plans
• link some things to mksh now that we have callable builtins:
bin/echo bin/kill bin/pwd bin/sleep (exact matches)
bin/test bin/[ (were scripts before)
bin/domainname=usr/bin/true usr/bin/false (move to /bin/ now)
• drop linked utilities and, except for echo and kill, their manpages
• adjust instbin and link a few more there as well
– possible integer overflows in memory allocation, mostly
‣ multiplication: all are checked now
‣ addition: reviewed them, most were “proven” or guessed to be
“almost” impossible to run over (e.g. when we have a string
whose length is taken it is assumed that the length will be
more than only a few bytes below SIZE_MAX, since code and
stack have to fit); some are checked now (e.g. when one of
the summands is an off_t); most of the unchecked ones are
annotated now
⇒ cost (MirBSD/i386 static): +76 .text
⇒ cost (Debian sid/i386): +779 .text -4 .data
– on Linux targets, setuid() setresuid() setresgid() can fail
with EAGAIN; check for that and, if so, warn once and retry
infinitely (other targets to be added later once we know that
they are “insane”)
⇒ cost (Debian sid/i386): +192 .text (includes .rodata)
• setmode.c: Do overflow checking for realloc() too; switch back
from calloc() to a checked malloc() for simplification while there
• define -DIN_MKSH and let setmode.c look a tad nicer while here
fix the regression test’s results while here, which have been
broken since cid 10049D9BE5254CE65B8
• get rid of separate copyright file which was intended for De-
bian; track down commits in all files of oksh-mirbsd and mksh
to get correct copyright years per-file, as is BSD custom
similarily simple one from scratch, which however performs
better than espie's with AFREE_DEBUG enabled which took away
the benefit of the double-linked-list approach
all of (core) mksh is now MirOS licenced
was hard to type and hard to fix, galloc is also hard to fix, and some
things I learned will probably improve things more but make me use the
original form as base (especially for space savings)
* let sizeofN die though, remove even more casts
* optimise, polish
* regen Makefiles
* sprinkle a few /* CONSTCOND */ while here
we still have issues:
(gdb) r
Starting program: /usr/obj/bin/mksh/mksh -c print\ \$KSH_VERSION
mksh in free(): error: modified (chunk-) pointer
Program received signal SIGABRT, Aborted.
note: there’s still a readlink(1) call left in, for instance, mirmake;
this does not hurt because we initially assumed that readlink(1) does
exist anyway and bundled ours just because some do not have the ‘-f’
option for realpath(2)isation
‣ I/O redirection seems broken:
$ (date; date >/dev/null; date) | wc -l
1 (expected: 2)
‣ other than that: working fine
‣ -YBSD (default) and -YSYSTEM_FIVE don’t work, just -YPOSIX, somehow
• Fix $(…) to `…` for OSF/1 V2.0 /bin/sh
‣ this compiler is FUBAR though:
$ cat >t.c
main() { return (foo()); }
$ cc t.c
ld:
Unresolved :
foo
$ echo $?
0
$ ls -l a.out
-rwxr-xr-x 1 mirbsd users 10835 Jul 21 17:12 a.out
‣ it seems to have ucode, but man is not installed
• new mirtoconf check: mkstemp(3)
• if !HAVE_MKSTEMP (Ultrix), use tempnam(3)
• only use printf(1) if it exists (it doesn’t on Ultrix)
• a few more signals
• add S_ISLNK if the OS doesn’t define it
• add strcasecmp(3) proto for Ultrix (it _is_ in <portability.h>, but
only for -YBSD I think)
• fgrep(1) on Ultrix doesn’t do “-e ① -e ②”
10x DEChengst:#UnixNL for giving access
any more either, and can make use of code sharing between detection
of sys_siglist and sys_signame (and the underscored variants); nuke
the now-useless signames.c file too (merge struct into histrap.c)
car only slower, yes this is possible, and the resulting binary passes the
testsuite just fine), the definition of __RCSID() in <sys/cdefs.h> expands
to something with __attribute__((used)), which triggers a warning, because
__attribute__ in general is supported but the used attribute isn't. Thusly
always use our own strings and get rid of the MULTI_RCSID test (introduced
because __RCSID() on Darwin is inferiour).
Maybe we should fix <sys/cdefs.h> too? #ifdef __SUNPRO_C helps here.
XXX u_int32_t is not ISO C99, but seems to work well enough
XXX if it fails anywhere, we'll see in the build logs
XXX apple doesn't have the standard uint32_t and API doesn't specify it
• sys_siglist_defn: rename to sys_siglist_decl as we're really checking
for the declaration in the headers; change wording to “check if … does
not need to be declared” since we don't need to declare if we don't use
• scan for arc4random, arc4random_push, confstr declarations too
• sh.h: confstr declaration is no longer #ifdef __sun__; sort