Commit Graph

140 Commits

Author SHA1 Message Date
tg 868d982efb sprinkle tons more ord() around
this is really not funny… mksh-ng will use even more “unsigned only”
2017-05-05 22:53:32 +00:00
tg 2231ff566d commit the optimisation result from the new fast character classes 2017-04-28 00:38:33 +00:00
tg d54d4aab50 batch of optimisations 2017-04-27 20:22:28 +00:00
tg 1080008a8f eliminate legacy macros 2017-04-27 19:33:53 +00:00
tg 3909a42540 fix reentrancy of 'typeset -f' output in the face of aliases; also,
move alias handling for COMSUBs and friends to parse time by request
of Martijn Dekker (and for consistency with function definitions)
2017-04-06 01:59:58 +00:00
tg bcde17a8fc streamline some error messages 2017-04-06 00:41:42 +00:00
tg 06b2d53ea2 use \\builtin ipv \let] and \set internally 2017-03-19 20:59:29 +00:00
tg b531baa7fd add a “\builtin” builtin, make it forward assignments, fix some bugs
related to that:
• while AT&T ksh may do it, POSIX says nothing about allowing
  declaration commands only without vars and redirections, and
  “without vars” especially seems against which commands they are
• fix relationship between forwarders and real declaration commands
• clean up c_builtin vs shcomexec mess

Also, re-run “make repool” with a fixed src/scripts/stringpool.sh,v 1.3
2017-03-12 02:04:15 +00:00
tg bc4397e28a fixup tilde expansion comments; revert a few bogus dirsep changes
cf. <Pine.BSM.4.64L.1703112129500.29506@herc.mirbsd.org>
2017-03-11 22:49:56 +00:00
tg d18f9133c8 fix English (thanks to Andreas Buschka); TIL:
• to start ⇒ a start
• to begin ⇒ a beginning
2016-09-01 12:59:12 +00:00
tg e52a2bb23f assorted code cleanup, while here anyway 2016-08-04 20:32:14 +00:00
tg f9d131133e remove fd>9 support in favour of upcoming named file descriptors; bump 2016-07-25 21:05:25 +00:00
tg c3e794c4d0 rework string pooling; disable our own (rely on compiler’s)…
• if HAVE_STRING_POOLING is set to 1
• if HAVE_STRING_POOLING is set to 2 and not GCC < 4 is used
• if HAVE_STRING_POOLING is not set to 0 and LLVM or GCC >= 4 is used

Closes: LP#1580348
2016-07-25 00:04:48 +00:00
tg 4a21365067 yyrecursive needs its own and empty heres[]
fixes http://thread.gmane.org/gmane.comp.shells.dash/1241/focus=1245
2016-02-26 21:24:58 +00:00
tg 188691d285 save 200 bytes off .text by revisiting string pooling
also, forgotten version bump
2016-01-21 18:24:45 +00:00
tg 046d8e5b7a align with future POSIX on http://austingroupbugs.net/view.php?id=351
with accepted interpretation (*sigh*); merge VARASN|ARRAYVAR→CMDASN
2016-01-19 23:12:15 +00:00
tg 0a1f594503 parse “$( (( … ) … ) … )” correctly (LP#1532621) 2016-01-14 19:52:20 +00:00
tg f08d596163 make (( … )) into a compound command, as ormaaj says was originally intended 2015-12-12 21:03:53 +00:00
tg fc48729336 tweak some iop/conservative_fds-related things I picked up while thinking lksh 2015-10-09 19:29:50 +00:00
tg af35e9a6de revert most of commitid 3ec342c92b3a8874 and fixup the rest;
this should bring us closer to POSIX again
2015-10-09 17:48:53 +00:00
tg ed5cb56849 replace the code related to << changes and <<< with cleaner code,
fixing a few bugs also (including new testcases, except x=<< issue)
2015-09-06 19:47:01 +00:00
tg 4adcfe8b58 oksh sync, simplify *all* if(x)free(x); constructs, simplify x_push() and sync boilerplate while here 2015-09-05 19:19:12 +00:00
tg 8a11d7a6a2 we have longer fds now, plus add 1 for a space just to be sure 2015-09-05 17:17:47 +00:00
tg 609b311919 more low-hanging fruits for EBCDIC; notes:
• ord() new, From: Daniel Richard G. <skunk@iSKUNK.ORG>
  ‣ used in some places
• (c - '0') → ksh_numdig(c)	# may take *x++ argument
• (c - 'A') → ksh_numuc(c)	# may NOT take *x+= argument
  ‣ idem for ksh_numlc(c) and 'a'
  ‣ these need changing for EBCDIC
  ‣ add testsuite for this
• use macros more, they exist already often
• use digits_lc[foo] instead of ('0' + foo), especially for letters
• caught another ksh_eq case…
• also caught a maybe-UB overflow check, but we don’t have TIME_T_MAX ☹
2015-04-29 20:07:35 +00:00
tg e1cda74d04 SECURITY: fix integer overflows related to file descriptor parsing
bug initially found by Pawel Wylecial (LP#1440685)
additional bug found and suggested fix by enh (elliott hughes)

This commit also renames struct ioword.flag to ioflag to disambiguate
it from other members named “flag”, changes it to an unsigned type,
and packs ioflag and unit into shorts each, to make the struct smaller
(aligned even: 16 bytes on 32-bit systems) and reviews some of the
code involved in fd handling, though there wasn’t much to be found.
2015-04-11 22:03:32 +00:00
tg 0d72355038 “local x=$1” is supposed to not field-split and so 2015-03-14 05:23:18 +00:00
tg bcff0752b4 another needed quote 2015-03-14 04:38:13 +00:00
tg 96d9e5d1f1 remove unused CMDWORD 2015-03-14 04:37:55 +00:00
tg 8f53c68265 • protect POSIX builtins and utilities from aliases, e.g:
‣ : → \:
  ‣ alias → \alias
    ⇒ except in some internally used cases, where we use \builtin alias
  ‣ command . → \command .
• protect Korn Shell builtins from aliases and functions, e.g:
  ‣ typeset → \builtin typeset
    ⇒ also unravels the “local” alias used
  ‣ print → \builtin print
• protect internally-used things from aliases
  ‣ “let]” is not a valid function name
  ‣ “set” is POSIX so we don’t expect anyone to override it in a function
• use “command -v” instead of “whence -p” (“which”) in most
  places; thanks izabera from #ed on IRC for pointing out
  that “command -v” is POSIX – except, “whence -p” a̲l̲w̲a̲y̲s̲ looks
  for an executable and shows its full pathname; “command -v”
  also resolves to aliases, functions and builtins, so only use
  it where it makes any sense (both never output to stderr)
• make most of dot.mkshrc work in the face of such aliases
  ‣ “ulimit -c” is used; this is not POSIX, and not portable;
    maybe we should make ulimit accept-and-ignore the most
    common limits even if the OS doesn’t use them?
• update list of builtin aliases in the manpage
2015-03-08 22:54:36 +00:00
tg 5cf460cc07 「if + comment(!) + label(!!) + one statement」 ← shouldn’t that get braces, style(9)? 2014-12-15 22:08:55 +00:00
tg 89e774fd7e • fix ${12345678901234567890} segfault (OOB access / integer overflow)
‣ not like oksh did, but using mksh’s built-in features
• handle suggested __pure additions
• revert cid 1004F7F096867C83CF0
  ‣ always use our wcwidth code
  ‣ only use our strlcpy code if none found
• fix a couple of gcc-snapshot and clang/scan-build warnings
• mksh R49~rc1
2014-01-05 21:57:29 +00:00
tg 14667a9838 int → bool; commit as a TODO comment a begun change attempt 2013-09-10 16:30:50 +00:00
tg 446fdbca3b from oksh: “for var in; do” shouldn’t be interpreted as “for var; do” (POSIX) 2013-06-03 22:28:17 +00:00
tg 1d0409d932 implement VALSUBs 2013-05-02 21:59:54 +00:00
tg deb4a3bf20 Oh well… this looks well, is done done, and gcc-snapshot doesn’t complain:
• correct order of built-in commands; use POSIX special versus “all others”
  plus “keeps assignments” as distinction, no longer play POSIX regular vs.
  others game; sync manpage
• fix LP#1156707: map (( internally to “let]” which is no valid function
  name and so can’t be overridden but is unlikely to be used otherwhere
  and not strictly permitted (by POSIX) anyway
• we do not need -Wno-overflow any more, either
• bump to R45
2013-04-26 21:22:50 +00:00
tg 79a083baaa kill dead code 2013-04-26 18:27:07 +00:00
tg b2396677e7 harmonise sys_{sig,err}list ⓐ checks, ⓑ uses, ⓒ _decl values when not needed, ⓓ prototypes; ⓔ “const” is a keyword and thus space-separated from the preceding ‘*’ pointer indicator 2012-12-28 02:28:39 +00:00
tg f654a3dea4 fix libFirm/cparser -Wsign-compare 2012-12-05 19:38:25 +00:00
tg d8a6ce41de shuffle declarations around (all shared between even only two files go into sh.h even if they’re not supposed to be used elsewhere) and make some static; libFirm/cparser has -Wmissing-declarations against it 2012-12-05 18:54:10 +00:00
tg 0f3071a8b2 MKSH_DISABLE_EXPERIMENTAL is a NOP again; use ${ precmd;} in dot.mkshrc 2012-11-30 20:19:16 +00:00
tg 5aa7842d33 who would’ve thought proper ^C handling be so hard? 2012-10-30 20:49:44 +00:00
tg faa0a78df3 restore yyrecursive context in quitenv (LP#1069428) 2012-10-30 20:07:15 +00:00
tg bfe7d78d40 bring back ${ foo;} sans dot.mkshrc patch, using a temporary file, and as experimental feature 2012-10-22 20:19:18 +00:00
tg 0575d07671 rewrite XPtrV to use size_t instead of pointer arithmetic, for gcc-snapshot (20120930-1) -fstrict-overflow -Wstrict-overflow=9 2012-10-03 15:50:32 +00:00
tg bb5e56d4c4 remove ${ foo;} from mksh again due to buffering issues jilles found 2012-08-17 18:34:25 +00:00
tg 9b7b7f742e implement ksh93 feature ${ foo;} 2012-07-30 21:37:17 +00:00
tg 0db4002bd6 remove unused flag 2012-07-30 17:04:31 +00:00
tg 67714b270a dissolve the hashtab nonsense, ¾ is good, and mirkev will also use that 2012-07-01 15:38:09 +00:00
tg d824683000 ensure that case end tokens are not mixed up (Closes: #220272)
XXX token/tpeek/musthave should rescan the last input lexems
XXX if the new cf passed doesn't match the last cf passed
2012-06-28 20:04:02 +00:00
tg 3125146b43 Fix typeset issues (LP: #993847)
This was actually more evil:
• use a recursive function to display blocks in reverse order,
  so that local variable values overwrite global ones
• add array support to typeset -p (from typeset -p -)
• display 'set -A varname' line before setting values, for -p
• if -p got arguments, only display those (from the innermost scope)

Also, the usual amount of code cleanup…
2012-05-09 23:21:00 +00:00