Commit Graph

249 Commits

Author SHA1 Message Date
tg ef5a465acd fix botched testcase from 10049352E9F5DBF7056 - check.pl offers
a time-limit functionality after all...
2008-12-02 13:19:28 +00:00
tg 330948eafd add a test case for the recursion limit fix 2008-12-02 12:48:16 +00:00
tg 4897682502 Alias expansion has a recursion check which tries to break the cycle if
encountered. However, when reading end of input, the source type is set
to SEOF while popping, whereas the recursion check code only checks for
an SALIAS type.

Fix: add a new SF_HASALIAS flag; change u.tblp from being valid if type
is SALIAS to being valid if SF_HASALIAS is set; set SF_HASALIAS for the
created SALIAS sources; set SF_HASALIAS and u.tblp when creating SALIAS
whose next is SEOF on the SEOF source as well.

Reported by Michael Hlavinka as Redhat Bug #474115
2008-12-02 12:39:38 +00:00
tg 177f707a9f ah, so this is how it fails, in a function! 2008-11-30 16:57:40 +00:00
tg 667c0ba026 add another regression test (XXX why did a similar thing fail?) 2008-11-30 16:53:15 +00:00
tg 65b1e6c09c forgot to bump version here too
savings: 523 .text, 16 .data, 32 .bss (small), ceteris paribus (full)
2008-11-30 10:45:42 +00:00
tg 3c1e46ee4d prepare for aalloc.c, which I have just written myself, as an area-based
allocator using malloc and free, with mmap malloc and omalloc in mind,
not counterfeiting its security measures such as guard pages, and having
some of our own, e.g. XOR random cookies, optional mprotect, etc.

zero cost (for we have arc4random())
2008-11-12 04:55:19 +00:00
tg 2a0e181a70 work around even more format string warning stuff 2008-11-10 19:33:08 +00:00
tg 65b1923b61 build warning-free with LLVM+Clang on MirBSD itself
$ (CCC_LD=mgcc CC=ccc sh Build.sh -r && ./test.sh -v) 2>&1 | tee log
Total failed: 2 (as expected)
Total passed: 278

Just the result is huge, and we could of course build to intermediate
byte code to optimise globally…
2008-11-09 20:32:18 +00:00
tg 446e019c07 the QNX /bin/ed problem is worse than thought; use a new mechanism,
because categories in check.t are OR’d:
• no-stderr-ed disables the newish-ed tests (tried using testcase)
• stdout-ed enables the oldish-ed tests (variable, if the above
  testcase succeeds, it’s added, but QNX overrides the variable)
2008-11-08 17:36:35 +00:00
tg 6e490218ca On QNX, do not run the tests involving /bin/ed at all, because it appears
oldish but is in fact broken. However, if /bin/ed is MirBSD ed(1), these
actually pass.
2008-11-02 23:03:45 +00:00
tg 89e96b6c86 experimental support for <strings.h>
cf. http://www.opengroup.org/onlinepubs/009695399/basedefs/strings.h.html
QNX seems to bury some functions in there
2008-11-02 22:29:36 +00:00
tg 88d7b7d08b • rewrite code to no longer use statements-as-expressions
• optimise a little
• Build.sh: remove HAVE_EXPSTMT test
• Build.sh, */Makefile: sort tests, regenerate
• mksh.hts: sync clog
2008-10-28 14:32:43 +00:00
tg 8230c9d8ae • do not use __typeof__ even if we have statements-as-expressions, to
please pcc, prompted for by Anders “ragge” Magnusson, problem spotted
  originally by Adam “replaced” Hoka
  ⇒ rewrote x_bs2() and utf_backch() into a combined x_bs3() function,
    since these are never used in any other way
• whitespace cleanup, while here
2008-10-26 20:59:40 +00:00
tg bc046dd8f2 this will most certainly be mksh R36 2008-10-24 21:35:43 +00:00
tg 331b45af7d • OSF/1 may not have MAP_FAILED defined either
XXX mmap() works only on devices on some DEC OSes, not on files, so,
  XXX instead, it were best to disable it altogether
• bump date
2008-10-24 19:54:23 +00:00
tg 0c2de1902c • change mksh to only then behave more POSuXish when called as /bin/sh or
“-sh” if -DMKSH_BINSHREDUCED was passed during compilation, for example
  for Debian, but d̲e̲f̲i̲n̲i̲t̲i̲v̲e̲l̲y̲ n̲̲o̲̲t̲̲ for MirBSD™
• split up regression test to force this behaviour
• remove the gunk from our MirBSD™ startup scripts again
• mention arc4random.c changes on website, sync clog, warn packagers
2008-10-20 19:29:25 +00:00
tg 2fc9fb99d7 when doing a history search (^R), restore old input line on
abortion (^G – ^C is SIGINT and doesn’t work like this, but
that’s actually good IMO)

prompted by enquiry about the Emacs editing mode by <smultron:#MidnightBSD>
2008-10-19 20:15:45 +00:00
tg 9be489ea90 use less stack storage, prefer .bss storage (saves us a memset() call)
and .data instead of another initialisation; this was prompted by a bug
in scan-build (the value can never be NULL, but it doesn’t realise it),
although this doesn’t fix it, but less stack usage is always good
2008-10-15 10:25:01 +00:00
tg c11187f993 fix some of the things scan-build[1] found (but not some false positives)
10x

From: Elias Pipping <elias@pipping.org>
[1] http://clang.llvm.org/StaticAnalysis.html
2008-10-13 23:06:04 +00:00
tg 37934a07cf fix prodded by cnuke@ for AIX with IBM xlC 7.0:
fool the compiler into not doing static bounds checking when we do
one-past-the-array-boundary pointer assignments for cases where the
only accesses are like (*--pointer); bump version
2008-10-10 21:30:43 +00:00
tg 5d9e4c9e16 unbreak MKSH_SMALL after x_histp related changes 2008-10-05 16:06:43 +00:00
tg 27ee1866fe implement Message-ID: <20081004171903.GA14184@boetes.org>
in a somewhat hackish way, and it’s still quite different from zsh,
but probably closer to a desired functionality

XXX this makes state by abusing 「modified」 and 「xmp」 (“the mark”).
2008-10-04 23:08:04 +00:00
tg 9cd963ea45 • check.t: change history-e-minus-5 regression test to avoid false failure
caused by ignoredups history control
• histrap.c: enable ignoredups after fc -s editing too
2008-09-30 19:36:16 +00:00
tg b24dc6e725 add regression tests, sync manpage, bump version number 2008-09-30 18:43:07 +00:00
tg b65a7f7f9e bump mksh patchlevel for today’s sorta-tested half-done changes, with more
to follow (see <Pine.BSM.4.64L.0809201417560.22066@herc.mirbsd.org>), as I
probably am not going to hack any more tonight
2008-09-20 19:18:00 +00:00
tg a9342be98a work around GNU getopt(3) violating every single standard in existence 2008-09-19 10:41:55 +00:00
tg 8a853f24be • bring back automatic turn-on of FPOSIX if called as sh/-sh
‣ only if !MKSH_SMALL
  ‣ add appropriate regression test
• if FPOSIX is set, do not close fds > 2 on exec, Debian #499139
• add appropriate regression tests for keeping fds private or not
2008-09-17 19:31:30 +00:00
tg 977237ad14 • merge vi_reset() and edit_reset() into x_vi() to allow for following:
• fix vi mode (which, however, is officially orphaned) multi-line $PS1 by
  using a similar algorithm for prompt skipping as emacs mode (changing
  the meaning of prompt_trunc variable and using prompt_redraw, just even
  more efficiently than vi mode); reported by asarch via IRC
• fix multi-line prompts if last line is “too large” by using emacs mode
  algorithm of just internally appending a newline, while here ☺ this even
  saves us having to re-add the prompt_skip variable…

WARNING: this is only barely tested, as almost nobody ever uses vi mode
⇒ test yourself, there may be bugs (e.g. off-by-ones); already known is
  that the vi input line editing mode is NOT multibyte safe…
2008-09-14 20:24:59 +00:00
tg 9ab67aa02f • merge final version of the stack-free diff as committed by jaredy@openbsd
thanks for helping with the bug
• merge RCS IDs
• bump mksh version
2008-08-02 17:45:12 +00:00
tg 68e028ea4b fixes for constant conditionals, from gcc-4.2 fat binary building 2008-07-18 11:33:13 +00:00
tg eb2db9a35e add comment 2008-07-17 13:00:38 +00:00
tg 828fc5cd8b merge OpenBSD’s non-standard <bsd.regress.mk> tests 2008-07-17 12:57:59 +00:00
tg 5f0269ed9a fix attempt to free pointer to stack (function-local storage)
discovered by Elias Pipping
patch by Jared Yanovich
alloc/afree checker by Todd C. Miller
2008-07-14 12:29:06 +00:00
tg f47d20bc85 bump version 2008-07-12 18:09:37 +00:00
tg 1619fa2538 • Build.sh, check.t: bring back the 'smksh' check category, which was
missing for a while yet its disappearance was unnoticed because…
• distrib/special/mksh/Makefile: sync check categories, this was missed
• mksh.hts: sync clog
2008-07-11 19:51:23 +00:00
tg 81a2b6d878 cygwin has... interesting fs semantics (I got an unaccessible yet
undeletable file on running this manually, which vanished after the
parent(!) process exited), so disable this test for it
2008-07-11 00:23:59 +00:00
tg 99ccfb4024 bump versions (since we lowered the fd limit again) 2008-07-10 21:55:08 +00:00
tg 552d3408e7 oops, only half commit 2008-07-10 21:25:00 +00:00
tg c01bda573f switch back to en_US.UTF-8 for GNU/* too: Mandriva has issues with
en_US.utf8, and Debian (tested on gnubber) can do both
2008-07-10 21:20:22 +00:00
tg 93fcb5a892 on Solaris, this testcase won't produce the issue, but let's pass the test☺ 2008-07-10 20:05:01 +00:00
tg 7c7ecc33be • remove bizarre test constraint
• make a test succeed on Tru64, whose cat likes to output
  │Successful
  │cat: output error
  on this test case
2008-07-10 19:06:15 +00:00
tg ca7cd043db • bump NUFILE and FDBASE, allowing for more than 10 fds used by scripts
• change the code to accept more than a single digit for an fd
2008-07-09 21:32:45 +00:00
tg f4790e8773 add another corner case of here documents, which bash and zsh pass
inspired by:
20:14⎜«twkm:#ksh» $ unset foo ; read -u10 foo 10<<< bar ; echo $foo
which works in ksh93 (whose fd>9-support is still incomplete though)
2008-07-09 20:31:19 +00:00
tg 8f7d2292a8 Debian GNU/kFreeBSD $^O value, 10x tarzeau 2008-07-08 22:29:00 +00:00
tg 064ae65dee reverse the sense of check for en_US.UTF-8 vs en_US.utf8:
the latter is required by HP-sUX, okay, and apparently the
preferred one by glibc (GNU libdrepper?), but breaks on al-
most all other systems I have access to (Slowlaris, Midnight
DragonFly NetBSD, Darwin, at least)
2008-07-08 20:54:33 +00:00
tg 3800eed855 NetBSD® 3.0_STABLE is a tad picky about the UTF-8 locale’s naming… 2008-07-08 20:08:02 +00:00
tg d415592b37 check return value of unlink(2) when trying to remove an existing HISTFILE,
since mksh(1) did go into an infinite loop if that fails first

bug spotted, initial patch and help drafting a test case
From: Decklin Foster <decklin@red-bean.com>

note there are more instances of unlink(2) and others (like chmod(2), as
spotted by flawfinder) which aren’t checked… but at least the other case
of unlink(2) use in histrap.c doesn’t cause any trouble (I think)
2008-07-06 22:41:09 +00:00
tg c77d67ef4d • add code to support GNU bash’s “&> file” I/O redirection extension,
and make it fit into mksh’s model (also gives us a couple of things
  GNU bash doesn’t have
• add regression tests for all of these

Lukas “smultron” Upton from MidnightBSD spotted a script with /bin/sh
shebang invalidly using “&>” in some Apple backup toolkit, 10x

XXX why fds are limited to one digit?
2008-06-28 22:51:56 +00:00
tg a89db7b95b Darwin also has other locale 2008-06-21 19:30:49 +00:00