Commit Graph

912 Commits

Author SHA1 Message Date
KO Myung-Hun 6eb125c18a Merge commit '91ae6ad199035b1cf' 2016-01-24 16:36:38 +09:00
tg 7c58621bc7 so, GCC is a real bitch 2016-01-21 19:58:13 +00:00
tg 27179454a9 hotfix for newer GCC 2016-01-21 19:38:09 +00:00
tg 188691d285 save 200 bytes off .text by revisiting string pooling
also, forgotten version bump
2016-01-21 18:24:45 +00:00
tg 61f7661b92 fix errno in print/echo builtin; optimise (with partial rewrite) 2016-01-20 21:34:13 +00:00
tg 046d8e5b7a align with future POSIX on http://austingroupbugs.net/view.php?id=351
with accepted interpretation (*sigh*); merge VARASN|ARRAYVAR→CMDASN
2016-01-19 23:12:15 +00:00
tg c51e067e62 incorporate more feedback from schily 2016-01-14 23:18:11 +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 2492c5692b incorporate suggestions by J�rg Schilling 2016-01-13 17:20:52 +00:00
tg 4059e105a2 fstat(2) after open(2) for set -C case when initial stat(2) was !S_ISREG
to fix race condition as suggested by jilles
2015-12-31 21:03:47 +00:00
KO Myung-Hun 0c41f2fdc8 Merge remote-tracking branch 'mksh/master' 2015-12-13 17:59:43 +09:00
tg b2b0c0bbb6 update for recent changes 2015-12-12 22:25:15 +00:00
KO Myung-Hun 788fdcd188 Merge remote-tracking branch 'mksh/master' 2015-10-26 11:24:15 +09:00
tg 1a4f644d6e save ~1½K from the bootfloppy by reusing MirBSD libkern wcwidth(3)
but don’t bother for this for the regular /bin/mksh either
to keep the generic code path tested well
2015-10-24 19:45:23 +00:00
KO Myung-Hun 780f220e23 Merge remote-tracking branch 'mksh/master'
Conflicts:
    check.t
    exec.c
    sh.h
2015-10-11 19:42:38 +09:00
tg cef386fb60 make “source” into a built-in command (keepasn, to match ksh93 and “dot”);
remove the “stop” alias and drop old Android and OS/2 hacks and auto-unalias
2015-10-09 21:36:59 +00:00
tg fc48729336 tweak some iop/conservative_fds-related things I picked up while thinking lksh 2015-10-09 19:29:50 +00:00
tg af35e9a6de revert most of commitid 3ec342c92b3a8874 and fixup the rest;
this should bring us closer to POSIX again
2015-10-09 17:48:53 +00:00
tg 3fc8b5eb94 partial oksh sync, up to commit 80be547da108d5c241ae068290ca3e331446aa41? 2015-10-09 16:11:19 +00:00
tg eb9050b8f8 stop using issetugid(2) for ±p check as it’s probably not the right tool 2015-10-05 17:59:00 +00:00
KO Myung-Hun bd9de444e3 Merge remote-tracking branch 'mksh/master' 2015-09-12 12:50:57 +09:00
tg ed5cb56849 replace the code related to << changes and <<< with cleaner code,
fixing a few bugs also (including new testcases, except x=<< issue)
2015-09-06 19:47:01 +00:00
tg edc2acd61d fix tree printing multiple heredocs in one command, bug found by izabera 2015-09-05 20:20:48 +00:00
tg 4adcfe8b58 oksh sync, simplify *all* if(x)free(x); constructs, simplify x_push() and sync boilerplate while here 2015-09-05 19:19:12 +00:00
KO Myung-Hun df20ee1fff Merge remote-tracking branch 'mksh/master'
Conflicts:
	check.t
	main.c
2015-08-15 23:45:52 +09:00
tg 1b8b792b7e quote path separator if ; in some cases; pointed out by komh 2015-08-13 22:06:23 +00:00
tg c674e71377 be more careful with signals and errorlevels; bounds-check them better;
don’t trust the OS as POSuX comes up with more-than-8-bit exit codes now;
also, one more int → bool
2015-08-13 21:38:19 +00:00
KO Myung-Hun 4c61aeebe5 Use upstream style macro/function names
modified:   edit.c
    modified:   eval.c
    modified:   exec.c
    modified:   main.c
    modified:   misc.c
    modified:   sh.h
2015-07-21 16:30:47 +09:00
KO Myung-Hun 834349f3be Merge remote-tracking branch 'mksh/master'
Conflicts:
	Build.sh
	check.pl
	check.t
	edit.c
	emacsfn.h
	exec.c
	funcs.c
	main.c
	misc.c
	sh.h
	var.c
2015-07-21 16:30:46 +09: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 edf76ec8e6 harden the crlf vs lf tests even more; use binary mode explicitly on OS/2 2015-07-09 20:52:43 +00:00
tg dcd8b6389b apply the new cat hack to printf, too, to prefer it over the builtin 2015-07-09 20:20:45 +00:00
tg 950827394b more easy OS/2 fixes
From: KO Myung-Hun <komh@chollian.net>
2015-07-09 19:46:43 +00:00
tg 041666eefb a few more mksh-os2 inspired fixes 2015-07-09 19:28:21 +00:00
KO Myung-Hun 65d8ad9dae Merge remote-tracking branch 'mksh/master' 2015-07-08 19:31:55 +09:00
tg f463d9da76 • revert the cat hack for realpath and rename
‣ I was convinced by several that more magic is never the solution
• fix a comment: function cat already had precedence
• change cat loader to look for existence, FPATH included, before
  ditching the builtin; note that in manpage
2015-07-06 17:48:37 +00:00
tg e0196f47d5 implement completely new multiline code by delaying history store
this commit is valgrind-tested
2015-07-05 19:37:18 +00:00
tg 62e27c3e07 simplify print_columns func argument: no need to return the first arg any more 2015-07-05 14:43:08 +00:00
tg 7a1acedd4a bump; nothing to merge from oksh, and nothing more from me today 2015-06-28 16:23:24 +00:00
KO Myung-Hun 645b537439 Support BEGINLIBPATH, ENDLIBPATH and LIBPATHSTRICT on OS/2 2015-06-03 13:00:50 +09:00
KO Myung-Hun 89324074c4 Prepend /@unixroot to rooted paths on OS/2
$UNIXROOT is a root directory of FHS on OS/2. /@unixroot is replaced by
$UNIXROOT at runtime.
2015-06-03 13:00:49 +09:00
KO Myung-Hun 07e5cadc54 Support a response file on OS/2 2015-06-03 13:00:43 +09:00
KO Myung-Hun 759b6ec59f Consider OS/2-style path
OS/2 uses 'x:' as a drive prefix and '\' as a directory separator.
2015-06-03 13:00:43 +09:00
KO Myung-Hun a03cf65602 Consider executable extensions in case of some test commands on OS/2
-r, -w, -x, -a, -e, -f.
2015-06-03 13:00:42 +09:00
KO Myung-Hun 5127457319 Read in text mode, write in binary mode on OS/2
This enables to convert CR+LF to LF when reading, but disables to
convert LF to CR+LF when writing.

Instead, however, CR+LF are not passed into mksh as is.
2015-06-03 13:00:41 +09:00
KO Myung-Hun 5ed2481df2 Try to append executable suffixes if not having extension on OS/2 2015-06-03 13:00:40 +09:00
KO Myung-Hun 8f633da789 Path separator is ; on OS/2 2015-06-03 13:00:40 +09:00
KO Myung-Hun aeeabefbe5 Do not define getrusage() stuffs on OS/2 kLIBC
OS/2 kLIBC has only a declaration of getrusage() without implementation.
Due to this, definition of getrusage() stuffs causes compilation to fail.

-----
In file included from lalloc.c:21:
sh.h:379: error: conflicting types for `getrusage'
f:/lang/gcc/usr/include/sys/resource.h:168: error: previous declaration of `getrusage'
-----
2015-06-03 13:00:39 +09:00
tg babd9c4cf0 The check for empty patterns and patterns matching the empty string
in commitid 1004D8283F068C41C3C was bogus; it fixed Jb_boin’s issue
but izabers’s 「var=foo; echo "${var/*/x}"」 was broken; in fact we
only want to not do the looping for // if the pattern matches much.

Also, fix a spelling mistake in the manpage and change some wording
to also work with associative arrays (in the future; no change).
2015-05-23 17:43:22 +00:00
tg 93ccb42114 overhaul the signal handling:
• support NSIG_MAX from http://austingroupbugs.net/view.php?id=741
  and make a TODO for later to use sysconf(_SC_NSIG) at runtime
• bounds-check signals (e.g. no smaller than 1, but smaller than NSIG)
• align trap errorlevel with other shells
• make trap match what’s in POSIX and fixup the manpage
• refactor some code related to signals
• hide from kill builtin both EXIT and ERR pseudo-signals
2015-04-29 20:44:37 +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 3eb806b72b inline only user of ksh_min, make it more cool; drop ksh_min, ksh_max;
move ksh_isdigit etc. to ksh_isalpha etc. definitions
2015-04-29 19:11:57 +00:00
tg 2cb0ea982a EBCDIC helpers and OS/390 signals 2015-04-29 18:38:54 +00:00
tg c9ccf0bab7 MFC remaining fixes; tested locally a lot, plus remotely with
GNU C11 (Debian 20150413-1) version 5.0.1 20150413 (prerelease) [gcc-5-branch revision 222050] (x86_64-linux-gnu)
including ASan (testsuite) and Valgrind (short)
2015-04-19 19:18:07 +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 cad9bc86d3 Implement the “FKSH functions have local scope for shell options” feature
for mksh but not lksh; bump to R51-alpha.

While here, tweak build scripts a bit, fixup MirBSD-specific Makefile
things, remove part of a comment that’s uninteresting.
2015-04-11 23:28:21 +00:00
tg e1cda74d04 SECURITY: fix integer overflows related to file descriptor parsing
bug initially found by Pawel Wylecial (LP#1440685)
additional bug found and suggested fix by enh (elliott hughes)

This commit also renames struct ioword.flag to ioflag to disambiguate
it from other members named “flag”, changes it to an unsigned type,
and packs ioflag and unit into shorts each, to make the struct smaller
(aligned even: 16 bytes on 32-bit systems) and reviews some of the
code involved in fd handling, though there wasn’t much to be found.
2015-04-11 22:03:32 +00:00
tg 07898d8a45 only lksh now implies unalias for a POSIX function definition (used e.g. in Debian sysvinit scripts that use a “stop” function) 2015-03-20 23:37:55 +00:00
tg 2097d45f7f oksh rcsid-only sync, plus bonus rewrite of strip_nuls
(uses size_t ipv int for buffer size now, and no extra
calls to memchr/memmove, input is typically small)
2015-03-20 21:46:41 +00:00
tg 0d72355038 “local x=$1” is supposed to not field-split and so 2015-03-14 05:23:18 +00:00
tg 96d9e5d1f1 remove unused CMDWORD 2015-03-14 04:37:55 +00:00
tg 8f53c68265 • protect POSIX builtins and utilities from aliases, e.g:
‣ : → \:
  ‣ alias → \alias
    ⇒ except in some internally used cases, where we use \builtin alias
  ‣ command . → \command .
• protect Korn Shell builtins from aliases and functions, e.g:
  ‣ typeset → \builtin typeset
    ⇒ also unravels the “local” alias used
  ‣ print → \builtin print
• protect internally-used things from aliases
  ‣ “let]” is not a valid function name
  ‣ “set” is POSIX so we don’t expect anyone to override it in a function
• use “command -v” instead of “whence -p” (“which”) in most
  places; thanks izabera from #ed on IRC for pointing out
  that “command -v” is POSIX – except, “whence -p” a̲l̲w̲a̲y̲s̲ looks
  for an executable and shows its full pathname; “command -v”
  also resolves to aliases, functions and builtins, so only use
  it where it makes any sense (both never output to stderr)
• make most of dot.mkshrc work in the face of such aliases
  ‣ “ulimit -c” is used; this is not POSIX, and not portable;
    maybe we should make ulimit accept-and-ignore the most
    common limits even if the OS doesn’t use them?
• update list of builtin aliases in the manpage
2015-03-08 22:54:36 +00:00
tg fcc59eee48 remove some unused string pooling stuff 2015-03-08 21:30:22 +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 707add559f keep “set -x” disabled during PS4 expansion, to avoid infinite looping 2015-03-01 15:23:05 +00:00
tg f4ae6f7508 can't set word=IFS_QUOTE if already IFS_WORD (something there)
or IFS_QUOTE (third dquote (second OQUOTE) in """something)
2015-02-20 07:14:30 +00:00
tg 73082b9292 • fixup here document expansion (regression wrt. pdksh 5.2.14)
• adjust testsuite (and write tons of new tests) after today’s commits
2015-02-19 22:26:50 +00:00
tg 4157cca352 oksh sync; unsure if it applies (with us using old_source and all) but
better be safe than sorry; it at least passes our testsuite

NOTE: people who can figure out how afl can be used for mksh welcome! ;-)
2015-02-13 12:51:33 +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 934929c2ee rcsid sync from obsd; misc sync; small improvements
• mksh testsuite no longer uses printf, again
• use MAXPATHLEN from <sys/param.h> as PATH_MAX fallback
2015-01-25 15:23:43 +00:00
tg e49d7bc3c6 better 2015-01-04 21:08:10 +00:00
tg 51c370459e bump version and, also, year… I hate this… 2014 is gonna follow us for a while… 2015-01-02 13:21:28 +00:00
tg dcdc828c41 fix here string parsing problem found by Stéphane Chazelas 2014-12-15 22:50:11 +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 517bd63fe5 rename the “tilde” function; apparently, some system headers define it 2014-11-19 21:49:12 +00:00
tg 9b31399aec fix buffer overflow found by zacts from IRC (bad length calculation)
now zsh and mksh are even… :|
2014-11-19 18:44:11 +00:00
tg 8d9d86ceab mark two ($@/$* expansion-related) testcases as expected-fail, with more to come ☹ 2014-11-14 20:21:29 +00:00
tg 44dc99cb35 first cut at LP#1381993 (probably incomplete) plus test coverage
also remove fbsd testsuite link, it’s gone during cvs→svn of theirs ☹
2014-10-19 21:53:08 +00:00
tg 2fd0482761 commit patch from LP#1381965 and two testcases, one showing this is fixed,
another showing deeper problems (probably LP#1381993 “non-list contexts” or
the IFS_WS/IFS_IWS story, perhaps *all* IFS_WS (not just ternaries) really
should be IFS_IWS instead?)
2014-10-19 20:56:33 +00:00
tg 996e05548a POSIX says “command” loses SPEC_BI and means it too
reported by ormaaj, who even asked on the austin ML
http://thread.gmane.org/gmane.comp.standards.posix.austin.general/9907/focus=9931
clarified by jilles; also make errorlevels match ksh93
2014-10-12 21:58:53 +00:00
tg 4afe543fa0 fix x+=<< 2014-10-12 19:55:01 +00:00
tg 0cf0658a0d fix severe regression in field splitting (LP#1378208) 2014-10-07 15:22:17 +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 968dc7a764 overhaul IFS handling, fix bugs reported by Stephane Chazelas and mikeserv
now we’re at: 486 passed testsuite items, 0 failed
ifs.sh still: # tests 6856 passed 6856 failed 0
2014-10-03 17:32:12 +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 097ed42c83 https://android-review.googlesource.com/102253
• permit interrupts during a write(2) loop in the cat builtin, too,
  not just in the read(2) loop – fixes inability to kill a clogged
  output cat

• kill the cat when smores finish

TODO: revisit this ⓐ in more depth, ⓑ for other functions, such as
      “hd”, and ⓒ test on AOSP as well
2014-07-28 21:45:45 +00:00
tg 0eb5044ac6 fix rare infinite loop when invalid UTF-8 is in the edit buffer
From: Ivan “Colona” Delalande <colona@ycc.fr>
2014-07-13 11:34:29 +00:00
tg e4c01375aa fix access-after-free crash spotted by Enjolras via IRC, thanks! 2014-06-29 11:28:28 +00:00
tg d2ef1d5d2c bump 2014-06-24 20:47:47 +00:00
tg edc80f317c remove old/unused stuff 2014-06-24 18:51:37 +00:00
tg 73edeaa8ec fix “set -o pipefail” w/o PIPESTATUS, and PIPESTATUS inside COMSUBs and other sequences 2014-06-10 22:17:10 +00:00
tg 7330970bfa fix some of the signal stuff (still didn’t get rid of awk(1) and printf(1)
calls in Build.sh, we need HOSTCC for that… which we should do, using BER
or something encoded for integers, and pregenerated hashtables as planned)

also, bump to R50 beta, due to today’s language changes
2014-06-09 13:25:53 +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 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 c1c0b997fe make the code to exec simple commands also available for mksh_small 2014-01-11 16:26:28 +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 328cbf510c Unicode 6.3.0 2013-11-30 23:20:04 +00:00
tg 6217904193 detect getsid(2), also spotted by RT, this on MSYS 2013-11-30 17:41:35 +00:00
tg c4c4fd7365 RCSID-only oksh sync (their whitespace changes don’t apply to us)
note that emacs.c partial peereboom rewrite is *not* merged, and kept that way
2013-11-30 17:33:51 +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 73c5ad3e3f apply patch by Steffen Daode Nurpmeso to drop ISTRIP termios mode 2013-11-17 22:23:29 +00:00
tg be9bd4c543 static option creating for cmdline and set, too
(in preparation of doing something real with set ±p)
2013-11-17 22:22:56 +00:00
tg cf40c01b45 adapt most __attribute__((…)) occurrences to new KNF style(9) 2013-10-31 20:05:39 +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 b46001ad4a fix another clobbered-by-setjmp/longjmp warning 2013-07-24 18:03:57 +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 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 49d1ebfb71 Replace wcwidth code by mine based on Unicode 6.2.0 2013-05-31 23:27:14 +00:00
tg a072c63fe8 declare thiswillneverbedefinedIhope to silence some configure time warnings 2013-05-08 11:16:19 +00:00
tg 1d0409d932 implement VALSUBs 2013-05-02 21:59:54 +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 55e9ca460c start next development iteration 2013-04-27 18:12:39 +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 79a083baaa kill dead code 2013-04-26 18:27:07 +00:00
tg d515447e0e work around a workaround in dietlibc that works around brokenness in GNU tar
/* no comment… */
2013-04-26 17:23:15 +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 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 d99e470a64 bump 2013-03-05 15:41:41 +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 85d7059c48 … I fsck’d up and built R42b from MAIN ipv mksh-R42stable… oh well.
TODO: convert enum to something like uint8_t to save even more space
2013-02-16 00:21:57 +00:00
tg ec883318d1 fix too strict fix for LP#1104543 (Debian #700526) 2013-02-15 18:50:14 +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 f209a252bc when leak debugging, free everything even in builtins 2013-02-10 21:17:07 +00:00
tg 59009ac78f call it DEBUG_LEAKS so Android can always enable it 2013-02-10 17:41:06 +00:00
tg 63b6d920a8 actually, only needed #ifdef DEBUG 2013-02-10 17:39:38 +00:00
tg cb93db360d call afreeall(AEDIT) upon close; related to LP#1106116 2013-02-10 17:38:15 +00:00
tg 1da94d6159 pure RCSID sync with oksh, who also added a tabcompletion fix now, with
less code, but, even according to their own comments, not as good as ours
2013-02-10 17:18:49 +00:00