Commit Graph

259 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 cc725e67ca switch EBCDIC to “nega-UTF8” 2017-05-05 20:36:03 +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 7529e350cf small character classes overhaul:
• make fast character classes even faster by removing the C_SUBOP2 hack
  in favour of a separate seldom-used ksh_issubop2 macro (which also
  makes ctype() side-effect-safe) which is a slower class (no change there)
• optimise cases of ksh_isalphx followed by a ksh_isalnux loop
  (used parsing variable names)
• remove a misleading comment in initctypes() about \0 from pdksh
• rename C_ALPHA to C_ALPHX to make it more clear the underscore is included
• sprinkle a few ord() in there
• add new ksh_isalpha() which tests for [A-Za-z] (slow character class)
• there is no '_:\' drive on OS/2 (which inspired the whole changeset)
2017-03-26 00:10:26 +00:00
tg e991806f2b fixup LINENO in eval and alias; patch and initial testcase
From: Martijn Dekker <martijn@inlv.org>
2017-03-22 00:20:43 +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 2584cd0634 fixup relation between lksh and mksh (somewhat minimal delta) 2017-02-18 02:33:15 +00:00
tg 757e25fb21 implement $KSH_MATCH and, to make it usable, ${foo@/bar/baz};
add a real-life example (for slagtc’s programmable tab completion)
to the manpage
2016-08-01 21:38:07 +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 262ae5a436 fix most of the ambiguous ${[prefix] var [op [word]]} corner cases
prodded by izabera and carstenh; resolution is:
• you can’t trim a vector in mksh, still (consider ${@:-1})
• future POSIX will require non-empty “word” for most “op”s
• dissolve in order of standard → extension
• dissolve to prefer “op” over “prefix” where still necessary, mostly
2016-06-25 23:55:00 +00:00
tg 3d130b606a give C_VAR1 precedence over display variable name; izabera pointed out,
rightfully, that, in POSIX shell, ${!#} is defined, and ${!#123} should work
2016-05-05 22:45:58 +00:00
tg 4c4131dddf commitid 10056D5D8AF01B31531 broke fix for Debian #783978 (add testsuite) 2016-04-09 13:55:12 +00:00
tg 539714f78a there was a comment on 1015; change comments to match, no code change 2016-03-01 19:22:31 +00:00
tg c2bdb1b9dd check not-begun heredocs at EOF earlier
izabera reported they were not caught with “set -n”
2016-03-01 18:30:05 +00:00
tg 819229fa50 also flush syntax-failed or interrupted input into the history 2016-03-01 18:00:08 +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 61f7661b92 fix errno in print/echo builtin; optimise (with partial rewrite) 2016-01-20 21:34:13 +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 44be0bdb0b deliberately revert from POSIX to classical behaviour for "…`…\"…\"…`…"
until http://austingroupbugs.net/view.php?id=1015 is resolved (either way),
mksh R52 regression; cf. Debian #810846, #811092
2016-01-19 23:09:48 +00:00
tg 0a1f594503 parse “$( (( … ) … ) … )” correctly (LP#1532621) 2016-01-14 19:52:20 +00:00
tg 305599031d improve reparsing of ((…) |…) as ( (…) |…) 2015-12-12 19:05:52 +00:00
tg 7a47656efe fix \u0000 and \x00 being ignored in $'…' and print +r expansion 2015-10-24 19:46:10 +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 3fc8b5eb94 partial oksh sync, up to commit 80be547da108d5c241ae068290ca3e331446aa41? 2015-10-09 16:11:19 +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 0f6aa7eaab fix more int vs. size_t mismatches 2015-09-06 13:10:48 +00:00
tg edc2acd61d fix tree printing multiple heredocs in one command, bug found by izabera 2015-09-05 20:20:48 +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 9d30e9c9d6 oksh sync: one rcsid-only plus this one by guenther:
Zero-pad the seconds in the output of 'time' to make columns line up
2015-08-13 21:04:12 +00:00
tg 2e4cd72899 make certain actions flush the history buffer 2015-07-05 19:53:46 +00:00
tg e0196f47d5 implement completely new multiline code by delaying history store
this commit is valgrind-tested
2015-07-05 19:37:18 +00:00
tg 11a2f9d822 make $LINENO in PS1 equivalent to ! (bug spotted by carstenh in IRC) 2015-07-05 13:49:42 +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 65f9b93926 ordinarily, lineno must be mksh_uari_t, but edit.c most of all isn’t ready,
so we mitigate a bit (in var.c mostly) and tweak another type already, and
add some checks (mksh_{,u}ari_t must fit into {,unsigned }long) and print
line numbers with %lu already
2015-04-19 18:50:38 +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 8641829e21 fix comment no longer true since commit 1004DC49710562ACCB2 2015-03-20 23:37:39 +00:00
tg 0d72355038 “local x=$1” is supposed to not field-split and so 2015-03-14 05:23:18 +00:00
tg 8546943535 KNF 2015-03-01 16:02:48 +00:00
tg dcdc828c41 fix here string parsing problem found by Stéphane Chazelas 2014-12-15 22:50:11 +00:00
tg 9b31399aec fix buffer overflow found by zacts from IRC (bad length calculation)
now zsh and mksh are even… :|
2014-11-19 18:44:11 +00:00
tg e4c01375aa fix access-after-free crash spotted by Enjolras via IRC, thanks! 2014-06-29 11:28:28 +00:00
tg 270a86f895 • use BAFH for hash ipv NZAAT
• prep for release
• fix minor nits in manpage and tests
2014-01-11 18:09:43 +00:00
tg 2f7eec765d merge oksh’s “ctype cleanups” commit
(not much of it applies since we don’t use the OS’ table-based lookup)
2014-01-05 19:11:46 +00:00
tg 61886de5ee oksh sync (RCSID only) 2013-11-17 22:19:42 +00:00