Commit Graph

751 Commits

Author SHA1 Message Date
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
tg 8bc51681b1 sync clog 2011-04-22 21:44:35 +00:00
tg 61a8888213 always catch SIGALRM even in non-interactive shells to make sleep work 2011-04-17 12:24:44 +00:00
tg e39dea490f sync… various things 2011-04-09 18:47:14 +00:00
tg 8c46637835 cnuke says Haiku is like GNU in that it has no /usr whatsoever 2011-04-09 15:39:50 +00:00
tg 7d3643d7b4 skip the UTF-8 BOM early, then check the magic (ELF, a.out, COFF, …) 2011-04-02 10:30:11 +00:00
tg a7091123aa Add “-C regress:no-ctty” option to test.sh for Fedora chroots
STRONGLY DISCOURAGED
2011-03-28 21:58:06 +00:00
tg b91b037e6a we got a decision on pathnames with exactly two leading slashes
thanks, Eric and David!
2011-03-28 21:31:01 +00:00
tg 6fddfc009b I made a mistake in the tests; this stuff works always (and can be tested)
but triggers only for /bin/sh if MKSH_BINSHREDUCED (otherwise needs -o sh)
2011-03-28 21:18:00 +00:00
tg 19e128c4e1 add testcases, bump vsn 2011-03-28 08:40:42 +00:00
tg e8ea9954aa • Implement http://austingroupbugs.net/view.php?id=367 and align things
a bit more with POSIX and the other shells

I considered http://austingroupbugs.net/view.php?id=253 but the use
of bi_errorf() is interesting, especially as it’s often enough a
noreturn function, and funnily enough, 'cd -P /foo' returns 0 while
'chdir -P /foo' fails (so idk where to put -e)…
2011-03-27 18:50:06 +00:00
tg 5f31b8c97a • bring back test -H ifdef S_ISCDF (for HP-UX)
• whitespace, etc.
• bump version for tonight, I’m not gonna hack on c_cd,
  all this pathname stuff is mind-boggling…
2011-03-26 21:46:06 +00:00
tg a55de5f840 • rewrite simplify_path() to keep more in line with do_realpath()
• add regression test to ensure that //foo pathnames are never simplified
2011-03-26 21:09:09 +00:00
tg 79862cc1f4 one more from Austin ML 2011-03-26 16:19:29 +00:00
tg 84f7055f8f special-case another bizarre POSIX corner case
after david korn agreed to change ksh93 to match
2011-03-26 16:11:43 +00:00
tg 2dffc771ac new (some possible) testcases from Austin ML, and one fix 2011-03-26 15:32:37 +00:00
tg 8d8ee0cc6a ironhead reported in IRC that some Cygwin guys (not he, he’s just the
packager) complain that mksh collapses two leading slashes; IIRC POSIX
has a clause for UNC pathnames, so stop doing that, plus add a test
2011-03-23 18:47:07 +00:00
tg bc4c3b9af0 • save/restore here document pointer during yyrecursive(), fixes crash
• add mirbsd/openbsd (omalloc rules!) specific testcase for the above
• $__progname must be used quoted, fix in comsub-torture testcase (my bad)
2011-03-21 21:57:35 +00:00
tg 3c41d2b063 fix cast; bump version 2011-03-17 22:09:23 +00:00
tg 5239e8ea4c actually, we need the android lsmod to be a builtin not an alias… 2011-03-16 20:56:33 +00:00
tg 79c6d6043e • introduce a virtual TARGET_OS=Android that just sets a check category
and switches to the TARGET_OS=Linux
• introduce android as regression test suite category
• add an android specific standard alias
• clean up redundant ‘-o sh’ arg in a few checks
2011-03-16 20:26:36 +00:00
tg fd0d60b71b testsuite for mksh-small needs adjusting 2011-03-13 17:07:08 +00:00
tg 4e7d9bdb33 we need not only store into the retrace buffers recursively but also ungetsc 2011-03-13 16:20:45 +00:00
tg af53a7d16a • speed optimisation: drop SF_FIRST flag, factor out skipping the
UTF-8 BOM instead (UTFMODE has a separate value now for activated
  during BOM skipping)
• parsing a COMSUB now skips UTF-8 BOM, too, but only temporarily
2011-03-13 16:03:54 +00:00
tg e66eaab861 let SLETARRAY use SRETRACE, too 2011-03-13 15:57:23 +00:00
tg 2a3d4db123 lint is your friend 2011-03-13 01:20:25 +00:00
tg a3c79ad771 now fix that segfault and other bug from yesternight
do it like ksh93 though, not like bash and zsh
2011-03-12 23:06:43 +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 fb1392fb6b even more test cases for comsub (2 breaking, but one of them fixed already) 2011-03-12 20:20:17 +00:00
tg 97e1987dbf tests for a segfault and a failure-to-fail from “Jb boin on dedior” on IRC 2011-03-12 01:04:39 +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
tg 6894618bb9 • x=$(cat <<-EOF
EOF) # works again now, plugging a regression
• rewrite the here document parsing code to be *much* more efficient
  (and a bit more readable too!) using goto, while here (no kidding)
2011-03-07 20:32:50 +00:00
tg 1f392ab09b • more fixes (some regression, some new)
• more testcases, stricter testcases
2011-03-06 17:08:14 +00:00
tg 469da2e5e4 drop IFS-space-colon-3 because dash is the only shell which passes it,
but ksh93 passes ifs.sh which I assume is more correct, and mksh and
ksh93 have the same result for this (as do bash2/4, posh; zsh differs)
2011-03-06 17:06:17 +00:00
tg c995f7ca98 I thought of making COMSUB pass a pointer to the struct op *t->left around
instead, but the parser for the so-called “backticks” (U+0060) still emits
plaintext COMSUB wdstrings, and the evaluation code emits plaintext if the
code is not run (‘-n’ option), so it’s not worth the effort and memory ma-
nagement issues, even though it _would_ optimise the most common case…

Bump version numbers, sync regression tests; add one testcase from the old
webpages too. Sync manpage, this now works, but keep the workaround in, as
“portability issue” with slightly changed wording.

Also, /bin/sleep must be used in one manpage example if sleep is built in.
2011-03-06 01:50:11 +00:00
tg ad2fd952e4 nvm, got it 2011-02-27 19:41:17 +00:00
tg 3019066e60 no idea why MiNT has this… issue… 2011-02-27 19:31:34 +00:00
tg e0c4ad7fa9 port to FreeMiNT: add OS uname and flags; 2>&- is evil™; $UNIXMODE must be preserved; unlink(2) is weird 2011-02-27 19:29:20 +00:00
tg 816bf86710 MKSH_NOPROSPECTOFWORK has no co-processes. at all. 2011-02-19 21:39:14 +00:00
tg 0b57abd4d3 • add -u option (POSIX: unbuffered ⇒ nop) to the built-in cat
• PIPESTATUS now supported (like bash 2) whose last member
  may actually differ from $? since the latter may not be the
  result of a pipeline partial command
• add regression tests, documentation, etc.
2011-02-18 22:26:13 +00:00
tg 36d41ed9ee * plug a regression introduced as a pasto (think, mira!)
* add selftest-direct-builtin-call regression test, while here
2011-02-13 21:13:08 +00:00
tg a796512040 • more comment and int→bool cleanup, add and improve some comments
• in interactive mode, always look up {LC_{ALL,CTYPE},LANG} environment
  variables if setlocale/nl_langinfo(CODESET) doesn’t suffice
• add the ability to call any builtin (some don't make sense or wouldn't
  work) directly by analysing argv[0]
• for direct builtin calls, the {LC_{ALL,CTYPE},LANG} environment
  variables determine utf8-mode, even if MKSH_ASSUME_UTF8 was set
• when called as builtin, echo behaves POSIXish
• add domainname as alias for true on MirBSD only, to be able to link it
• sync mksh Makefiles with Build.sh output
• adjust manpage wrt release plans
• link some things to mksh now that we have callable builtins:
  bin/echo bin/kill bin/pwd bin/sleep (exact matches)
  bin/test bin/[ (were scripts before)
  bin/domainname=usr/bin/true usr/bin/false (move to /bin/ now)
• drop linked utilities and, except for echo and kill, their manpages
• adjust instbin and link a few more there as well
2011-02-11 01:18:23 +00:00
tg 5161342b9b fix warning about signed vs. unsigned comparision and potential truncation error 2011-02-09 13:08:27 +00:00
tg d4658a569e refactor code to be able to track whether we have a parameter substitution
or a “proper” glob expansion; if there’s a dollar, but not a glob, refrain
from appending a space later (LP: #710539)
2011-02-03 15:57:52 +00:00
tg d7c2e16ca0 fix typos 2011-01-30 02:18:25 +00:00
tg 30d8e3934d SUSv4 says trap foo UNKNOWN is not a syntax error, merely exit ≠0.
Inspired by 673dab8698b0399c967216c02262eaf95361a75c.
2011-01-30 01:36:00 +00:00
tg bdfcdc56c8 introduce MKSH_NOPROSPECTOFWORK which is like pdksh’s JOB_SIGS in reverse, like MKSH_UNEMPLOYED is pdksh’s JOBS in reverse; allows mksh to work (hah! no pun intended…) with klibc (and possibly, Syllable Desktop and Plan 9) for now, until they fix their bugs 2011-01-30 01:35:35 +00:00
tg 414c09ab1a plug regression introduced with read -d by fixing the problem differently 2011-01-22 20:33:14 +00:00
tg da9d0f3d97 ${foo@x} is now special-expansion for values of x, defined for now:
‘#’ = hash of $foo
2011-01-21 22:25:34 +00:00
tg 846fbde3b8 add read with delimiter, like AT&T ksh93 (thanks Dave for the suggestion) 2011-01-21 22:00:17 +00:00
tg 230f59d064 New functionality: assign here document to string variable directly,
without cat and temp files. Hacked in Lëtzebuerg ☺

This was the third try. Where to put this was not palpable… same for =(…)
2011-01-09 21:57:29 +00:00
tg b4948e430f this is a bashism but might be from ksh93 IIRC… still dead ugly as hell! 2010-12-19 20:00:56 +00:00
tg 27dce9168a change behaviour of argument-less exit in traps to match SUSv4; Debian #599484 (original patch from Jonathan Nieder, thanks!) in a variant that appears to handle nested traps well 2010-11-01 17:29:05 +00:00
tg 3365cb8d0f • Build.sh: fix a compiler warning which, had it not been irrelevant in
a mirtoconf check, would’ve been a real problem on an LP64 platform
• sh.h: work around a bad interaction between -Wformat on gcc and manual
  string pooling for T_synerr, which is used in place of a format string
  in some places
2010-10-01 19:04:38 +00:00
tg e169648b89 while here, change SETUID_CAN_FAIL_WITH_EAGAIN to abort immediately
by suggestion of Chris Palmer again
2010-09-19 19:28:23 +00:00
tg 915b30adfe revert part of the “size reduction” diff (zero size change though):
shellf() implies an shf_flush()…
2010-09-15 21:08:19 +00:00
tg 667d792d6a • Address concerns of Chris Palmer from the Android security team
– possible integer overflows in memory allocation, mostly
    ‣ multiplication: all are checked now
    ‣ addition: reviewed them, most were “proven” or guessed to be
      “almost” impossible to run over (e.g. when we have a string
      whose length is taken it is assumed that the length will be
      more than only a few bytes below SIZE_MAX, since code and
      stack have to fit); some are checked now (e.g. when one of
      the summands is an off_t); most of the unchecked ones are
      annotated now
    ⇒ cost (MirBSD/i386 static): +76 .text
    ⇒ cost (Debian sid/i386): +779 .text  -4 .data
  – on Linux targets, setuid() setresuid() setresgid() can fail
    with EAGAIN; check for that and, if so, warn once and retry
    infinitely (other targets to be added later once we know that
    they are “insane”)
    ⇒ cost (Debian sid/i386): +192 .text (includes .rodata)
• setmode.c: Do overflow checking for realloc() too; switch back
  from calloc() to a checked malloc() for simplification while there
• define -DIN_MKSH and let setmode.c look a tad nicer while here
2010-09-14 21:26:19 +00:00
tg 56a69907d5 optimise error messages, option parsing, and make more builtins
recognise "--", costs us 20 .text 0 .data 0 .bss
2010-09-05 19:51:35 +00:00
tg 06c6be0a70 shave off another 468 bytes: we’re 300 bytes smaller than BEFORE the
cat builtin was added now… (also removed utf-8 from source files, in
favour of just ASCII)
2010-08-28 20:22:24 +00:00
tg d09fd67299 make cat an mksh builtin, for things like here documents
if any options are given, the external programme is invoked instead
2010-08-28 17:21:46 +00:00
tg 1924f91aad this is 「category: os:mirbsd」 because of hardcoded errno and strerror values 2010-08-24 15:47:44 +00:00
tg 7fdc42cead fix realpath builtin’s handling of (source) pathnames with a trailing slash
as per POSIX (if a trailing slash is part of the symlink target it fails as
well, like GNU readlink -f does)
2010-08-24 14:42:04 +00:00
tg c187f3089f a tad annoying, when external programmes such as GNU screen are running,
we don’t get SIGWINCH when the window size changes during the runtime of
that, so, the signal is only usable reliably during editing in the shell
and we re-check the window size before each interactive edit line again
2010-07-25 11:35:43 +00:00
tg befbed2859 int → bool 2010-07-24 17:08:30 +00:00
tg c11d35312a Michal Hlavinka from Red Hat found another SIGSEGV
fix: when iterating over all Sources, know when to stop…
2010-07-21 11:31:16 +00:00
tg c6eedad976 *sigh* this code is interesting: assume you want to output via shf to
a string buffer whose window size is currently 32 (initial), your data
is 96 bytes, this routine used to resize the buffer to 64, append your
first 64 bytes to it (no matter if there's already something in it)
and then writes the remaining bytes to stdio fd instead of the string…
if it doesn’t SIGABRT before

discovered by wbx@ – thanks – bug inherited from pdksh 5.2.14 (AD 1999)
2010-07-19 22:41:04 +00:00
tg 7c91e018f4 • merge printf from OpenBSD
• deactivate %a and %A since our libc doesn’t have it
• rewrite the mksh integration code to use shf instead of stdio, removing
  floating point support always in the process, as shf doesn’t support it
  ⇒ saves 11114 (6706 text, 168 data, 4240 bss) with dietlibc on Debian
• fix -Wall -Wextra -Wformat -Wstrict-aliasing=2 for gcc (Debian 4.4.4-7)
• fix these and -Wc++-compat for gcc version 4.6.0 20100711 (experimental)
  [trunk revision 162057] (Debian 20100711-1) except:
  – a few enum warnings that relate to eglibc’s {g,s}etrlimit() functions
    taking an enum instead of an int because they’re too stupid to adhere
    to POSIX interfaces they design by themselves
  – all “request for implicit conversion” involving a "void *" on one side
• tweak the manual page somewhat more
2010-07-17 22:09:40 +00:00
tg 6b006202a1 partial oksh sync (RCSID and do add some parenthesēs to the list of
reserved words, but really only these which are only recognised at
the beginning of a line as the context says, not blindly all of them)
2010-07-13 13:12:32 +00:00
tg a6c81ea978 on obsd/mbsd, entropy is cheap enough for us to do this (codepath in
kernel checked for both) for additional seeding ($RANDOM is still from
the LCG only)
2010-07-11 11:17:33 +00:00
tg 30046ffcf2 implement “live” SIGWINCH handling in the Emacs editing mode
for winstonw from IRC #!/bin/mksh
2010-07-04 17:45:17 +00:00
tg 747b27a846 apply diff from manuel giraud via oksh to keep track of LINENO in a trap 2010-05-22 12:49:16 +00:00
tg 549c510269 related to 1004BF041CB522EEEE3 ${foo[*]} is a vector too; add testcases 2010-05-16 19:17:42 +00:00
tg f24e2c80a9 disallow some more kinds to trim a vector; Debian #581867 2010-05-16 19:04:42 +00:00
tg 01a0d1104a address two performance issues in do_realpath():
• avoid calling realloc twice in sequence, since the final
  size is known at the first call already
• do not lstat(2) the same path twice in the Hurd codepath
2010-04-27 21:39:09 +00:00
tg 6e98fbe27b Fourth time’s a charm… another bugfix related to the commitids
1004BBDD84556472D84, 1004BBF77B81D30DA7C and 1004BBF7CD656308A1C
to unbreak kwalletcli
2010-04-20 09:10:07 +00:00
tg 14ea7e9038 draft a testcase to understand the problem fixed by cid 1004BBF77B81D30DA7C
and make it actually work: the OpenBSD fix failed since 1004BBDD84556472D84
2010-04-09 19:16:31 +00:00
tg b2d317986d more tests (from Herbert Xu) and answers (from Geoff Clare) 2010-04-09 14:46:43 +00:00
tg ff9f89f22f Fix two more POSIX conformance bugs and minor documentation/comment issues 2010-04-08 13:21:08 +00:00
tg 401e262689 fix another expand-ugly SUSv4 bug 2010-03-27 16:53:17 +00:00
tg 2bb0ddb80d let’s just add more test cases
from Message-ID: <309618f38393fa1d57b69a67f1a6ce02@austingroupbugs.net>
2010-03-18 19:45:39 +00:00
tg 05fe209521 correct #39 (but leave #38 as-is and hope POSIX gets fixed instead)
cf. Message-ID: <20100316102753.GB26711@squonk.masqnet>
2010-03-16 21:32:47 +00:00
tg 50f081c369 even better on Haiku:
* let ulimits work
* add a Haiku-specific ulimit
* always use UTF-8, they have no locales but a UTF-8 terminal
2010-03-14 11:58:33 +00:00
tg 251189868d another test (#39 is up for discussion on austin-group-l still) 2010-03-01 17:28:05 +00:00
tg e5e6857c43 (hopefully) fix the substitution thing for good 2010-02-25 20:18:19 +00:00
tg 3ba694a00d more/improved test cases
• expand-unglob-{dblq,unq} are the same as dash, but with ‘\}’ → ‘}’ as
  per austin-group-l discussion, although this is not (yet) a standards
  requirement, just a “doesn’t make sense otherwise” thing
expand-ugly:
• printf '%s\n' "foo ${IFS+"b   c"} baz" → no field splitting, ksh93 is
  wrong here (§2.6.2)
• ‘\}’ vs. ‘}’ as above
• ksh93 dropping a ‘}’ is probably another ksh93 bug
2010-02-25 11:47:33 +00:00
tg ae2901146f begin fixing up ${foo+word}, see austin-group-l for discussion and DR 2010-02-23 21:51:49 +00:00
tg 150a35a02d x_bind cannot have the nonnull attribute
cought by Frank “enstein” Terbeck «ft:#grml» (efftee), 10x
2010-02-23 18:13:04 +00:00
tg 5beee95d6b at least _parse_ the construct ${foo+(bar)} correctly
(whether the output is correct is still up for debate)
2010-02-18 17:31:23 +00:00
tg 0d1083fc9c this exclusion is unwarranted 2010-02-18 17:30:19 +00:00
tg 4eb17f8752 remove some more of this ugliness 2010-01-29 09:34:31 +00:00
tg c67bed8790 • unbreak testsuite for MKSH_SMALL
• sync version and © year
2010-01-28 20:58:34 +00:00
tg 0c94277ccb To solve the incompatibility issues between mksh-current, old mksh versions
and vendor pdksh versions, re-introduce FPOSIX alongside FSH. The semantics
are now:
‣ set -o posix ⇒
  • disable brace expansion and FSH when triggered
  • use Debian Policy 10.4 compliant non-XSI “echo” builtin
  • do not keep file descriptors > 2 to ksh
‣ set -o sh ⇒
  • set automatically #ifdef MKSH_BINSHREDUCED
  • disable brace expansion and FPOSIX when triggered
  • use Debian Policy 10.4 compliant non-XSI “echo” builtin
  • do not keep file descriptors > 2 to ksh
  • trigger MKSH_MIDNIGHTBSD01ASH_COMPAT mode if compiled in
  • make “set -- $(getopt ab:c "$@")” construct work

Note that the set/getopt one used to behave POSIXly only with FSH or
FPOSIX (depending on the mksh version) set and Bourne-ish with it not
set, so this changes default mksh behaviour to POSIX!
2010-01-28 15:18:51 +00:00
tg 2e9654ffa4 introduce “typeset -i foo[*]”, rationale see cid 1004B5DA60A56BFB604 2010-01-25 14:25:16 +00:00
tg c700693d11 Add “unset foo[*]” mksh extension, which allows to unset the *contents*
of foo[0] (but not its attributes), and the rest of the array, so that
later “set +A foo bar” will set foo[0]=bar but retain the attributes.

This is important, because, in the future, arrays will have different
attributes per element, instead of all the same (which, actually, is
not entirely true right now either, since “unset foo[0]” will not mo-
dify the attributes of a foo[1] existing at that point in time), where
foo[$newkey] will inherit from foo[0], but typeset foo will only affect
foo[0] no longer foo[*] in the future. (The rules about typeset=local
will still apply, as they affect creation of variables in a scope.)
2010-01-25 14:11:29 +00:00
tg 833810a154 While we were supposed to use Ctrl-Arrowkey for wordwise jumping,
some idiotic terminal emulators and/or people seem to use the es-
cape codes normally denoting Alt-Arrowkey instead so let's simply
bind them to the vt_hack as well... (untested)
2010-01-08 22:21:06 +00:00
tg df4137c2e2 I don't care that AT&T ksh93 fails this nameref test case, but
it's important and we'll want it.
2010-01-04 21:08:00 +00:00
tg 0611ecad1f make [[ -o ‣-U ]] = [[ -o ‣+U ]] = [[ -o ‣utf8-mode ]]
where ‘‣’ is either nothing, ‘!’ or ‘?’ as usual.
2010-01-01 18:02:01 +00:00
tg 6115f5a91c • re-implement wcswidth-like behaviour for ${%foo} even in !UTFMODE
• merge the rest of branch tg-wcswidth-behaviour
• enhance test cases for wcswidth-like behaviour
• switch hash table collision resolution algorithm to Python’s as announced
• bump vsn
2010-01-01 17:44:10 +00:00
tg c413edb34a jobs.c: apply patch from deraadt@o:
│remember to restore errno (ie. stop someone from making a mistake later)
│ok guenther
check.t, sh.h: bump vsn

I wonder though why errno must be restored even if nothing was
called after reading it… moid?
2009-12-31 14:05:44 +00:00
tg 769e222586 re-vamp __attribute__ handling; let this pass on HP-UX bundled compiler
as well as HP aCC
2009-12-12 22:27:10 +00:00
tg 8213a28403 llvm/clang scan-build is now content… 2009-12-05 17:43:50 +00:00
tg 417fd60c76 * fix 'set -A foo -- [2]=a b c' contingency (tested against GNU bash4,
which, in its latest sid incarnation, even received mksh's ability
  to produce ${!foo[*]} array keys, wow!)
* plug a memory leak while here (ATEMP only, but still)
2009-12-01 19:15:35 +00:00
tg fa3acb939b fix 'mksh -U -i' and 'mksh +U -i' 2009-11-28 15:38:30 +00:00
tg a09f05e77a /me is annoyed
I read, IIRC in the Cederqvist, that 'cvs tag' sets a sticky tag onto
the cwd… it doesn’t, apparently. (I actually like it better this way,
but one needs to know!)
2009-11-28 14:28:03 +00:00
tg 883d9d99b3 switch ${%foo} to wcswidth-like behaviour – slightly problematic, and
the “set +U” case isn’t even handled

committed to branch because I’d like to get more input on this, for now
2009-11-28 14:21:47 +00:00
tg 4cff10296b bump vsn 2009-11-22 14:25:18 +00:00
tg e240e62a55 don't tell lies 2009-11-22 14:13:38 +00:00
tg 2094e3f25c since we have wcwidth anyway, expose it as ${%strvar} to the user, iff
utf8-mode is enabled (otherwise it'll be a synonym for ${#strvar} aka
the number of octets in it)
2009-11-21 23:23:20 +00:00
tg 398b5b7a60 fix that as well 2009-11-21 22:32:08 +00:00
tg 6e67920bef improve globbing:
• a=blöd; print ${a%???} → now printf 'b' not 'bl' in UTF-8 mode
• a=hä; print ${a%?} still broken
2009-11-21 22:30:36 +00:00
tg d02e6be6cf bugfix: ${x#?} should expand to nothing not '' if x was unset 2009-11-21 22:29:12 +00:00
tg fe853065bb make print_columns() aware that octets≠characters≠columns 2009-11-09 23:35:11 +00:00
tg 6fcacf577d make tab completing filenames with ':' '=' '$' '`' work as well as
others (colon and equals sign need to be simply escaped, while dollar
sign and accent gravis need double escaping like opening square brak-
ket did back then); add = to C_QUOTE to simplify (doesn't break any-
thing) and sort these strings asciibetically while here
2009-10-30 00:57:39 +00:00
tg dc98ec23a6 do not use PATH_MAX on GNU/Hurd (even if it *was* defined), but use
some glibc-only functions that don’t require its use instead

tested on gnubber, where (admittedly) sysconf(_PC_PATH_MAX) == 1024…
2009-10-27 17:00:02 +00:00
tg ceb591bf6a • better IV for the oaathash-on-binary (as if we prepended a '\x01')
• better variable name for the LCG state
2009-10-18 12:30:06 +00:00
tg eafe88aa74 • overhaul handling of special variables
• use a combination of the one-at-a-time hash and an LCG for handling
  the $RANDOM special if !HAVE_ARC4RANDOM instead of rand(3)/srand(3)
  and get rid of time(3) usage to reduce import footprint
• raise entropy state (mostly in the !HAVE_ARC4RANDOM case though…)
• simplify handling of the $RANDOM_SPECIAL generally
• tweak hash() to save a temp var for non-optimising compilers
• some int → mksh_ari_t and other type fixes
• general tweaking of code and comments
2009-10-17 21:16:05 +00:00
tg 578d4e6314 fix exit-eval-1 (Debian #550717), sync SUSv4 wording, improve comments 2009-10-15 16:36:27 +00:00
tg c7a8b367f8 remove regression-44 in favour of utilities-getopts-1 (the former checked
the AT&T ksh88 behaviour, the latter the AT&T ksh93 behaviour, which dif-
fer from each other, on the very same thing with the exact same test)
2009-10-15 16:32:23 +00:00
tg 0d1ef736c7 modify the oksh-varfunction regression test to reflect that, indeed, a
change of a variable inside a Bourne style POSIX function will affect
the current execution environment of the function caller (to be consi-
stent with exec-function-environment-1)
2009-10-15 16:24:49 +00:00
tg 7b8f207cc9 new exec-function-environment-1 replacing exec-simple-1 from posh, after
reading SUSv4 throughoutly
cf. Message-ID: <Pine.BSM.4.64L.0910151542460.4645@herc.mirbsd.org>
2009-10-15 16:15:03 +00:00
tg ce7359ffc5 posh’s utilities-echo-2 is actually incorrect; reason here
cf. Message-ID: <Pine.BSM.4.64L.0910151525270.4645@herc.mirbsd.org>
2009-10-15 15:32:34 +00:00
tg a9ca7a04c8 add two regression tests from Debian posh, adjusted to pass with ksh93 2009-10-15 15:23:41 +00:00
tg 25516ac756 another exit code in substitution questionable thing
split this one by set ±o sh
2009-10-15 14:58:51 +00:00
tg 84f8d3191a make some of these tests more posh-friendly 2009-10-15 14:12:46 +00:00
tg 620b4446d7 make exit-eval-1 an expected-fail for now, until we can fix this 2009-10-15 12:50:11 +00:00
tg b694bde402 rename regression-56 into exit-eval-1 and change expected output
from what AT&T ksh88 does to what AT&T ksh93 does and POSuX expects

Reported by Clint Adams as Debian #550717, to be fixed...
2009-10-14 18:06:57 +00:00
tg 888c7befea group exit-related tests 2009-10-14 18:04:52 +00:00
tg 549888a183 while testing haserl-0.9.26 on MirBSD, I discovered that the echo builtin
in FSH mode did in fact, contrary to POSIX and Debian Policy 10.4 behavi-
our (I think), interpret escape sequences; fix and add testsuite for echo
2009-10-10 21:17:31 +00:00
tg b4a32ff5f7 cygwin seems to force a+x for files beginning with ':\n' so prepend
a nop newline to make mksh.exe pass this test
2009-10-10 17:39:48 +00:00
tg 73147a7fe9 fix lazy evaluation of assignments in ternary ops 2009-10-04 13:19:33 +00:00
tg 5f58261287 fix long-standing parenthesēs problem: ((foo) || bar) is now parsed corr. 2009-10-04 12:45:23 +00:00
tg c2e5737fca fix dollar quotes in here strings and here documents (regression) 2009-10-04 12:44:19 +00:00
tg 40d11a2066 on the other hand, this is a regression in mksh, apparently 2009-10-04 03:13:06 +00:00
tg 33b9f8b666 * rename "set -o posix" (FPOSIX) to "set -o sh" (FSH) because it's not
just a "somewhat more POSIX" but also a "/bin/sh legacy kludge" mode
* consistently capitalise POSIX and SUSv3/SUSv4 (same as AT&T ksh) and
  Bourne shell
2009-10-02 18:08:37 +00:00
tg 2ea131ab1f make another Debian posh bug into a regression test (expected-fail) 2009-10-02 17:05:01 +00:00
tg c0589fd329 fix typos, From: Clint Adams <schizo@debian.org> 2009-10-02 16:59:53 +00:00
tg ff8b75f46f SUSv4 says that there be exit 127; the old code tried but failed, so it
was an actual programmatical bug…
2009-09-29 12:28:13 +00:00
tg a59d14b565 further optimise and simplify the handling of $RANDOM, reads and writes
to it are now either arc4random or rand/srand, but srand retains the old
state; set +o arc4random is no longer possible, but if it's there we use
arc4random(3), if not, we use rand(3) for $RANDOM reads; optimise special
variable handling too and fix a few consts and other minor things
2009-09-26 03:40:03 +00:00
tg 1dfb13b603 change undef/def MKSH_NOVI into 0/1 MKSH_S_NOVI flag (with more to come:
MKSH_S_EDIT for small (Emacs) editing mode, MKSH_S_FEAT for all the dis-
abled language features), which can be set to 0 despite MKSH_SMALL being
defined to re-enable the Vi command line editing mode (which I wouldn't,
but fits into the general mastermind scheme)
2009-09-24 17:15:33 +00:00
tg 1a28786229 * shrink MKSH_SMALL even further by removing functionality like
some GNU bash extensions (suggested by cnuke@) and bind macros
* make the random cache more efficient (and the code potentially
  smaller, although we have a new implementation of the oaat hash
  function, alongside the old one, now) and pushb only if needed
  (i.e. state has changed or user has set $RANDOM, but not onfork)
2009-09-23 18:04:58 +00:00
tg 1ea1096a4e Add a hack input function for VT100-style key sequences; support
Ctrl-CurLeft and Ctrl-CurRight (not quite ANSI, but fits the scheme)
2009-09-20 17:23:52 +00:00
tg 9fd4b9db41 $'…' functionality, documentation improvements, fixes for backslash
expansion in all modes, regression tests for both kinds of backslash
expansion; unbksl() revamp; make CTRL macro available globally
2009-09-19 21:54:46 +00:00
tg 7806fe510a allow “function stop () {” (bashism, an evil one) 2009-09-19 18:36:59 +00:00
tg 3639137e48 another ksh93 feature: test -o ?foo (almost zero cost) 2009-09-07 17:24:49 +00:00
tg 9dd98da40d Support Dave Korn’s alternative 「'a'」 (or 「'…'」) form for base-one
integers in addition to my 「1#a」 (or 「1#…」), which also allows for
finer end-of-character checking. Note that this is locale-dependent in
ksh93, set ±U dependent in mksh, and mksh’s OPTU-16 encoding is used.
2009-09-06 17:55:55 +00:00
tg 9531e12b36 merge the nameref code, using mksh standard scoping as discussed 2009-09-06 17:42:15 +00:00
tg 4a4be7d313 add the chdir builtin from mircvs://contrib/hosted/tg/deb/mksh/ for
better dash compatibility (mksh is now a dash superset if printf is
compiled in)
2009-08-30 21:02:01 +00:00