Commit Graph

585 Commits

Author SHA1 Message Date
tg 3e0abff926 -DMKSH_SMALL no longer implies -fno-inline 2012-03-03 19:27:07 +00:00
tg 9f3299df4d fix regression in mirtoconf output introduced in cid 1004EFE6D783E94B328 2012-02-17 13:59:56 +00:00
tg 753891419d 10:41⎜«RT|Chatzilla:#!/bin/mksh» mira|AO: 12:08 < RT|AO> a bit fun compiling mksh in SkyOS 5.0.6753 ;-)
http://pastebin.com/GHPm1B7B
10:41⎜<mira|AO:#!/bin/mksh> .oO(wtf is SkyOS?)
10:42⎜<mira|AO:#!/bin/mksh> shf.c:453: warning: format '%zd' expects type 'signed size_t', but argument 4
     ⎜    has type 'ssize_t'
10:42⎜<mira|AO:#!/bin/mksh> lol…
10:42⎜<mira|AO:#!/bin/mksh> I’ve seen (and fixed!) that in dietlibc too, recently
10:43⎜«RT|Chatzilla:#!/bin/mksh» http://en.wikipedia.org/wiki/SkyOS
10:43⎜<mira|AO:#!/bin/mksh> shell-init: error retrieving current directory: getcwd: cannot access parent
     ⎜    directories: Not a character device ←←← huh?!?!?!
10:46⎜<mira|AO:#!/bin/mksh> looks like their POSIX layer has got issues (other than this shell-init
     ⎜    thing, umask and checks for existence upon open() are broken)
10:46⎜<mira|AO:#!/bin/mksh> but mksh is usable, I'd say
10:46⎜<mira|AO:#!/bin/mksh> “mostly”
10:46⎜<mira|AO:#!/bin/mksh> let me commit that
10:46⎜«RT|Chatzilla:#!/bin/mksh» funny posix layer bug, just like "unexpected exit status 1 (signal 1),
     ⎜    expected 1" signal bug in BeOS5
2012-02-17 09:49:45 +00:00
tg 801fdb10ca DTRT when commenting out the only instruction in an if block; spotted by RT 2012-01-04 08:56:27 +00:00
tg d7d41d9210 disable tcc’s bounds checker for now; fixes SIGSEGV-on-start on i386 (Total failed: 0; Total passed: 424) 2012-01-03 16:14:39 +00:00
tg 7ff96c3086 fix gccism; found during testing with tcc 2012-01-03 16:03:22 +00:00
tg 34036ec32e MSYS implies -DMKSH_ASSUME_UTF8=0 and thus can skip the test that’d fail 2012-01-03 01:40:15 +00:00
tg e1fa966570 if tcfn=a.exe pass mksh.exe, not mksh, to check.pl
also spotted by RT
2012-01-03 01:30:16 +00:00
tg 2578c66b61 move linkage check (which uses sh.h INCLUDES_ONLY) to when all of its
prerequisites are actually fulfilled, i.e. evrn further down than with
the last commit doing this, and move some prerequisites of stuff that
has wandered outside the !INCLUDES_ONLY block with the compile-time
assert changes to the outside, too

fixes FTBFS on MSYS which has neither <stdint.h> nor uint32_t
reported by RT
2012-01-03 00:58:09 +00:00
tg 7564594bb8 bunch of warning fixes 2011-12-31 02:54:15 +00:00
tg 7ec1ae3771 followup for cid 1004EE408E1382C1752 and 1004EE40DDD498FBB0D:
do a mirtoconf run-time check (ugh) to see whether the CPU designers
smoked/were brain-dead or if we don’t actually need the manual check
2011-12-31 02:04:18 +00:00
tg 5dbff1d56c clang doesn’t decide whether -version or --version is to be used, grml… 2011-12-31 00:31:25 +00:00
tg 68e8b5ab7c disable looking for C99 support flag in compilers (and GCC extensions)
laffer1 just pointed me to n1570 and I must say I am shocked but not surprised
2011-12-18 02:20:09 +00:00
tg ee73f691f0 clearer messages 2011-12-10 14:16:09 +00:00
tg 63b9d60b31 MKSH_DISABLE_DEPRECATED needs testsuite handling 2011-12-08 22:19:04 +00:00
tg 9b04bd65b7 rework Perl interpreter finding logic; *buntu/dietlibc-arm{el,hf} are broken 2011-12-08 22:16:42 +00:00
tg 6e010a59fb MFC recent changes to R40-stable, validate it, fix a pedantic warning 2011-12-04 19:59:33 +00:00
tg b12d31ccca improve installation instructions 2011-12-04 19:38:36 +00:00
tg da83890648 move compile-time assertions out of misc.c(#ifdef DEBUG) into Build.sh 2011-12-03 00:01:28 +00:00
tg 1ac636670f • improve comments
• do shave off 20 bytes from c_test() and get rid of the ugly stack
  variable and double “using” despite not parsing
2011-12-02 22:55:49 +00:00
tg b3f4c69f05 #ifdef MKSH_DISABLE_DEPRECATED do not compile in features scheduled for removal 2011-11-26 17:56:30 +00:00
tg 2ff9255f39 add a -f option to test.sh that runs tests of class fastbox
plus a test in that category for a bug spotted during development of
https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=shellsnippets/shellsnippets.git;a=blob;f=mksh/sysadmin/getjpics.cgi;h=d74018cbc1ae4e88408267ecc73a6df19aa4c99a;hb=HEAD
2011-11-25 23:29:31 +00:00
tg f92108dccc make MSYS match Cygwin more closely; ignore its broken <stdint.h> 2011-11-05 23:39:02 +00:00
tg d6bf9c197b better handling of eval and CPPFLAGS in build system 2011-10-07 19:51:44 +00:00
tg da80c56acb 12:23⎜<cnuke:#bosng> angefangen damit, dass es kein uname unter OPENSTEP gibt :) 2011-08-26 10:24:51 +00:00
tg 6f76d7f2fe fix… pasto, I think, from some time ago, spotted by cnuke@
12:17⎜<cnuke:#bosng> OPENSTEP hat kein dirname und $srcdir/sh.h wird dann /sh.h
2011-08-26 10:20:28 +00:00
tg 1b9bee46fc check later whether the final link may succeed, and include "sh.h" → catch inlining bugs in system headers fighting with -c combine 2011-07-16 18:03:04 +00:00
tg 851f8fb7d8 introduce MKSH_NO_EXTERNAL_CAT skipping the “call /bin/cat if we have an
option” nonsense, intended for Android, Plan 9, and other systems which
honour that cat -v is deemed harmful
2011-07-07 21:24:53 +00:00
tg 6524812f6b drop more long-deprecated things 2011-06-12 15:54:42 +00:00
tg 3589604dea Minix 3 has no _setrlimit (XXX mirtoconf that in R41) 2011-06-12 14:37:00 +00:00
tg 3695f9b259 TenDRA on Debian workaround 2011-06-05 19:55:22 +00:00
tg 4af79953d2 automatically add -fplugin=dragonegg if not there 2011-06-05 18:23:43 +00:00
tg f1661e5545 new "-c lto" (with fallback to "-c combine"), and catch build failures (lto broken, llc ENOENT, …) early 2011-06-05 18:16:19 +00:00
tg d1b8800ee8 • AIX: display OS version better (tested on 5.3 by cnuke@)
• IBM XL C: display version better (tested on V7.0 by cnuke@)
• do not 'IFS=: read nr name', Cygwin 1.7 dash fails it
• disable cd-pe, glob-range-3 on Cygwin (the former cannot
  succeed because the mv fails, the latter fails from 1.7 on)
• mark heredoc-tmpfile-8 as need-pass: no
• apply __attribute__ only to a function prototype, not to
  the body (even if static), since xlC fails that
• bump version to R40 (beta)
2011-05-29 16:31:42 +00:00
tg 6c45e3e764 avoid namespace conflicts with __attribute__(…) 2011-04-09 21:01:03 +00:00
tg d57a033057 • no longer use <stdbool.h> even if it’s available
• ensure that bool/true/false are cpp macros, overriding any pre-defined
• document the requirement that tobool(x) must map any-type 'x' into bool
• document the requirement that a bool must only be true or false, and
  that it (tobool() rather) must have an identity mapping to 'short'
• possibly fix ksh_func for/and fpFUNCTf – maybe spotted by cnuke@
2011-04-09 15:14:55 +00:00
tg 6784af6dbd • use mksh getopts to parse options in test.sh, collapse multiple -C args
• sort arguments
2011-03-28 21:15:05 +00:00
tg 79c6d6043e • introduce a virtual TARGET_OS=Android that just sets a check category
and switches to the TARGET_OS=Linux
• introduce android as regression test suite category
• add an android specific standard alias
• clean up redundant ‘-o sh’ arg in a few checks
2011-03-16 20:26:36 +00:00
tg 750ad16f3d “__attribute__((format (printf, 1, 2)))” and “#define printf printfoo”
don’t play well with each other – Bionic uses the former, unlike most…
2011-03-16 20:03:21 +00:00
tg e0c4ad7fa9 port to FreeMiNT: add OS uname and flags; 2>&- is evil™; $UNIXMODE must be preserved; unlink(2) is weird 2011-02-27 19:29:20 +00:00
tg 81b80af47a quell a warning when running with __CRAZY=Yes MKC_DEBG=cpp 2011-02-11 00:49:03 +00:00
tg 8b73363c20 query for select(2) in preparation of sleep and read-with-timeout builtins; ualarm(3) and friends are too awkward to use so we ifdef these builtins on select support ☹ 2011-02-09 19:32:26 +00:00
tg 45d99b9ec9 Scan for existence of <sys/file.h> which is not ubiquitous; allows
klibc-mksh (despite no hope to get a signal of a job) persistent history
2011-01-30 02:18:20 +00:00
tg bdfcdc56c8 introduce MKSH_NOPROSPECTOFWORK which is like pdksh’s JOB_SIGS in reverse, like MKSH_UNEMPLOYED is pdksh’s JOBS in reverse; allows mksh to work (hah! no pun intended…) with klibc (and possibly, Syllable Desktop and Plan 9) for now, until they fix their bugs 2011-01-30 01:35:35 +00:00
tg 07889fb0eb -DIN_MKSH is not used by anything 2011-01-29 19:07:16 +00:00
tg 1d6e0470e0 use header only if found 2011-01-21 20:51:56 +00:00
tg 7326331f30 RT|Chatzilla said in #!/bin/mksh that MSYS probably does mksh 2011-01-15 21:56:36 +00:00
tg ce160a8155 MKSH_SMALL need not imply !HAVE_REVOKE as default 2010-12-12 14:06:35 +00:00
tg 29de79c7bf mknod’s now demoted and only used as special-case builtin, in MirBSD only
built for the installer, to save time, as the original OpenBSD hack wanted
2010-10-08 17:56:57 +00:00
tg 3365cb8d0f • Build.sh: fix a compiler warning which, had it not been irrelevant in
a mirtoconf check, would’ve been a real problem on an LP64 platform
• sh.h: work around a bad interaction between -Wformat on gcc and manual
  string pooling for T_synerr, which is used in place of a format string
  in some places
2010-10-01 19:04:38 +00:00
tg 667d792d6a • Address concerns of Chris Palmer from the Android security team
– 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
2010-09-14 21:26:19 +00:00
tg 08862021ee add size optimisation hacks by me from Android except ifdef’d
(note, I’d prefer everyone to keep IDSTRINGs around though)
2010-09-14 21:15:11 +00:00
tg 79623f9ceb avoid more compiler warnings in mirtoconf phase 2010-08-24 15:46:06 +00:00
tg a0d43a99fd it’s ugly to write a ./stdint.h file if we can instead define the
types from sh.h; sync clog
2010-08-24 15:19:54 +00:00
tg 8b946de857 u_int32_t was only ever needed for OpenBSD’s pre-ISO-C arc4random API
since we don’t have that any longer, nuke it
2010-08-15 00:43:55 +00:00
tg 52f565f527 Tonnerre says his Linux 1.2 doesn’t have uint8_t, so check for it
and provide if necessary
2010-08-15 00:41:05 +00:00
tg f10186fedd new MKSH_A4PB cppflag: force use of arc4random_pushb(3) during seeding
just the way sysctl KERN_ARND currently is used on OpenBSD/MirBSD (for
manual packager overrides only, no mirtoconf check; e.g. for Cygwin)
2010-07-18 17:29:50 +00:00
tg 30046ffcf2 implement “live” SIGWINCH handling in the Emacs editing mode
for winstonw from IRC #!/bin/mksh
2010-07-04 17:45:17 +00:00
tg 4cbb5a9d46 to speed up mksh, get rid of arc4random(3) uses and use the LCG always;
depend on ASLR for seeding
2010-07-04 17:33:58 +00:00
tg faaa517636 • deprecate¹ -longoptions in favour of short options
‣ -combine → -c combine
  ‣ -llvm → -c llvm -O
  ‣ -llvm=x → -c llvm -o x
  ‣ -valgrind → -g²
• new option -v (version)
• new options -c (compile mode³), -o (opt flags), -O (reset opt flags)
• opt flags default to -std-compile-opts (llvm) now
• support⁴ the LLVM dragonegg plugin for GCC
• sync list of removed files (*.bc, *.ll, add missing Rebuild.sh)

① old options still valid but emit a warning
② except this one
③ compile modes are:
  • normal
  • makefile (-M)
  • combine (old -combine, new -c combine)
  • dragonegg (new -c dragonegg)
  • llvm (old -llvm, old -llvm=*, new -c llvm)
  the first two are not settable via -c though…
④ sample use:
  tg@seduxbox:~/x$ export PATH=$PATH:/opt/llvm/bin
  tg@seduxbox:~/x$ CC='/opt/gcc-4.5.1/bin/gcc-4.5.1 -fplugin=/opt/llvm/lib/dragonegg.so' sh ../mksh/Build.sh -c dragonegg -r

Thanks to «dileX:#grml» for giving ssh access.
2010-05-13 18:41:13 +00:00
tg 5abce90817 add MKSH_DEFAULT_TMPDIR 2010-04-20 17:28:20 +00:00
tg d23b94aaa0 newer SUNWcc has different error messages ☹ 2010-03-30 13:29:03 +00:00
tg f41d5ba82f allow MKSHRC_PATH to change from 「"~/.mkshrc"」, for Android &c. 2010-03-27 20:36:26 +00:00
tg ab1af5bdaf disable BGNICE by default for MKSH_SMALL 2010-03-27 15:32:58 +00:00
tg 52e9469a82 make MKSH_DEFAULT_EXECSHELL (/bin/sh) configurable, for Android 2010-03-27 15:29:00 +00:00
tg 50f081c369 even better on Haiku:
* let ulimits work
* add a Haiku-specific ulimit
* always use UTF-8, they have no locales but a UTF-8 terminal
2010-03-14 11:58:33 +00:00
tg e0f952eeda work when there is no dirname(1), e.g. 4.3 BSD Quasijarus VAX 2010-03-14 11:56:07 +00:00
tg 6f0892b3cc now, skip LDFLAGS and LIBS when using $CPP _for real_ this time 2010-03-01 08:57:45 +00:00
tg 2b2b76d1f5 here no LDFLAGS, LIBS (for cpp) 2010-02-23 22:02:35 +00:00
tg 396ebbb675 (semi-tested) clean up removing; prevent accidental rm of mksh.1 2010-02-23 22:02:19 +00:00
tg 532159415c no longer pull in libcrypt on AIX, only Interix (where it has arc4random)
tested by cnuke@ – 10x
2010-02-18 17:21:19 +00:00
tg 64044f0716 revert 1.371 and just tell people to whitelist conftest.c
now that we use the same name as quiet-by-design autoconf
to please ccache anyway (and no we will not become quiet,
I can't usually get my hand on a buildd's conftest.log)
2010-02-16 23:53:28 +00:00
tg 9ed7b897a9 place -xipo check at right position 2010-01-28 19:46:53 +00:00
tg e63c70dbf9 provide -valgrind Build.sh option which defines -g3 -DDEBUG -fno-builtin;
the latter is required to work around gcc’s strlen() reading past end of
buffer (multi-byte reads)
2010-01-28 17:03:22 +00:00
tg 6eed6635e9 check for -xipo on SUNWcc (needs -xO4 though, which I refuse to enable
automatically)
2010-01-28 15:12:34 +00:00
tg c9ac50df02 use conftest.c ipv scn.c since that’s recognised by at least ccache as magic 2010-01-25 12:16:04 +00:00
tg a82dc41e99 add an explicit message when mirtoconf+siglist generation are done 2010-01-19 14:26:24 +00:00
tg 18754d1cf8 __attribute__((used)) is not for pcc (but unused works) 2010-01-01 18:27:42 +00:00
tg 769e222586 re-vamp __attribute__ handling; let this pass on HP-UX bundled compiler
as well as HP aCC
2009-12-12 22:27:10 +00:00
tg 0c3acb2374 HP-UX IA64: +DD64 is no longer necessary with aCC (no gcc available…) 2009-12-12 21:17:25 +00:00
tg 37b1260d13 unbreak test.sh in some cases 2009-12-05 16:19:59 +00:00
tg dc98ec23a6 do not use PATH_MAX on GNU/Hurd (even if it *was* defined), but use
some glibc-only functions that don’t require its use instead

tested on gnubber, where (admittedly) sysconf(_PC_PATH_MAX) == 1024…
2009-10-27 17:00:02 +00:00
tg 9f4376d2ad GNU make needs VPATH with the for-all-make(1)s thing (at least if
the sources are in different directories, despite being listed in
${SRCS_FP} with full paths) - XXX can this work with nmake or so?
2009-10-16 18:51:30 +00:00
tg 990c9eaf0c tentatively add new -M option to generate a "Makefrag.inc" instead
of doing the actual compile (along with the usual Rebuild.sh, test.sh
and, if necessary, things such as signames.inc) for Android integration
2009-10-16 18:45:31 +00:00
tg 18c470fb3b since mksh uses /* comments with apo'strophes */ both in the copyright
and code, we MUST check if they work, since C99 apparently forbids it…
2009-10-15 16:50:21 +00:00
tg 8f3f520725 AIX {,/usr}/bin/bsh is an SVR3 Bourne Shell, according to Sven Mascheck,
so I must not use foo="…`…"…"…`…" at all
2009-10-15 12:58:34 +00:00
tg 1dfb13b603 change undef/def MKSH_NOVI into 0/1 MKSH_S_NOVI flag (with more to come:
MKSH_S_EDIT for small (Emacs) editing mode, MKSH_S_FEAT for all the dis-
abled language features), which can be set to 0 despite MKSH_SMALL being
defined to re-enable the Vi command line editing mode (which I wouldn't,
but fits into the general mastermind scheme)
2009-09-24 17:15:33 +00:00
tg f00db85c98 SUNWcc related fixes for normal and MKSH_SMALL 2009-09-23 18:22:38 +00:00
tg 31e02e59f7 add a do_realpath() implementation replacing the use of the external
libc function realpath(3) which may not be available on the target
system; compile the realpath builtin unconditionally

looks fine to me, but review is appreciated; this is (very) lightly
based upon MirBSD libc’s realpath(3) and pdksh’s get_phys_path()
2009-08-30 13:22:39 +00:00
tg aec424e631 rpmlint says that one scn.c is compiled without rpm’s $CFLAGS
it’s probably right, except, maybe it was from a CPP invocation
nevertheless it now will never call $CC without $CFLAGS et al.
2009-08-28 17:37:47 +00:00
tg 56d51abd1f need <sys/types.h> for mode_t 2009-08-08 13:52:35 +00:00
tg 0e1266ef90 While mksh R39 builds fine on MirOS #7s8E on my trusty sparc, pgcc 2.95.3
throws out quite some warnings – fix most of them except most emitted via
-Wconversion; work around some others; discard bogus warnings.

sync clog
2009-08-08 13:08:53 +00:00
tg 0d750bba12 Linux libc5 has some function protos in weird places 2009-08-01 21:58:06 +00:00
tg 5cc1722967 ULTRIX, OSF/1, Tru64, Linux 2.0: uint8_t check must come *before* the
arc4random.c source file is added to $LIBS (and related checks)
2009-08-01 21:52:02 +00:00
tg a49d855ab2 ash 0.2 (ecce!GNU/Linux 1.05) chokes on such "long" echo statements... 2009-08-01 21:51:24 +00:00
tg 587822eb4a *curses* ensure all ‘!’ are quoted, ash 0.2, ecce!GNU/Linux 1.05 2009-08-01 20:58:07 +00:00
tg cfa64cebd1 arc4random.c needs uint8_t
tested on ULTRIX
2009-08-01 20:29:02 +00:00
tg 7f5ce5e5ba oops, fix adding arc4random.c to SRCS 2009-08-01 14:12:13 +00:00
tg cb2fd22c38 "official" but unsupported printf-as-builtin code, cleaner API than
in the branch; USE_PRINTF_BUILTIN=1 to enable it (Build.sh + Makefile)
2009-07-30 19:11:12 +00:00
tg 758dc5c6fe * improve CPPFLAGS vs #define handling again: do not touch CPPFLAGS from
Build.sh but use 'if defined(PRECOND) && !defined(TOBEDEFINED)'if possible
* for all of the source code, drop annotations "imake style" (if we check
  for specific OSes, bad, instead of using mirtoconf checks proper) and
  "conditions correct?" (if I'm not entirely sure if that #if catches all
  cases and no false positives) where I can see it by grepping immediately
* bump mksh patchlevel
* refresh Makefiles
2009-07-25 21:31:27 +00:00