Commit Graph

1784 Commits

Author SHA1 Message Date
tg da9d0f3d97 ${foo@x} is now special-expansion for values of x, defined for now:
‘#’ = hash of $foo
2011-01-21 22:25:34 +00:00
tg 846fbde3b8 add read with delimiter, like AT&T ksh93 (thanks Dave for the suggestion) 2011-01-21 22:00:17 +00:00
tg 865b267dbf drop suspend alias in Android too 2011-01-21 21:07:11 +00:00
tg cc31d86e3b • implement KSHEGID, KSHGID, KSHUID variables by suggestion of Richard K.
(KSHEUID aka USER_ID already exists)
• simplify, speed up LCG and $RANDOM handling again
2011-01-21 21:04:48 +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 230f59d064 New functionality: assign here document to string variable directly,
without cat and temp files. Hacked in Lëtzebuerg ☺

This was the third try. Where to put this was not palpable… same for =(…)
2011-01-09 21:57:29 +00:00
tg b4948e430f this is a bashism but might be from ksh93 IIRC… still dead ugly as hell! 2010-12-19 20:00:56 +00:00
tg ce160a8155 MKSH_SMALL need not imply !HAVE_REVOKE as default 2010-12-12 14:06:35 +00:00
tg 210608b199 regenerate all wcwidth code from UCD 6.0.0 and related tables,
and mgk25’s wcwidth.c 5.0 code; add check against 2-byte wchar_t;
optimise libc wcwidth(3) implementation taken from mksh and sync these
2010-12-11 16:05:03 +00:00
tg beba20ea56 since dot.mkshrc is sourced by interactive shells anyway, and exporting
PS1 may hurt other shells, do not export it any more

reported by and fix suggestion / affected variables by Frank Terbeck
2010-11-26 21:08:54 +00:00
tg 27dce9168a change behaviour of argument-less exit in traps to match SUSv4; Debian #599484 (original patch from Jonathan Nieder, thanks!) in a variant that appears to handle nested traps well 2010-11-01 17:29:05 +00:00
tg e57379aab7 regenerate from Unicode 6.0.0 2010-11-01 17:28:49 +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 c37518d509 ouch! \c? is DEL, not \c~ 2010-10-08 17:30:05 +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 895e8f584b partial obsd sync:
- remove some old groff workarounds in SYNOPSIS
- avoid "Op ... Oc" constructions
except where the latter doesn’t work with nroff
2010-09-24 20:21:43 +00:00
tg e169648b89 while here, change SETUID_CAN_FAIL_WITH_EAGAIN to abort immediately
by suggestion of Chris Palmer again
2010-09-19 19:28:23 +00:00
tg b0b03a5a75 RNDEBUG showed that using the pushb_fast will have much fewer syscalls 2010-09-19 19:21:20 +00:00
tg 915b30adfe revert part of the “size reduction” diff (zero size change though):
shellf() implies an shf_flush()…
2010-09-15 21:08:19 +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 dcbfc48855 ┌──┤ apply Android patch from Jeff Hamilton:
│Don't alias 'stop' to 'kill -STOP'
│
│Android has already has a stop command used
│to stop the main runtime and the alias
│interferes with testing tools that expect
│stop to kill the runtime.
│
│Change-Id: I02b7efb9203dc39e97f63eb702a54ff79935b316

Although, this is closer to his first patchset and only takes
care of the alias, not the testsuite (which doesn’t run, at
least not out-of-the-box, nicely anyway) using #ifdef ANDROID.

We certainly want a more flexible testsuite…
2010-09-14 21:00:13 +00:00
tg 4f671299f4 lintian caught hyphen-used-as-minus-sign 2010-09-05 20:43:37 +00:00
tg 56a69907d5 optimise error messages, option parsing, and make more builtins
recognise "--", costs us 20 .text 0 .data 0 .bss
2010-09-05 19:51:35 +00:00
tg 07b97d5444 document workaround for the $(…) parsing bug 2010-09-05 19:12:24 +00:00
tg 2c59cc6089 more on the cat 2010-08-28 21:22:24 +00:00
tg 06c6be0a70 shave off another 468 bytes: we’re 300 bytes smaller than BEFORE the
cat builtin was added now… (also removed utf-8 from source files, in
favour of just ASCII)
2010-08-28 20:22:24 +00:00
tg 3747722db4 improve string pooling: saves 316 bytes in .text 2010-08-28 18:50:58 +00:00
tg d09fd67299 make cat an mksh builtin, for things like here documents
if any options are given, the external programme is invoked instead
2010-08-28 17:21:46 +00:00
tg 297e2ced89 fix blocking_read prototype 2010-08-28 16:47:11 +00:00
tg 4e08a79555 whitespace 2010-08-28 15:48:20 +00:00
tg 475cafb90e int → bool 2010-08-28 15:39:20 +00:00
tg 1924f91aad this is 「category: os:mirbsd」 because of hardcoded errno and strerror values 2010-08-24 15:47:44 +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 7fdc42cead fix realpath builtin’s handling of (source) pathnames with a trailing slash
as per POSIX (if a trailing slash is part of the symlink target it fails as
well, like GNU readlink -f does)
2010-08-24 14:42:04 +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 23f3f58d14 on MirBSD we can use the system wcwidth() and save ~800by on the ramdisc 2010-08-14 21:35:13 +00:00
tg b5bdc6d10f document the [[ $foo = "$bar" ]] thing expressly 2010-08-14 20:13:10 +00:00
tg 14dc6071e7 portable hogwash 2010-08-14 19:55:37 +00:00
tg c187f3089f a tad annoying, when external programmes such as GNU screen are running,
we don’t get SIGWINCH when the window size changes during the runtime of
that, so, the signal is only usable reliably during editing in the shell
and we re-check the window size before each interactive edit line again
2010-07-25 11:35:43 +00:00
tg befbed2859 int → bool 2010-07-24 17:08:30 +00:00
tg c11d35312a Michal Hlavinka from Red Hat found another SIGSEGV
fix: when iterating over all Sources, know when to stop…
2010-07-21 11:31:16 +00:00
tg c6eedad976 *sigh* this code is interesting: assume you want to output via shf to
a string buffer whose window size is currently 32 (initial), your data
is 96 bytes, this routine used to resize the buffer to 64, append your
first 64 bytes to it (no matter if there's already something in it)
and then writes the remaining bytes to stdio fd instead of the string…
if it doesn’t SIGABRT before

discovered by wbx@ – thanks – bug inherited from pdksh 5.2.14 (AD 1999)
2010-07-19 22:41:04 +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 7c91e018f4 • merge printf from OpenBSD
• deactivate %a and %A since our libc doesn’t have it
• rewrite the mksh integration code to use shf instead of stdio, removing
  floating point support always in the process, as shf doesn’t support it
  ⇒ saves 11114 (6706 text, 168 data, 4240 bss) with dietlibc on Debian
• fix -Wall -Wextra -Wformat -Wstrict-aliasing=2 for gcc (Debian 4.4.4-7)
• fix these and -Wc++-compat for gcc version 4.6.0 20100711 (experimental)
  [trunk revision 162057] (Debian 20100711-1) except:
  – a few enum warnings that relate to eglibc’s {g,s}etrlimit() functions
    taking an enum instead of an int because they’re too stupid to adhere
    to POSIX interfaces they design by themselves
  – all “request for implicit conversion” involving a "void *" on one side
• tweak the manual page somewhat more
2010-07-17 22:09:40 +00:00
tg 1e113b416b sync with oksh and remove some unnecessary/legacy portability notes
Revision 1.136: [7]download - view: [8]text, [9]markup, [10]annotated - [11]select for diffs
   Thu Jul 15 20:04:35 2010 UTC (47 hours, 56 minutes ago) by schwarze
   Branches: [12]MAIN
   CVS tags: [13]HEAD
   Diff to: previous 1.135: [14]preferred, [15]coloured
   Changes since revision 1.135: +7 -7 lines
When the first argument or arguments of a macro are opening delimiters
(parentheses and/or square brackets), both modern groff and mandoc first
output those leading delimiters as plain text, then start the macro scope
after these opening delimiters.  This is similar to printing trailing
punctuation and trailing closing delimiters on a macro line outside and
after the macro scope.  For example, ".Sq ( text )" is "(`text')",
not "`(text)'".  Thus, we now need to quote leading opening delimiters
when we want them inside the macro scope.
These are the cases in src/bin.

"makes sense" jmc@
2010-07-17 20:21:18 +00:00
tg 6b006202a1 partial oksh sync (RCSID and do add some parenthesēs to the list of
reserved words, but really only these which are only recognised at
the beginning of a line as the context says, not blindly all of them)
2010-07-13 13:12:32 +00:00