Commit Graph

797 Commits

Author SHA1 Message Date
tg 224bea2d87 bugreport about x=([y]=z) from ormaaj and jilles, via #ksh on IRC 2014-05-29 21:30:45 +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 d8461d400f fix ${!foo} for when foo is unset 2014-05-27 13:00:31 +00:00
tg 0c3c44a6a7 POSIX clarification leads to ugly new “bug” (expected-fail, for now)
thanks ormaaj for noticing and forwarding to me
2014-04-29 07:43:38 +00:00
tg 27f56362fa document known readonly bug from <52EFA07D.3010904@posteo.de> 2014-02-09 00:08:17 +00:00
tg d108bbe94e add a testcase specifically designed to check for noexec; spotted by gentoo/developer/Polynomial-C 2014-02-08 20:20:32 +00:00
tg f7194b3e1a this was missed 2014-01-22 19:53:52 +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 70233e4cd4 play catchup with weird obsd reorg (in which they lost a few tests, even…) 2013-12-15 15:45:31 +00:00
tg 6217904193 detect getsid(2), also spotted by RT, this on MSYS 2013-11-30 17:41:35 +00:00
tg fc4f36e75b revert commit 1005289433447F6CA90 as it makes the system unbootable 2013-11-30 00:20:48 +00:00
tg 973c7a55c2 fix initial IFSWS not ignored when expanding, noticed by Seb <sbb@tuxfamily.org> 2013-11-17 22:28:51 +00:00
tg f920d94785 add O_BINARY to all open() calls except tty_fd
cf. http://svn.netlabs.org/libc/wiki/Faq#Whydoesntreadfdbufsize_of_filereturnsize_of_file
2013-10-09 11:59:30 +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 2e7509548a integrate latest changes from oksh: Wed Sep 4 15:49:19 2013 UTC by millert
Add a proper suspend builtin that saves/restores the tty and pgrp
as needed instead of an alias that just sends SIGSTOP.  Login shells
may be suspended if they are not running in an orphan process group.
2013-09-10 17:33:04 +00:00
tg fda010d8de SECURITY: Unbreak “set +p”, broken by OpenBSD ksh change.
TODO: I am seriously considering following Chet and changing
the way this works, by explicitly dropping privs unless the
shell is run with -p. Every other shell does it like mksh,
except Heirloom sh, which on the other hand doesn’t know any
explicit set -p or set +p (though it doesn’t know set +foo
for any foo either).

┌──┤ QUESTION: Do we need the ability to do this:
│ tg@blau:~ $ ./suidmksh -p -c 'whoami; set +p; whoami'
│ root
│ tg

If not, I’m seriously considering to drop set ±p as well,
only parse -p on the command line, with +p being the default,
and dropping FPRIVILEGED.

Thanks to RT for noticing and jilles for initial follow-up
discussion, as well as Chet Ramey for doing the sane/secure
thing instead of following Debian.
2013-08-23 14:07:39 +00:00
tg 5eb6995d75 Ypnose discovered a problem with multi-line prompts and SIGWINCH
related to caching some values (downside, pprompt gets back doprint option)
2013-08-16 10:59:03 +00:00
tg bf94b7e2ec fun: when writing this code I feared an off-by-one;
Steffen Daode Nurpmeso stumbled upon it and gave very detailed
instructions on how to reproduce it (thanks!); fix that

also only call x_bs0 if xcp < xep because *xep is undefined
2013-08-14 20:26:19 +00:00
tg bb0b409a9d improve density of .rodata (with net win on .text size(1)) via better struct packing 2013-08-11 14:57:11 +00:00
tg a799f5928b improve documentation and comments 2013-08-10 13:47:18 +00:00
tg c10e5bd237 reduce amount of .bss memory needed; initialise via AEDIT at x_init
or even first run of x_vi
2013-08-10 13:44:33 +00:00
tg 247e20c524 • Completely overhaul prompt length calculation and
prompt display routines; make Emacs and Vi share
  code, permitting reducing of duplication and code
  removal as well as more consistent behaviour; put
  some common code into shared helper functions, too
• New x_adjust() logic (Emacs mode): when determining
  what portion of a line to render use a much more
  sophisticated algorithm and try to fill up ⅔ of the
  total screen width (with line and prompt both) also
  as wished from Steffen Daode Nurpmeso
2013-07-26 20:33:39 +00:00
tg 3876b38220 Steffen Daode Nurpmeso found an actual bug:
Whenever the SIGEXIT trap was set (to anything, really)
syntax errors and interruptions were not ignored any more
in an interactive shell (where they should be, unless
set -e is used); fix that.

tbd: traps should probably only be marked as pending
and run for LLEAVE/E_NONE
2013-07-25 18:07:47 +00:00
tg 5b35b869f1 Apply patch from: Steffen "Daode" Nurpmeso for testing -i vs. EXIT trap 2013-07-25 16:41:30 +00:00
tg fb1c2ee862 more checks for special char handling 2013-07-25 16:06:43 +00:00
tg b46001ad4a fix another clobbered-by-setjmp/longjmp warning 2013-07-24 18:03:57 +00:00
tg e495fde858 Fix apparent programming mistake (newblock doesn’t imply newenv)
that caused “echo ${|true;}$(true)” to segfault; problem reported
by pshevtsov and wbx@ in IRC (thanks!); fix sponsored by tarent
2013-07-24 12:39:28 +00:00
tg ead77623d3 Fix most “set -x” problems (LP#1179287)
• “set -x” manually (cmdline too) snapshots fd#2 now
• “set -o inherit-xtrace” introduced; default still enabled
• reverted iodup printing to pre-R45 behaviour
• made Flag(FXTRACE) a proper state machine
2013-07-21 18:47:24 +00:00
tg 3bc3e8665a fix postun in not evaluated side of e.g. ternary operator (LP#1187729) 2013-07-21 18:38:56 +00:00
tg bd795a83ae partial merge and full RCS ID sync with oksh
merged:
• new regression tests
• check.pl (tests/th) better tmpfile handling
• exec.c 1.50: POSIX specifies that for an AND/OR list,
  only the last command's exit status matters for "set -e"
• ksh.1 1.147: document the above
• eval.c 1.39: “Make $(< /nonexistent) have the same behaviour
  as $(cat /nonexistent) wrt. errors (do not unwind and do not
  treat this as fatal if set -e is used).”
  ‣ additionally make shf_open() return errno and actually show
    the error message from the system
• regression-39 test: remove the “maybe” marker
  ‣ but decide on correct POSIX behaviour

already been fixed in mksh:
• check.pl (tests/th) exit 1 if tests fail

not merged:
• main.c 1.52: run traps in unwind() before exiting;
  I’m pretty sure this is already working as-should in mksh
• eval.c 1.38: “Commands executed via `foo` or $( bar ) should
  not inherit "set -e" status.” As discussed in IRC, this is
  just plainly WRONG.
2013-07-21 18:36:03 +00:00
tg bb4083d649 use ‘z’ shf printf modifier for out-of-memory message, now that we have it 2013-06-03 22:28:33 +00:00
tg 8256f266ff fix a number of warnings and other issues:
• sig_t detection was a bit insane, it is a function-pointer type after all
• fix uninitialised variable in c_select which led to mistakenly accepting
  invalid (nōn-numeric) input and acting, randomly, upon it
• keep SIGCHLD blocked in child after forking longer, for job list manip
• block SIGCHLD ifdef DEBUG_LEAKS to not run job foo during/after afreeall
• fix annoying ISO C90 vs. C99 (un)signed constant warning
2013-06-02 03:09:17 +00:00
tg ec1bc74d41 pull some quoting fixes from oksh; original patch from Alexander Polakov 2013-06-01 00:15:58 +00:00
tg 21ee1a8411 prevent indirect recursion loops for namerefs; found by ormaaj, thanks! 2013-05-31 22:47:14 +00:00
tg 1d0409d932 implement VALSUBs 2013-05-02 21:59:54 +00:00
tg ff42a866e9 implement set -o pipefail 2013-05-02 20:28:15 +00:00
tg f0f34eb7b6 • Allow setting both -o posix and -o sh (although only in the same
command; setting one still unsets the other at first)
• Change subst_exstat to be conformant unless -o sh is set and -o posix isn’t
• In lksh, make subst_exstat (newly) conformant if -o posix
• New MKSH_BINSHPOSIX to accompany MKSH_BINSHREDUCED
• Sync lksh manpage precisely
2013-05-02 20:21:45 +00:00
tg 689c179254 sync and be even more explicit
XXX some day, write the *precise* delta of MKSH_LEGACY_MODE into lksh.1
2013-04-27 19:16:27 +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 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 5f5393b4f1 and, finally for today, fixup the “set -x” mess I made 2013-04-26 19:40:45 +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 0f417614dd ugh, signed >> on negative values is implementation-defined
(but, at least, not undefined, and usually right; regress-test for it)
2013-04-01 01:16:37 +00:00
tg c59707edd8 sync clog 2013-03-30 23:31:04 +00:00
tg ea657bd4d9 also do not, ever, use &> bashiop in lksh 2013-03-29 17:33:56 +00:00
tg a3b5e77c6c disable parsing of &> as GNU bash iop if -o posix or -o sh, based on IRC discussion where jilles(IIRC) pointed out it breaks existing valid scripts 2013-03-24 15:01:50 +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 d7c28d90f9 optimise prefer_cols print_columns display 2013-02-24 14:22:44 +00:00
tg 817aeb8fdb both mksh(1) and POSIX say: "$@" should always generate multiple words
issue in pdksh reported in IRC by engla, thanks!
2013-02-23 20:03:31 +00:00
tg 74e2ef8b0b one more int → bool; mention “set -o sh” may (on raare OSes) be enabled
automatically (and it differs between targets); test MidnightBSD 0.1 ash
compat code and adjust the testsuite so it passes with it enabled
2013-02-19 18:45:22 +00:00
tg dffb1ab915 put list of check_categories into Makefrag.inc generated; bump patchlevel 2013-02-18 22:55:40 +00:00
tg b684a7c6bd backpedal with $'…' and $"…" interpolation
it turns out this breaks more legacy scripts than anticipated
2013-02-17 05:40:17 +00:00
tg ec883318d1 fix too strict fix for LP#1104543 (Debian #700526) 2013-02-15 18:50:14 +00:00
tg 117bb02e6a check at least *one* of our “Duff’s Device” heavy occurrences
to make sure the compiler doesn’t frag it
2013-02-11 13:06:54 +00:00
tg fb370a30c6 fix set -e with and/or inside functions regression (LP#1104543)
cause was that use of && or || inside function switched it to xerrok
2013-02-10 23:59:28 +00:00
tg 19cbb1ab78 regression test for: return works in funsub (like AT&T ksh93), local works in funsub (like in functions), exit does not work in funsub (sadly unlike ksh93, like in functions) 2013-02-10 23:36:21 +00:00
tg c95d0ad11e missed in cid 10050B914D41435E735 2013-02-10 23:32:18 +00:00
tg af39f3b7b0 do NOT close stdout or stderr, redirect to /dev/null instead
⇒ we did have issues with that, trust me…
2013-02-10 19:04:00 +00:00
tg 9111faeeb5 besides more code reuse, fix $'…' everywhere (but keep it ignored in here document bodies that aren’t here strings) 2013-01-19 19:47:13 +00:00
tg e307cb34c4 use the full parser code for handling here strings (and here document words)
as ormaaj requested, including a testcase
2013-01-19 18:32:56 +00:00
tg 2d9a039ec0 ormaaj reported “command shift” not working correctly; fix 2013-01-06 18:51:43 +00:00
tg d5ba31fd86 fix the set +e cases, too 2013-01-01 22:23:16 +00:00
tg 744f77c668 fix running the ERR and EXIT traps in case of set -e and/or eval (includes Debian #696823) 2013-01-01 20:45:04 +00:00
tg 0700d45ce6 while thinking about mirlibₘᵢₙc I figured that sys_errlist[] entries may be NULL 2013-01-01 03:32:44 +00:00
tg 23325a3355 just blacklist cd-pe on QNX as well 2012-12-28 07:45:55 +00:00
tg f40e8b4d3d QNX 4 oh-so-argh! 2012-12-28 04:29:56 +00:00
tg a2042321ac meh, just don’t ever use ls(1) in a test; on some, it shows dotdirs 2012-12-28 04:25:32 +00:00
tg 39682506ff experimental test rewriting for QNX fun 2012-12-28 04:01:17 +00:00
tg 595f57ebad mark glob-range-3 as need-pass: no 2012-12-28 03:18:46 +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 866635468b RT says glob-range-3 breaks on QNX nowadays 2012-12-24 14:37:13 +00:00
tg 6d5e27a31a gcc-snapshot (see below) issued a clobber warning, and both it and mgcc
yowled about the memmove test until I found a compromise
gcc version 4.8.0 20121120 (experimental) [trunk revision 193662] (Debian 20121120-1)
2012-12-22 00:03:42 +00:00
tg ce602be6be sync clog et al. 2012-12-17 23:46:33 +00:00
tg c4e88acd83 Correct mistake when doing hashtable lookup collision resolution… oops 2012-12-07 23:46:38 +00:00
tg 98b6cd9b8d add testcase for basic I/O redir which RT had issues with on Linux 0.11 2012-12-07 23:43:09 +00:00
tg f654a3dea4 fix libFirm/cparser -Wsign-compare 2012-12-05 19:38:25 +00:00
tg cf807eb83a Add assertions and shuffle code around for LLVM+Clang scan-build. 2012-12-04 01:18:34 +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 cbf1cea38a sync clog 2012-11-26 23:14:46 +00:00
tg c9970fb7ba make regression testsuite once again safe to run with -DMKSH_NOPROSPECTOFWORK 2012-11-25 22:23:31 +00:00
tg 2fc5aa487b RT tells me Minix 2 (i386) also doesn’t have gettimeofday(2) 2012-11-20 18:50:46 +00:00
tg 68d8d83e67 add checks for ~+ and ~- (inspired by posh change) and bump date,
as I’m not likely to continue hacking tonight
2012-11-12 19:13:46 +00:00
tg b7659199ca fix a test 2012-11-12 18:48:29 +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 c7419d9e6a defer setting exstat for eval to 0 (the one used in case shell() is empty)
until after the stuff run in shell() has had a chance to toy with $?

bug forwarded by one of our packagers, found by one of their users
2012-10-21 21:55:05 +00:00
tg 59f7279ea2 this is now http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55009 2012-10-21 17:38:22 +00:00
tg d8662eb228 even more hacks to pass “-O666 -fstrict-overflow -Wstrict-overflow=9 -flto=jobserver” with “gcc version 4.8.0 20120930 (experimental) [trunk revision 191865] (Debian 20120930-1)” ☹ plus make the rtchecks mandatory 2012-10-03 17:24:23 +00:00
tg eac85ffdf1 OpenBSD found out that "building argv for $* and $@" manipulates l->argv
in place which affects ps(1) output on BSD; create a new array and copy
the original parts from argv[] there without touching argv passed to main
2012-09-07 21:02:43 +00:00
tg 0415b74436 Update wcwidth data from Unicode 6.1.0 2012-09-01 23:46:41 +00:00
tg e6ddeaa53d sync clog 2012-08-24 21:33:51 +00:00
tg bb5e56d4c4 remove ${ foo;} from mksh again due to buffering issues jilles found 2012-08-17 18:34:25 +00:00
tg f18b1fae85 bump 2012-08-03 18:45:32 +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 058e7f8ed4 do implement quoting, as ${foo@Q} though, as hommage at mirmake
dedicate this “release” to Andi
and use tomorrow’s (UTC) day for version, to cover up my debian fuckup
2012-07-20 23:22:13 +00:00
tg 4778a2a62f lesson learned from http://k1024.org/~iusty/blog/entry/perf-null/ – add -DMKSH_SMALL_BUT_FAST which gives more speed (8/20K less cycles, 5/9K less insns, 1.8/2.4k less branches, 65/275 less branch misses) on Debian/amd64 (klibc-static/eglibc) at cost of 0/2 more page faults and 6K/6K more text size 2012-07-01 15:55:00 +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 ae26f45417 fix emacs/vi lksh 2012-06-28 20:14:17 +00:00
tg ea01d80833 hackish work-around the lexer to make alias definitions in mksh -c
work (Closes: #517009) and mention in the manpage why they sometimes
do not work (doing so for COMSUBs is not worth the effort)
2012-06-28 20:05:11 +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 0c3aed77e0 fix trimming with positional parameters (Closes: #48453) 2012-06-28 20:03:20 +00:00
tg 1fa4453946 mh… all I’m gonna hack on upstream today… fix -t for manpage generation and cleanup code snippets; bump vsn; sync clog 2012-06-26 19:33:33 +00:00
tg c212458922 bump for mksh with lksh-except-long, so we get the ball moving 2012-06-26 18:11:05 +00:00
tg 2621715a17 fix two inverse logic mistakes (I’m apparently r̲e̲a̲l̲l̲y̲ fond of them… ☹) 2012-06-25 16:34:58 +00:00
tg 5386859b3f also get back octal crap for LEGACY KSH 2012-06-25 16:31:18 +00:00
tg 884fdef2b2 first LEGACY changes: keep filedescriptors always open; revert to historic ‘set -- $(getopt …)’ behaviour 2012-06-25 16:17:54 +00:00
tg 967e929e98 add basic LEGACY KSH mode (Build.sh -L), no changes yet 2012-06-25 16:05:10 +00:00
tg 6f1078606e bump after dealing with all things Benny had Coverity find
remainging CIDs not listed are either

• false positive (bug in coverity)
• intentional (possibly with lint override coverity doesn't parse)
• VLA (XXX find out how to mix C99 and ANSI VLAs)
• things flagged as possible resource leaks I have no idea about
  (no biggie though, and only in error cases I think)
2012-06-24 20:39:26 +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
tg f34cae3997 keep up 2012-05-04 22:44:34 +00:00
tg 5488e79d3b introduce a nosymlink check category (idea by RT); pass it to test.sh; use cp if ln -s fails (me) 2012-05-04 21:42:51 +00:00
tg b67de6ba17 add experimental code to use sigprocmask+pause+sigprocmask ipv sigsuspend (and harden j_sigchld handler for that) to improve working on BeOS 5.0 and Coherent UNIX, found by RT 2012-04-27 16:16:23 +00:00
tg 5204e7cc4f after discussion with ciruZ, switch mksh from NZAT to NZAAT fully
to get rid of the bias introduced by making the hash never zero

… he also pointed out a memory (heap) usage optimisation… which
may impact code size a bit though as I’d need to pass an additional
argument on hashtable function calls… or, forgo the benefit of not
having to pointer-align the key in the structure, which can be as
much as 3/7 octets per item, heap storage… OTOH the saved space is
4/8 octets per not-allocated item, possibly some code (use of an
multiply-add opcode), but the function call overhead/cost would
possibly be quite a bit… I guess I’ll have to measure…
2012-04-22 21:50:35 +00:00
tg 5eea59ad57 rewrite maketemp() obsoleting tempnam(3) and mkstemp(3) external deps 2012-04-14 16:07:48 +00:00
tg 5b4d0dbbc5 drop all deprecated code, you have been warned 2012-04-07 11:19:53 +00:00
tg 0c3f231d37 rewrite stateptr-underflow check to be perl-less 2012-04-06 12:30:40 +00:00
tg 179088fcc8 omit glob-bad-2 test on Dell UNIX 4.0 R2.2 (SVR4), too 2012-04-06 12:27:15 +00:00
tg 0019c23f4c write appropriate shell replacements for id(1) as well 2012-03-31 18:28:11 +00:00
tg 2e772dbf27 write appropriate shell replacements for printf(1) as well 2012-03-31 18:26:53 +00:00
tg e2a258c527 let regression testsuite pass without existence of /usr/bin/env, env(1)
by writing appropriate shell replacements
2012-03-31 18:18:41 +00:00
tg cf75e7b6ce couple of minor/cosmetic fixes from RT’s compile farm:
• promote SCO OpenServer and UnixWare to !oswarn
• omit trying -O2/-O on OpenServer 5 and USL C
• cast mksh_ari_t to int, mksh_uari_t to unsigned int for printf
• skip ulimit-1 on syllable (which is still too broken)
• write ((mksh_ari_t)-2147483648) ipv UB ((mksh_ari_t)1 << 31)
  and add a comment that that is actually meant
• rewrite functions returning !void ending in NOTREACHED
  so they’ve got a jump target returning an error at the
  end, to aid older compilers and just to be safe
• cast struct stat.st_size to off_t or size_t explicitly when needed
• shorten struct env by two bytes and an alignment, at least

also, optimise control flow and fix more paren matching cases
2012-03-29 19:23:01 +00:00
tg 95a2c63096 • implement fcntl(2)-based advisory locking as an alternative iff flock(2)
is not found, from a suggestion by RT (LP: #912691)
• try harder (in a loop) to acquire a file lock if the locking mechanism
  documents EINTR is a possibility (fcntl always, flock on Linux not .Ox)
• use -std=c99 not -std=gnu99 if it must be at all
2012-03-27 22:36:53 +00:00
tg 4f8b7de3a9 Susv3mon says: rlim_t are unsigned 2012-03-26 21:10:44 +00:00
tg 663105d0c2 check both signed and unsigned variants of this 2012-03-26 00:25:52 +00:00
tg 87654270ab fix regression w.r.t. TTY and external programmes:
• release the TTY after the initial change_winsz()
• since we release it, we can skip initialising tty_state, too
2012-03-25 14:28:14 +00:00
tg 1f96d87aea • MFC almost everything not breaking backwards compatibility or introducing
deep changes into R40-stable branch
• Version accordingly: HEAD gets 2012/03/24 (hi Eddy/Chris) so we backdate
  $KSH_VERSION for R40-stable to 2012/03/20 (hi David) as that comes before
  even though it includes today’s latest fixes
• Also, sync clog (including MFC indicators)
2012-03-24 21:22:25 +00:00
tg f9d644e243 be really loud when doing unwise things that WILL break in R41 2012-03-24 19:13:27 +00:00
tg 21c15c0b8f huh, I thought I had extended ${parameter@#hash} already; make it so now,
but not yet things like ${parameter@Fi} (1 if integer, 0 otherwise), etc.
also bump patchlevel and © years in recently changed files
2012-03-23 23:25:30 +00:00
tg 2baa40a768 • printf(1) on BSD/OS 4.1 does not play nice with NUL characters
⇒ use print builtin, everything else works; reported by RT
• extend the testsuite, ensure print can do NUL correctly
2012-03-20 16:48:12 +00:00
tg e141394a83 RCSID sync from oksh; reduce hash table #elements if !MKSH_SMALL to speed up 2012-03-03 21:30:59 +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 bee3bbaaf8 reduce stack usage a bit (several candidates for more, including $CC itself…) 2012-01-29 01:41:15 +00:00
tg 8b023994de shave off some redundancy 2012-01-14 19:20:17 +00:00
tg e538a90e57 I hate Cygwin. Adjust sed for the fact that an mksh called as mksh.exe gets mksh in argv[0]; reported by Chris Sutcliffe 2012-01-05 11:52:48 +00:00
tg ac29bad3fe fix regression escaping single-char strings 2012-01-04 19:09:36 +00:00
tg 2539450588 fix regression in jaredy’s security patch introduced in R35b
(cid 100487B467E068A55D6 and 10048949D196A7C1390) discovered
by Jb_boin: time with a not-TCOM subtree would now trash its
string argument (which is the loop variable for TFOR); amend
regression testsuite
2012-01-03 15:32:08 +00:00
tg 34036ec32e MSYS implies -DMKSH_ASSUME_UTF8=0 and thus can skip the test that’d fail 2012-01-03 01:40:15 +00:00
tg 2578c66b61 move linkage check (which uses sh.h INCLUDES_ONLY) to when all of its
prerequisites are actually fulfilled, i.e. evrn further down than with
the last commit doing this, and move some prerequisites of stuff that
has wandered outside the !INCLUDES_ONLY block with the compile-time
assert changes to the outside, too

fixes FTBFS on MSYS which has neither <stdint.h> nor uint32_t
reported by RT
2012-01-03 00:58:09 +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 dd8925a475 ensure aliases in COMSUB are not expanded twice
spotted by Jilles Tjoelker again, thanks
2011-12-29 22:03:15 +00:00
tg 7b89945505 use sane spelling of read-only consistently 2011-12-16 20:03:28 +00:00
tg e18f4d114a actually, behave with silent wraparound; results validated by bc(1) 2011-12-11 01:56:43 +00:00
tg 971b153933 catch intmin/-1 instead of dumping core on SIGFPE; from Jilles Tjoelker 2011-12-11 01:35:10 +00:00
tg 3b87d173d4 • finally, the code and manual page text to deprecate, and code to not
handle any more, octal 010 style constants, as promised
• overhaul the manpage re. arithmetic expressions, make the guarantees
  mksh code has explicitly, precisely, clear
• to reduce burden of the compiler, getint() now operates on mksh_uari_t
  internally; it already applied the sign after operation, anyway (C99
  guarantees wraparound on unsigned types, but for signed types we need
  specific compiler support; apparently, this comes from hardware limits)
• use const and shuffle order of locals around while here
2011-12-10 13:34:19 +00:00
tg 15cfc6c88d add tests for
• integer base flat (10, 010, 0x10)
  ‣ posix, right variants (heh, just like timezones)
  ⇒ both enabled, which means one test always fails right now,
    until the code changes are in…
  ☹ mksh R21 and up, AT&T ksh93, posh, GNU bash, busybox sh, dash
    all use the posux variant
  ☺ mksh R20b and below, pdksh, zsh, python, perl, php all do it right
  ‣ posix is stupid to use C (strongly typed, compiled) semantics
    for an untyped _scripting_ language
• integer bases 1 (mksh specific), 2 to 36, and that 37 errors out
  ‣ both directions
• integer arithmetic, signed and unsigned, wraparound and value span
2011-12-09 20:40:02 +00:00
tg 63b9d60b31 MKSH_DISABLE_DEPRECATED needs testsuite handling 2011-12-08 22:19:04 +00:00
tg 1ac636670f • improve comments
• do shave off 20 bytes from c_test() and get rid of the ugly stack
  variable and double “using” despite not parsing
2011-12-02 22:55:49 +00:00
tg 2fb9df56e4 rewrite funcs.c:c_test(), i.e. test(1) and [(1), to follow POSIX and XSI
in the cases where they are defined unambiguously; bug reported by
Jilles Tjoelker in <20111129232526.GC14357@stack.nl> due to a report
by Stefano Lattarini on bug-autoconf

in the ambiguous case, I stick to traditional pdksh behaviour, which means
	test ! a = b	vs.	test a = b
and
	test ! a -o b	vs.	test a -o b
behave different from each other (in the second case, the NOT operator
binds strong; POSIX demands a reduction to 3 arguments and negating
that result in the first case), so we're at two known not-ok in the
FreeBSD® testsuite. (81 and 82 in regress.sh,v 1.3)
2011-11-30 21:34:15 +00:00
tg 0695039dc0 fix stateptr-underflow; really do call fastbox regression checks; bump vsn 2011-11-26 00:45:21 +00:00
tg 63878e8aef another couple of verbose checks; the *-global are mksh specific but work;
mksh currently fails arrassign-fnc-local (never worked either)
2011-11-25 23:33:42 +00:00
tg 2ff9255f39 add a -f option to test.sh that runs tests of class fastbox
plus a test in that category for a bug spotted during development of
https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=shellsnippets/shellsnippets.git;a=blob;f=mksh/sysadmin/getjpics.cgi;h=d74018cbc1ae4e88408267ecc73a6df19aa4c99a;hb=HEAD
2011-11-25 23:29:31 +00:00
tg dd014625e1 Fix regression introduced by mixing the recursive parser and support
for ;| and ;& in TCASE: ;;-less last casepart produced ";\0" in the
SREREAD string which obviously cased reparsing to fail

test from http://www.in-ulm.de/~mascheck/various/cmd-subst/
2011-11-22 18:01:41 +00:00
tg d7079f3f0e bump 2011-11-19 21:22:02 +00:00
tg 0220aeeb61 disable cd-pe test on Hurd, it also wrecks havoc with check.pl
https://buildd.debian.org/status/fetch.php?pkg=mksh&arch=hurd-i386&ver=40.2-4&stamp=1321059202
2011-11-19 17:25:55 +00:00
tg e20b1295b7 promote x=(a b); x+=(c) to standard mksh functionality at cost of 932 MKSH_SMALL .text bytes on MirBSD/i386 2011-11-11 22:14:19 +00:00
tg 90afc54ee8 • select(0, …) misbehaves on Interix (by Markus Duft <mduft@gentoo.org>)
• select(n, NULL, NULL, NULL, …) behaves the same (by Bruno Haible)
2011-11-09 22:17:26 +00:00
tg f048ac2f58 disable another symlink-using test on MSYS 2011-11-08 23:10:58 +00:00
tg c620f865c1 cid 1004E0F5C27271F5B00 broke integer-base handling of built-in parameters
mksh -c 'echo a=$RANDOM; RANDOM=0x12; echo b=$RANDOM' # behaviour changed
2011-11-08 22:07:15 +00:00
tg f92108dccc make MSYS match Cygwin more closely; ignore its broken <stdint.h> 2011-11-05 23:39:02 +00:00
tg 92b60a9a5e forgotten in cid 1004EA5BF612F516747 to take '\n' presence as $'…' quoting reason 2011-10-26 20:46:16 +00:00
tg 5893a36bad document “export -” accident found by Snader_LB 2011-10-24 19:41:13 +00:00
tg d6bf9c197b better handling of eval and CPPFLAGS in build system 2011-10-07 19:51:44 +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 5d9c88ceeb jg71 reported -DMKSH_ASSUME_UTF8=* breaks defining stristr 2011-08-27 17:30:07 +00:00
tg 80223417d7 followup fix for 1004D90467358D6B13C regarding escaped substitutions
found in, out of all things, Debian/m68k, by Wouter Verhelst (Yoe)
fix hacked at DebConf 11, Бања Лука, Република Српска, Босна и Херцеговина
2011-07-26 16:57:28 +00:00
tg a7566387cf optimise an if away, and possibly even the function bodies… 2011-07-20 23:47:29 +00:00
tg 6ce68e906f now that I got Hash.cs compiled and run, I’m amazed; make NZAAT (and NZAT!) all green with a small tweak; bit distribution and χ2 look OK as well 2011-07-18 00:35:46 +00:00
tg 09db3d67a2 finish merging from R40-stable; set version number to yesterday though 2011-07-16 17:08:52 +00:00
tg 620faa3dc9 ‣ merge from mksh R40-stable
drop heredoc-weird-3 while here, it’s not deterministic by design(?)
2011-07-16 17:08:35 +00:00
tg 3f014c8daf utf8opt-3 needs to be split in half, part of it needs-ctty
10x arekm again
2011-07-07 21:02:39 +00:00
tg a4a000eafb take down the entire xterm (or GNU screen tab), hard, with:
mksh-R40 -c 'x=$COLUMNS; awk "BEGIN{exit(1)}"'
10x to the PLD Linux guys for spotting _and_ bisecting this!
2011-07-07 20:24:53 +00:00
tg 3ef67e3296 replace uses of OAAT hash in all its variants by NZAT (mksh internal) or NZAAT (all others) 2011-07-06 22:22:02 +00:00
tg f2405b7dde • bump patchlevel to today’s
• while here, reformat 'struct tbl' comment-wise and placement-wise
  and drop the Tflag typedef
• while here, write regression test for the "global" built-in, which
  does what typeset is supposed to do except that it doubles as "local"
2011-07-05 20:12:20 +00:00
tg 0739fa74a0 address "env RANDOM=1=2=3 mksh" DoS by integrifying more 2011-07-02 17:57:41 +00:00
tg edaab2cafe tabcomplete ~ and ~foo like $FOO (idea by yofuh) 2011-06-30 13:48:13 +00:00
tg 43c8d8765f pretty tricky thing, IBM’s curses library does nameref foo=foo… 2011-06-21 21:50:26 +00:00
tg 7ce3a2ad54 HP-UX aCC suggested more “≠ 0” and parenthesēs 2011-06-12 14:58:45 +00:00
tg 6571d66386 add missing shf_flush() before prompting 2011-06-11 03:14:50 +00:00
tg 5aa22cff70 • fix empty input
• fix input without trailing newline for integer-base-one-3{A,W}r
2011-06-09 21:53:12 +00:00
tg 1fbd3e5ee0 bugfix for when the last line was full 2011-06-09 21:26:21 +00:00
tg 60ccad3dfc check for embedded NULs work 2011-06-09 21:10:50 +00:00
tg e0fb8dc431 • rework hash table interna to avoid gcc-4.1 on Debian etch bug
• also improve behaviour with _a lot_ (>2²⁸) entries
• while here, improve comments and whitespace
2011-06-05 19:58:21 +00:00
tg 92ea9a224f heredoc-weird-3 is timing-critical ⇒ need-pass: no 2011-06-05 16:49:54 +00:00
tg 57b849910f mark all 2×3 history-ed tests as need-pass: no 2011-06-04 17:08:11 +00:00
tg ebb8bed911 fix segfault due to limit of hashtable entries (global variables) discovered by Jb_boin: unlimit to 2^30 minus epsilon 2011-06-04 16:42:31 +00:00
tg b3d38f9cdf better parsing for x=(…) – bug noted by Frank Terbeck 2011-06-04 16:11:20 +00:00
tg 128a2e8fc1 add test for x+=(y z) and ;;& functions in tree dumper (!MKSH_SMALL) 2011-05-29 16:38:58 +00:00
tg d1b8800ee8 • AIX: display OS version better (tested on 5.3 by cnuke@)
• IBM XL C: display version better (tested on V7.0 by cnuke@)
• do not 'IFS=: read nr name', Cygwin 1.7 dash fails it
• disable cd-pe, glob-range-3 on Cygwin (the former cannot
  succeed because the mv fails, the latter fails from 1.7 on)
• mark heredoc-tmpfile-8 as need-pass: no
• apply __attribute__ only to a function prototype, not to
  the body (even if static), since xlC fails that
• bump version to R40 (beta)
2011-05-29 16:31:42 +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 9fe3ba48d2 handle MKSH_SMALL not doing foo+=(…) 2011-05-07 02:02:47 +00:00
tg 40e914e8a5 • fix an inverted logic bug in the test I wrote
• only trigger deleting an alias in favour of a function for “()”, not
  just the opening parenthesis: “stop( )” is not a function definition
  (well, actually it seems to be, but… not according to POSIX, anyway)
• defer dropping the alias until the function is actually defined (õÕ)
2011-05-07 00:51:12 +00:00
tg 88686b81bd a regression and a new bug, found during cvs development 2011-05-07 00:02:26 +00:00
tg 3f21a0e199 • add patch from Robert Luberda <robert@debian.org> fixing the
four-argument form of test (yet again…), thanks
• drop the obsolete (pre-POSIX) form “test -t” without fd
2011-05-06 15:41:25 +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 4345dd1fb8 += support for variables and arrays 2011-05-04 23:16:05 +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