Commit Graph

236 Commits

Author SHA1 Message Date
tg 7b4bee7e58 collective R54 release preparation multi-merger:
install both lksh and mksh manpages from Build.sh (Martijn Dekker)
spelling fixes (Larry Hynes)
manpage improvements (Martijn Dekker)
initial port to Harvey-OS’ APEX (Ronald G. Minnich, Elbing Miss, Álvaro Jurado)
more from komh’s OS/2 port (KO Myung-Hun)
2016-11-11 23:31:39 +00:00
tg ac405dd6b7 avoid even the chance at UB, it’s too risky with “postmodern” compilers 2016-10-22 23:56:50 +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 5edb355336 oops… 2016-07-25 21:02:13 +00:00
tg 4310e75f75 make tmux hack workable for now (libtermcap is… ugly)
• track $TERM for the types tmux uses /^screen(-.*)?$/
• when tmux is in use (or GNU screen, really), use the, now
  hardcoded, clear-to-EOL string; otherwise, use the old behaviour
• drop unnecessary x_e_rebuildline()

carefully tested to behave no worse than R52b
2016-07-25 20:43:54 +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 353108cb25 move MIN_{COL,LIN}S here, only user left (edit.c has its own sanity checks)
and lower them (no need to respect edit.c’s, this is only sanity against OS)
2016-07-12 23:06:26 +00:00
tg 92833fc6ce fix utf_widthadj/utf_skipcols handling for the remaining cases I can spot 2016-05-05 22:56:15 +00:00
tg fdfd7a2ab8 collapse if, also to avoid braces warning 2016-03-01 20:28:33 +00:00
tg 85c377dfc2 don’t read past buffer for empty nameref targets (fmunozs, Valgrind) 2016-03-01 20:06:15 +00:00
tg a3c28ebd67 plug a few display problems with special parameter name expansions
reported by Stéphane Chazelas
2016-02-26 18:48:14 +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 1b0e4f54cb permit 'read -A/-a arr[idx]' as long as only one element is read;
fix corruption of array indicēs with this construct (LP#1533396)
2016-01-14 22:49:33 +00:00
tg 5be0ec410e leak less memory 2016-01-14 20:21:39 +00:00
tg 3fc8b5eb94 partial oksh sync, up to commit 80be547da108d5c241ae068290ca3e331446aa41? 2015-10-09 16:11:19 +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 ba8a6e9461 merge OS/2 style PATH (absolute with drive letters, ‘;’ as separator)
From: KO Myung-Hun <komh@chollian.net>
2015-07-10 19:36:38 +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 2cb0ea982a EBCDIC helpers and OS/390 signals 2015-04-29 18:38:54 +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 a2a4e41975 make var.c:getint() more like misc.c:getn(), except for the API differences:
getn() parses a decimal 32-bit integer, getint() a POSIX- or ksh-style based
integer with unsigned wraparound to 32 bit, then possible negation (so that,
for example, -0xFFFFFFFF continues to work)
2015-04-19 18:13:31 +00:00
tg b19747e3de irrelevant oksh RCSID sync: we already use getint, and our $COLUMNS differs a bit anyway 2015-04-19 14:22:09 +00:00
tg be147e3426 SECURITY: make “unset HISTFILE” really work
additionally, make “HISTFILE=” the same, document the truncation and
re-reading process’ further and already-known bugs; this needs work
2015-03-07 20:46:31 +00:00
tg f6f49a119b add getopts for exec (unbreaks “exec -- /bin/ls”) and steal -a and -c from ksh93 2015-02-06 10:56:49 +00:00
tg 5650b03590 OpenBSD RCSID merge, and logical follow one change:
handle unknown bases as ksh93 does: larger downgrade to 10
(although our max will stay 36, as ksh93 doesn’t have upper/lowecase)
and smaller downgrade for typeset -i, but not for arithmetics
2014-12-15 23:18:47 +00:00
tg 2f52b993a1 • Build.sh: fix NSIG detection for gcc-snapshot
• all: bump version to R50-current; add more comments; whitespace
• all: remove all mkssert(); we’ll do full re-runs of scan-build and,
  hopefully, Coverity Scan/Prevent
• check.t: fix a testcase (sed could exit false, but we don’t care)
• eval.c: fix tilde_ok data type (only unsigned may shl constantly)
• exec.c: fix shebang buf array accesses to always go via uint8_t *
2014-11-25 21:13:31 +00:00
tg 40954ce437 fix null pointer deref on empty nameref assignment (no ‘=’)
found by Goodbox on IRC
2014-10-04 11:47:19 +00:00
tg de53d2df1c SECURITY: do not permit += from environment either
this makes our environment filter/sanitisation complete
2014-10-03 17:20:03 +00:00
tg 26f15bd938 permit $1, $!, etc. to be nameref’d again ($_ was); spotted by Jb_boin, 10x! 2014-09-03 19:22:51 +00:00
tg c75ed28019 shut up valgrind in the RAND_add() code… sounds familiar…
I’m committing this from a Debian system… but fear not…
I know what I am doing…
2014-06-26 20:36:02 +00:00
tg 2f620132af SYNTAX CHANGE: remove x=([2]=foo [5]=bar) due to regressions 2014-06-09 11:13:19 +00:00
tg 033e1f4b9e fix LP#1277691 (“nameref RHS not syntax checked”) and the inability to
use errorf() while nameref states were being changed (by almost completely
eliminating the global variable) and the readonly first array variable
bypass (typo/refactoro); also, whitespace, one int → bool, and add a
comment wrt. the parser rewrite talked about with igli during a fever ;)
2014-05-27 13:22:46 +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 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 d8b65ff642 oksh bumped array indicēs again, INT_MAX this time, still less than mksh… 2014-01-05 19:14:18 +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 21ee1a8411 prevent indirect recursion loops for namerefs; found by ormaaj, thanks! 2013-05-31 22:47:14 +00:00
tg 0465f0a0de more int → unsigned 2013-05-02 20:23:09 +00:00
tg dc94c3d205 after enough complaints by POSIX sh advocates,
• make parsing numbers with leading digit-zero as octal independent of
  mksh/lksh and dependent on set -o posix; adjust manpages to match
• warn about these changes and why mksh uses 32-bit consistent arithmetics
  and point people to lksh for host-long undefined-behaviour arithmetics
• point out, explicitly, that it is *legal* for the operating environment
  to make 'print $((2147483647 + 1))' (on a 32-bit system; adjust for a
  64-bit system) to run 'rm -rf ~ /' instead
2013-04-27 18:50:25 +00:00
tg 5a8d3175cb just rcsid-sync oksh; their change was to add /* XXX 2038 */ comment
to $SECONDS (tbh, in 2038 we’ll have more problems than just that,
which is why 64-bit arithmetics, or unlimited-precision ones, are
on the “plans” list)
2013-04-07 14:11:54 +00:00
tg 7cce9de0bc one can’t cast an unsigned int to a signed int portably either, if the value
is larger than the positive range of the latter (implementation-defined), so
avoid them in all explicit cases and rearrange stuff and check for it

(I’m gonna have to revise lots more code…)
2013-04-01 02:37:53 +00:00
tg ece1b28eaf fix bug in comment 2013-03-31 18:30:05 +00:00
tg 57e4c1a19f catch missing variable names in typeset, to avoid confusing Hugues Moretto-Viry with bogus “read-only” messages 2013-03-30 15:39:26 +00:00
tg 84189faad4 fix an oversight that allowed invalid variable names to be entered
(not even at an increase in code, as I could just move a check and
slightly adapt it)
2013-02-18 22:24:52 +00:00
tg 0780070d24 add a few assertions for LLVM+Clang 3.2 scan-build; no !DEBUG changes 2012-12-08 18:30:31 +00:00
tg cf807eb83a Add assertions and shuffle code around for LLVM+Clang scan-build. 2012-12-04 01:18:34 +00:00
tg 9d2fefeac4 Be more careful with string array bounds! Found by LLVM+Clang scan-build. 2012-12-04 01:11:17 +00:00
tg b868c517b7 remove *all* nonnull assertions and other workarounds for clang scan-build
this beast evolved in the last 2½ years, and we’ve had trouble with
some of them earlier
2012-12-01 01:36:30 +00:00
tg 77c4cb88e4 implement tty tracking and bump to R41 for feature completeness
• tty_fd is now never closed
• new tty_hasstate tracks tty_state (cf. thread around
  http://article.gmane.org/gmane.os.miros.mksh/79 and PLD bug)
• as users requested, importing COLUMNS or LINES from the environment
  now removes its special-ness as does unsetting it
• otherwise, setting COLUMNS or LINES is honoured until the next SIGWINCH
  arrives or change_winsz is otherwise run (e.g. before displaying the
  prompt in the interactive command line editing modes)
• SIGWINCH is now honoured before each reading of $COLUMNS and $LINES too
• change the Uhr to match – it no longer calls stty(1) ☺
2012-11-30 19:25:08 +00:00
tg 80e364b7ad use proper parenthesēs; int → bool; use same var (eno) for temp. errno 2012-11-30 19:02:10 +00:00