Commit Graph

187 Commits

Author SHA1 Message Date
tg dffb1ab915 put list of check_categories into Makefrag.inc generated; bump patchlevel 2013-02-18 22:55:40 +00:00
tg b684a7c6bd backpedal with $'…' and $"…" interpolation
it turns out this breaks more legacy scripts than anticipated
2013-02-17 05:40:17 +00:00
tg 85d7059c48 … I fsck’d up and built R42b from MAIN ipv mksh-R42stable… oh well.
TODO: convert enum to something like uint8_t to save even more space
2013-02-16 00:21:57 +00:00
tg ce602be6be sync clog et al. 2012-12-17 23:46:33 +00:00
tg 68b1abe64d force HAVE_SILENT_IDIVWRAPV=0 for test-build, since it’s used by me to
generate the CPPFLAGS for mksh for base and installer, and it’s archdep
2012-12-17 23:37:44 +00:00
tg ce6cdb96f2 regenerate Makefiles 2012-11-30 20:49:18 +00:00
tg 9f15657f7b make cats more flexible 2012-11-26 16:39:43 +00:00
tg 2fc5aa487b RT tells me Minix 2 (i386) also doesn’t have gettimeofday(2) 2012-11-20 18:50:46 +00:00
tg 77f5b8f38d add split-screen debugging; close-on-exec the logfile 2012-10-21 17:16:45 +00:00
tg b3c7268f02 gzip the catmanpage, the text page and the HTML page 2012-10-14 16:22:49 +00:00
tg b2e4f0b63e add code to preformat manpages, for lesser OSes such as NetBSD® 2012-10-14 14:51:08 +00:00
tg 798cfdc982 add test-build-lksh developer target 2012-07-01 15:54:36 +00:00
tg c1f821d4e5 (mksh) tighten 32-bit requirements; (lksh) switch to long; allow any bitness 2012-06-28 20:17:39 +00:00
tg f34cae3997 keep up 2012-05-04 22:44:34 +00:00
tg 5eea59ad57 rewrite maketemp() obsoleting tempnam(3) and mkstemp(3) external deps 2012-04-14 16:07:48 +00:00
tg 5b4d0dbbc5 drop all deprecated code, you have been warned 2012-04-07 11:19:53 +00:00
tg 6dd03ddfad pass the version to avoid stale Makefile.inc files 2012-03-27 23:13:42 +00:00
tg 95a2c63096 • implement fcntl(2)-based advisory locking as an alternative iff flock(2)
is not found, from a suggestion by RT (LP: #912691)
• try harder (in a loop) to acquire a file lock if the locking mechanism
  documents EINTR is a possibility (fcntl always, flock on Linux not .Ox)
• use -std=c99 not -std=gnu99 if it must be at all
2012-03-27 22:36:53 +00:00
tg e3b9f14d88 You have this ↓ guy a lot to thank for.
00:45 -!- variable [root@freebsd/developer/variable] has joined #!/bin/mksh

• +b *!*root@*, +b $a:root, +b $r:root on one more channel
• certain checks to prevent:
00:47 < variable> wjcw: sh.h:308: error: conflicting types for 'getrusage'
01:19 < variable> oh
01:19 < variable> I needed to run Build.sh
2012-03-27 21:23:52 +00:00
tg c5cc22a13f efficient debug-to-file output (/tmp racy, but hey) 2012-03-23 19:38:12 +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 a0dd6b5366 disable deprecated code on MirBSD-current mksh-current (note: next to deprecate is support for parsing $((010)) as octal, which is agreed gecko2@ tonight at the Jugo already) 2011-12-08 22:19:16 +00:00
tg 0695039dc0 fix stateptr-underflow; really do call fastbox regression checks; bump vsn 2011-11-26 00:45:21 +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 c2f994f6f1 unbreak test-build with printf 2011-10-07 19:51:17 +00:00
tg e39dea490f sync… various things 2011-04-09 18:47:14 +00:00
tg a796512040 • more comment and int→bool cleanup, add and improve some comments
• 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
2011-02-11 01:18:23 +00:00
tg c4e5678c0e regen 2011-01-30 02:28:31 +00:00
tg 07889fb0eb -DIN_MKSH is not used by anything 2011-01-29 19:07:16 +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 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 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 e520cee572 sync 2010-07-04 17:41:39 +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 345030a578 we need more RCS IDs! 2009-08-27 16:52:12 +00:00
tg 848edc698c sync cleandir target 2009-07-30 19:18:06 +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 571546c562 • Check if killpg(3) is available; if not, use kill(2) with negative
process ID and hope it works (is POSIXly killpg-endowed)
• bump version
• sync clog
2009-06-08 20:34:40 +00:00
tg b145ca5c9f • sync distrib/special/mksh/Makefile with bin/mksh/Build.sh and
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
2009-05-16 16:59:42 +00:00
tg 56c6e384e6 (experimental) implement getrusage via times if not found 2009-04-03 09:39:07 +00:00
tg ca539f08f0 remove espie's double-linked-list based allocator and write a
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
2009-03-22 16:55:38 +00:00
tg 31d1499219 * back out almost all of the memory allocator related changes, as aalloc
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
2008-12-13 17:02:18 +00:00
tg d97691ca61 by the principle of the working tree, we cannot enable aalloc as of now.
damn, pointers in C are so uselessly complicated… in asm it’s much easier
2008-11-17 01:14:57 +00:00
tg 90e8e7ea72 rewrite the cookie logic… while this is better than previously,
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.
2008-11-15 11:42:18 +00:00
tg 255c77ff32 use -DAALLOC_TRACK in MirOS-current but not releases, similar to
-DMKSH_AFREE_DEBUG, which is even similar in functionality

cost 412 code, 32 bss
2008-11-12 07:38:42 +00:00
tg d099b00b53 leave at least a working tree, with zero-penalty -DAALLOC_NO_COOKIES
XXX cookies are still broken?

cost for aalloc.c: data -= (4, 0, 4, 0); text += (1665, ?, 2115, 2217)
2008-11-12 07:36:19 +00:00
tg d15671f6f6 fix first batch of compile warnings, enable aalloc for mirbsd 2008-11-12 04:59:42 +00:00
tg 17ecb986c8 regenerate CPPFLAGS 2008-11-02 22:42:37 +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 5167e7398b sync MirBSD-specific mksh Makefiles after recent Build.sh changes 2008-10-26 22:03:05 +00:00
tg 94b7792718 use mksh realpath builtin instead of readlink -f for canonicalisation
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
2008-10-05 16:26:13 +00:00
tg a30066cd6f run millert’s afree checker by default (idea from openbsd) if MirOS-current
and not MirOS-stable (via DEBUGLIBS from <bsd.own.mk>)
2008-08-02 17:40:37 +00:00
tg 5d73013c02 remove check_category “pdksh”, it starts to make trouble and was never
taken seriously anyway, just historic ballast
2008-06-21 19:20:15 +00:00
tg b41a72ac2e add new builtin “realpath” calling realpath(3) on its argument, skipping
over “--” for compatibility to Debian realpath(1) and possibly busybox’

“sounds handy” replaced@TNF
2008-05-17 18:27:57 +00:00
tg 604ec0ff6c remove dead code and ifdefs, speed up configuring 2008-05-04 01:51:31 +00:00
tg d6f3f726a6 clean up unused defines 2008-04-20 02:15:12 +00:00
tg aacc0b2179 • Build.sh: be a little more explicit about the unknown compilers
• Build.sh: add another one
• */Makefile: sync CPPFLAGS
2008-03-27 22:44:17 +00:00
tg def9c172df • Add support for Ultrix 4.5 and ucode cc (?)
‣ 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
2008-03-25 21:34:45 +00:00
tg 845f6f0d64 • check for flock decl too (weird on OSF/1: if !POSIX and BSD)
• un-experimental Tru64
2008-03-05 18:49:15 +00:00
tg 3d9bd0e1f0 OSF/1 doesn’t seem to declare revoke(2) anywhere 2008-03-05 17:06:50 +00:00
tg 8d170a3d01 fix on Interix, where tr(1) is more weird than even Solaris’ XPG4 one…
just do not use ranges, no matter what.
2008-02-29 16:38:41 +00:00
tg d17e25c7f4 fix passing of env var to regression tests 2008-02-29 11:57:30 +00:00
tg 6d2a011a93 be more quiet at test-build time 2007-10-25 14:43:02 +00:00
tg f8ead8ae27 sync w/ current Build.sh 2007-10-14 13:36:40 +00:00
tg 87eeeb6da0 revert the -std=gnu99–by–default change until programmes are ready, as this
is too much annoying (for now) – extra commit so that we have a changeset
2007-08-24 14:25:33 +00:00
tg c8ac9422f9 • add -std=gnu99 to default CFLAGS
• first round of assorted fixes
2007-08-24 14:19:56 +00:00
tg 499327f7b8 add “set -o arc4random”, RTFM for details 2007-08-12 13:42:23 +00:00
tg 496b8f4dc3 • new way of checking for mknod & friends, due to tcc vs glibc weirdness
• bump vsn for the code restructuring
2007-07-31 11:11:25 +00:00
tg f948c13a78 • fix display problem
• add <libutil.h> if it exists – revoke(2) on UWIN
• add <stdlib.h> for NULL in test of mmap(2)
• regen CPPFLAGS for MirBSD native builds
2007-07-01 21:47:08 +00:00
tg 91431e4cf6 with this, we don't need the special list of pre-known signal names
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)
2007-06-05 21:47:49 +00:00
tg 63c31c43e3 fix for the SUNpro 8 on yofuh's E420:
cc: Sun C 5.8 Patch 121015-04 2007/01/10
2007-06-05 19:48:47 +00:00
tg dee38c5be7 sync 2007-06-04 21:55:38 +00:00
tg 6e1bfd6e4b When compiling native MirOS BSD binaries with SUNpro 12 (don't look like a
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.
2007-06-04 21:27:53 +00:00
tg 63623bb479 we don't have -d in mksh R30β any more 2007-05-24 09:06:31 +00:00
tg 1a0b51b697 • arc4random, arc4random_push: use our own protos to check
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
2007-04-24 10:42:02 +00:00
tg 615a7794a6 AIX has sys_siglist[] but doesn't define it anywhere, so add a means to
scan for defns and use it here; bug reported by Kurt Telep
2007-04-23 20:37:16 +00:00
tg c79cacdfa5 • from a MirOS point of view:
place most stuff from /etc/profile in /etc/skel/.mkshrc; admins must make
  sure to copy this file to users' homes on upgrade (benefit: non-login but
  interactive shells also get all the goodies); fix some quoting; simplify,
  reformat, change comments
• from an mksh point of view:
  slight internal changes in dot.mkshrc; external commands are now prefixed
  with “ulimit -c 0”; $TERM is defined; improvement in determining the host
  name (e.g. on Debian if a FQDN is not given); declare locals as such both
  in $PS1 and outside; remove superfluous quoting, quote properly; simplify
  hd alias, add rot13 alias; place RCS ID at the bottom
2007-04-16 18:54:37 +00:00
tg 0a20bb8dd4 • Minix 3 doesn't have <sys/mman.h>
• Some OSes might need <stdint.h> for int32_t (Minix 3 with GCC)
2007-03-04 04:36:45 +00:00
tg 83c2ee87f4 • remove strcasestr.c, use home-grown implementation¹, call it stricmp,
and have it return an API-correct const char *
• enhance and stylify comments
• a little KNF and simplifications
• #ifdef DEBUG: replace strchr and strstr with ucstrchr and ucstrstr
  that take and return a non-const char *, and fix the violations
• new cstrchr, cstrstr (take and give const char *)
• new vstrchr, vstrstr (take const or not, give boolean value)
• new afreechk(x) = afreechv(x,x) = if (x1) afree(x2, ATEMP)
• new ksh_isdash(str) = (str != NULL) && !strcmp(str, "-")
• replace the only use of strrchr with inlined code to shrink
• minor man page fixes
• Minix 3 signames are autogenerated with gcc
• rename strlfun.c to strlcpy.c since we don't do strlcat(3) anyway,
  only strlcpy(3), and shorten it
• dot.mkshrc: move MKSH=… down to the export line
  to not disturb the PS1 visual impression ☺
• dot.mkshrc: Lstripcom(): optimise
• bump version

¹) side effect from creating API-correct cstrchr, cstrstr, etc.
   uses goto so it must be better ☻

tested on mirbsd-current via both Makefile and Build.sh
2007-03-04 03:04:28 +00:00
tg 62b347a1b0 merge the const branch +- a few 2007-03-04 00:13:17 +00:00
tg 90af366ee0 sync 2007-03-03 21:48:33 +00:00
tg e0e4c992fc • embed MKSH_ASSUME_UTF8 and MKSH_NEED_MKNOD in Build.sh
• have mksh with BSD makefiles always enable MKSH_ASSUME_UTF8
• sync BSD makefiles with Build.sh output
2007-02-18 16:24:13 +00:00
tg a0fcdecb75 add new #ifdef MKSH_ASSUME_UTF8 which saves us from needing to
call setlocale() if we know the result will always be UTF-8
2007-02-10 21:59:15 +00:00
tg 6d157ffe47 autoscan for persistent history support 2007-01-18 16:05:05 +00:00
tg 7b903e4aa9 header overhaul: replace all #ifdef __OS__ with mirtoconf checks
(except the persistent history one)
2007-01-18 15:50:32 +00:00
tg 8df4639675 * new target 'test-build' to easily check Build.sh operation from mbsd
* regen CPPFLAGS+= stuff with 'test-build'
2007-01-18 01:24:46 +00:00
tg 65a2806e81 scan for revoke() 2007-01-17 23:27:47 +00:00
tg af606537e2 if we don't have rlim_t, assume it's long 2007-01-17 23:18:55 +00:00
tg ddd2dac47d * support old environments without libgen.h (ancient GNU/Linux)
and stdbool.h (ancient GNU/Linux; NetBSD® 1.6.1)
* __dead must come after, not before, to accomodate gcc 2.7.2.3
2007-01-17 22:51:47 +00:00
tg ceb5a7dba0 check if __RCSID() can be used multiple times; req'd eg. on Mac 2007-01-17 21:42:23 +00:00
tg cff011696e clean regress-dir before re-using 2007-01-12 01:11:03 +00:00
tg 2f15a11c55 Clean up the signal mess, saves 172 Bytes:
* 'sigseen' in Build.sh goes away
* Signal name existence is checked in this order:
  have our own¹ -> sys_signame[] -> _sys_signame[] -> build our own²
* Signal description existence is checked in this order:
  sys_siglist[] -> _sys_siglist[] -> strsignal() -> NULL³
¹ Predefined list of items, for operating systems where we
  cannot build² them, i.e. Plan 9 and Minix 3 (e.g. no $CPP -dD)
² The usual cpp(1) stuff
³ Changed later, see below
* Make $CPP test dependent on $NEED_MKSH_SIGNAME (others can
  be added here, this is not absolute)
* Make signal name list generation² dependent on $NEED_MKSH_SIGNAME
* Fix check if the generation worked
* Guarantee that sigtraps[*].name and sigtraps[*].mess are valid
  C strings; this makes the code shorter *and* removes a few pos-
  sible nil pointer dereferences
* Embed autoconf'd usages of sys_sig* / strsignal / mksh_sigpairs
  into inittraps()
* Check for each signal 0<=i<=NSIG that
  name is not NULL or "" -> replace with ("%d", i)
  mess is not NULL or "" -> replace with ("Signal %d", i)
  name does not start (case-insensitive) with "SIG" -> name += 3
* In gettrap(), fix check if signal name starts, case-sensitive
  or case-insensitive, depending on need, with "SIG" (bug from millert@)

Other changes:
* Build.sh: ac_test[n]() are documented
* Build.sh: ac_test[n]() can have negative prereqs as well now
* Build.sh: use <<-'EOF' consistently
* bump patchlevel to today
2007-01-12 00:25:40 +00:00
tg 623bf49f19 order the same way as Build.sh outputs them 2006-11-12 13:21:50 +00:00
tg df01c5b051 strcasestr, oops 2006-11-12 13:19:06 +00:00
tg a799f50fea scan for setresuid/setresgid and setgroups
no alternative implementation yet
2006-11-12 12:56:10 +00:00
tg 617950554f missed these 2006-11-09 15:03:56 +00:00
tg 0307ecb492 * instead of including <sys/cdefs.h> (not in Solaris), we hope <sys/types.h>
includes it for us
* autoconf-test for <sys/param.h> (not in SUSv3) existence
2006-11-09 00:11:39 +00:00
tg 11fbdb4378 implement autoconf tests for langstuff; sync date 2006-11-08 23:45:47 +00:00
tg adbd7f4b74 fix native build 2006-11-08 23:24:49 +00:00
tg 1547b04e66 add new "set -o utf8-hack", currently no effect
set automatically on startup if we have locale functions (on MirOS)
2006-11-05 12:11:14 +00:00