117 Commits

Author SHA1 Message Date
KO Myung-Hun
a2e965cad3 Merge remote-tracking branch 'mksh/master'
Conflicts:
    Makefile
    edit.c
    eval.c
    exec.c
    main.c
    misc.c
    sh.h
    var.c
2016-11-12 13:22:58 +09:00
tg
5ee8ba10b3 fix lazy evaluation with side effects; spotted by ormaaj via IRC 2016-11-07 16:58:48 +00:00
tg
a838564cec Unicode 9.0.0 (code and data part; FixedMisc font tbd) 2016-09-01 12:55:21 +00:00
KO Myung-Hun
d4be6d4358 Merge tag 'mksh-R53' into HEAD
Conflicts:
    exec.c
2016-08-13 15:05:49 +09:00
tg
92370ec355 shave off 12 bytes (with fixed gcc) by making the definitions more legible
(and dropping struct padding, tbh)
2016-07-27 00:55:27 +00:00
tg
2364bb5f22 use ^< and ^> for ROL and ROR in R53, schedule >>> as SAR for R54
cf. http://david.tribble.com/text/c0xrot.htm
2016-07-25 20:41:23 +00:00
tg
c3e794c4d0 rework string pooling; disable our own (rely on compiler’s)…
• if HAVE_STRING_POOLING is set to 1
• if HAVE_STRING_POOLING is set to 2 and not GCC < 4 is used
• if HAVE_STRING_POOLING is not set to 0 and LLVM or GCC >= 4 is used

Closes: LP#1580348
2016-07-25 00:04:48 +00:00
KO Myung-Hun
e8966076c8 Merge remote-tracking branch 'mksh/master' 2016-05-06 17:12:52 +09:00
tg
92833fc6ce fix utf_widthadj/utf_skipcols handling for the remaining cases I can spot 2016-05-05 22:56:15 +00:00
tg
152eee2085 handle combining characters at the end of the string correctly 2016-05-05 21:33:46 +00:00
KO Myung-Hun
68f6e899ef Merge tag 'mksh-R52c' 2016-03-05 14:59:34 +09:00
tg
7c93759f66 fix invalid read for ksh93-style base-1 integers
(valgrind; reported by fmunozs via IRC, thanks!)
2016-03-01 18:29:38 +00:00
tg
a3c28ebd67 plug a few display problems with special parameter name expansions
reported by Stéphane Chazelas
2016-02-26 18:48:14 +00:00
KO Myung-Hun
6eb125c18a Merge commit '91ae6ad199035b1cf' 2016-01-24 16:36:38 +09:00
tg
000580ca8f fix buffer overrun (LP#1533394) 2016-01-14 21:17:50 +00:00
KO Myung-Hun
0c41f2fdc8 Merge remote-tracking branch 'mksh/master' 2015-12-13 17:59:43 +09:00
tg
124e6693e9 janitorial work 2015-11-29 17:05:02 +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
bd9de444e3 Merge remote-tracking branch 'mksh/master' 2015-09-12 12:50:57 +09: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
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
tg
f66c194f29 oksh sync RCSIDs only:
• expr.c long done already
• mksh.1 does not apply to us (no character classes)
2014-12-15 23:26:36 +00:00
tg
9eed448a96 Unicode 7.0.0 2014-06-24 19:53:19 +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
2f7eec765d merge oksh’s “ctype cleanups” commit
(not much of it applies since we don’t use the OS’ table-based lookup)
2014-01-05 19:11:46 +00:00
tg
328cbf510c Unicode 6.3.0 2013-11-30 23:20:04 +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
49d1ebfb71 Replace wcwidth code by mine based on Unicode 6.2.0 2013-05-31 23:27:14 +00:00
tg
75a4809a3a fix remaining signed int nonsense I am aware of 2013-04-26 19:10:58 +00:00
tg
1df3efdb86 another intermediate step/commit to get arithmetics right:
do the correct operations for comparisons (just keep using the
signed/unsigned switch from bivui for them), division (by working
on absolutes and adding the sign at the end), modulo (stupidly by
divising in signed, multiplying and subtracting, to get the sign
of the result right)

also adds rotation

XXX to check: do we need to AND before assigning the result in division?
2013-04-14 13:36:53 +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
fb3555d7f5 got an SAR, thanks to dalias on IRC 2013-04-01 02:28:35 +00:00
tg
e1a4c3ed28 do use val.u on the RHS of a shift 2013-04-01 01:29:47 +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
d96c733069 looks like multiplication is also the same between signed and unsigned 2013-04-01 01:02:09 +00:00
tg
6a745a01fa begin using unsigned arithmetics internally as much as possible
(i.e. where signedness doesn’t matter, given -fwrapv) and note
where there’s work to do; note future improvements and additions;
optimise a little

mostly untested
2013-03-31 18:33:13 +00:00
tg
24b81b5969 RCSID-only sync: oksh found out about idivwrapv 2013-03-29 16:54:05 +00:00
tg
12f0ff60d2 prevent more access to invalid memories (Debian #700604) 2013-02-15 18:36:48 +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
0415b74436 Update wcwidth data from Unicode 6.1.0 2012-09-01 23:46:41 +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
dc5ae267ce make tempvar() and vtemp global 2012-06-28 20:02:29 +00:00
tg
9646c98356 I give up on writing (1 << 31) in any form.
Now we just use 0x80000000UL and cast that to mksh_uari_t and,
if required, that to mksh_ari_t afterwards.
2012-03-31 17:52:33 +00:00
tg
e67b98e21b use _setjmp/_longjmp on NeXTstep: its Intel port always restores the signal mask on siglongjmp, which we never have 2012-03-31 17:30:00 +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
7ec1ae3771 followup for cid 1004EE408E1382C1752 and 1004EE40DDD498FBB0D:
do a mirtoconf run-time check (ugh) to see whether the CPU designers
smoked/were brain-dead or if we don’t actually need the manual check
2011-12-31 02:04:18 +00:00
tg
5070ea2387 skip R/O check in an unevaluated ternary part; 10x jilles 2011-12-16 20:03:02 +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