Commit Graph

98 Commits

Author SHA1 Message Date
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
97d1d5e4fe fix var=<< implementation 2016-06-26 00:09:35 +00:00
tg
c52133cc4e emit QCHAR '\n' reentrancy-safe 2016-06-26 00:07:31 +00:00
tg
cb0604767f address latest Debian gcc-snapshot’s warnings (some actual bugs!) 2016-03-04 14:26:16 +00:00
tg
80027c9e53 legibility 2016-02-26 17:58:30 +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
0141794c2e correctly handle nested ADELIM parsing: ADELIM doubles as CSUBST (LP#1453827) 2016-01-14 22:30:43 +00:00
tg
aa4ad0c2e4 now WDS_KEEPQ and WDS_MAGIC are both no longer needed 2015-12-12 19:08:58 +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
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
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
fdb9509fe5 make 'typeset -f' output reentrant in the face of functions whose
names are keywords and a GNU bash extension (gah!); reported by izabera
2015-08-13 20:54:03 +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
7f16464902 slightly optimised and, more importantly, much more consistent (use only
one set of CTRL, UNCTRL, and new ISCTRL macros) C0 and DEL handling; the
optimisation only works for 7-bit ASCII, so those places 8-bit must pass
intact have an added check

also, while here, remove an editor oops (‘;’), oksh rcsid sync (they did
accept I was right wrt. set -e), int → bool, and code merge/cleanup
2013-09-24 20:19:45 +00:00
tg
472bc350b5 TGIF, drinking-beer, Sysadmin Appreciation Day commit:
• As requested by Steffen Daode Nurpmeso, enlarge the
  amount of command characters shown in job handling
2013-07-26 20:33:24 +00:00
tg
dd7b17e704 simplify 2013-07-21 18:39:21 +00:00
tg
1d0409d932 implement VALSUBs 2013-05-02 21:59:54 +00:00
tg
4b2e17b828 • let mksh “set -x” print whole TCOM trees
• plug some memory leaks in debug (“set -x”) and warning paths while here
• one from Florian (friend of Natureshadow) for WTF
2013-03-24 00:56:27 +00:00
tg
5a70000aaf Keep LLVM+Clang from nagging about “"foo" + 1 ≠ "foo1"” warning. 2012-12-04 01:10:35 +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
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
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
8e51bb7a23 fix reentry of here documents (LP#1030581) 2012-07-30 19:58:05 +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
45fba44292 sync w/ oksh (RCSID only # no change needed) 2012-06-28 20:01:01 +00:00
tg
4cc5fc3e29 avoid C99 constructs even in debugging code 2012-05-04 18:45:03 +00:00
tg
2d879f3b79 move unexpected TELIF warning into #ifdef DEBUG as it never triggered 2012-04-07 11:19:30 +00:00
tg
3795e667c5 drop use of the NOT macro, [^foo] ≠ [!foo] anyway, and we’re not gonna change that 2012-03-23 20:07:13 +00:00
tg
929bc9ee9e make jobs reporting deal with UTF-8 (in utf8-mode)
reported by Andrew Kudryashov, 10x
2012-02-06 17:42:24 +00:00
tg
d5edc79f5a gc-sections found size optimisation chances 2011-12-31 00:27:27 +00:00
tg
31bf077591 don’t clobber the tree used for printing IOACTs in process_TIF (LP: #907224) 2011-12-29 23:36:25 +00:00
tg
4af399bd8d give dumptree an dumpioact helper 2011-12-29 22:54:22 +00:00
tg
fed31331f4 rename more identifiers with trailing underscores 2011-10-25 22:36:39 +00:00
tg
9782f6b4d1 • access(2) is broken in at least kFreeBSD 9.0 as “modern” OS, so bring
back the wrapper code as well as refactor most other code calling it
• apparently, names can’t end in ‘_’ or contain ‘__’ anywhere…
2011-09-07 15:24:22 +00:00
tg
577c918beb patch most of Jerker Bäck’s concerns out, unless not applicable 2011-08-27 18:06:52 +00:00
tg
2cfc3e5c3d mksh R40 Release Candidate 1
Testsuite:
• add new need-pass: {yes|no} attribute, default yes
• exit with 1 if a need-pass test failed unexpectedly
  idea by Kacper Kornet <draenog@pld-linux.org>
• mark utf8bom-2 as need-pass: no
Infrstructure:
• add housekeeping function for making a tty raw
• switch functions with unused results to void
• struct op: u.charflag contains last char of ;; in TPAT
• var.c:arraysearch is now a global function
Language:
• add ;& (fall through) and ;| (examine next) delimiters
  in addition to ;; (end case) as zsh extensions, because
  POSIX standardised on ;& already
• add -A (read into array), -N (read exactly n bytes),
  -n (read up to n bytes), -t (timeout) flags for read
  from ksh93
• allow read -N -1 or -n -1 to slurp the entire input
• add -a (read into array the input characters) extension
  specific to mksh to read, idea by David Korn
• add -e (exit with error if PWD was not set correctly
  after a physical cd) to cd builtin, mandated by next
  POSIX, and change error codes accordingly
Rewrites:
• full rewrite of read builtin and its manpage section
• add regression tetss for most of the new functionality
• duplicate hexdump demo tests for use of read -a
• use read -raN-1 in dot.mkshrc to get NUL safe base64,
  DJB cdb hash and Jenkins one-at-a-time hash functions
2011-05-29 02:18:57 +00:00
tg
c38dfbf51a fix problem #1 and a comment 2011-05-07 00:24:35 +00:00
tg
c021aa4cad • use a flag for determining here strings, don’t parse delimiter every time
• don’t leak memory parsing possible I/O redirection tokens
• get rid of volatile by using more const (also helps codegen, methinks)
• support empty here document markers (mksh extension)
• pimp the manpage
2011-05-05 00:05:01 +00:00
tg
0d6e622b14 return EOS on EOS just to be on the safe side 2011-05-04 22:38:27 +00:00
tg
69f98bca9a • fix wtf(1) by keeping the paren in ${foo#\(} properly escaped in COMSUB
• merge tputS and wdstrip_internal
⇒ net save: 604 .text 0 .data 0 .bss (MirBSD/i386)
2011-05-02 22:52:54 +00:00
tg
6c0255ecb2 more static initialisers (verified using nm comparision between mksh
built with/-out "-ffunction-sections -fdata-sections -Wl,--gc-sections"
2011-04-22 12:15:42 +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
2dbf82a737 no // style comments in my source code! 2011-04-09 15:05:44 +00:00
tg
d4e19b6624 • make DEBUG:dumpchar() not static (consider rolling into shf?) 2011-03-17 21:58:40 +00:00
tg
2a3d4db123 lint is your friend 2011-03-13 01:20:25 +00:00
tg
75db4cdb56 • back out the EXPRSUB change
• optimise some code
• split testcase into two, one with expected-fail
2011-03-12 23:04:48 +00:00
tg
17dbd3bd83 • make EXPRSUB not initiate an ASCIIZ string any more but a wdstring
(token stream, lexer output / parser input), EOS terminated, let
  SASPAREN use the same lexing as SBASE (e.g. COMSUB recursively)
• make wdstrip recursive
• fix processing of COMSUB in wdstrip
⇒ pass comsub-1 test
• expose another debugging function
2011-03-12 21:41:15 +00:00
tg
f8659785ac • add a tree debugging dumper #ifdef DEBUG
• use shf_putc (macro), shf_putchar (function) ipv tputc
• replace shf_putchar(x,y) calls for side-effect-less x with shf_putc
• plug another bug in the tree code – '\' → "\\" (backslashes must be
  escaped inside double quotes, too)
• adjust testsuite (and, I _had_ wondered…)
2011-03-08 18:49:51 +00:00