Commit Graph

111 Commits

Author SHA1 Message Date
tg 5c72925bf3 add EBCDIC primer and attribution for iSKUNK 2017-05-05 22:45:58 +00:00
tg 01b0c107b5 we absolutely require unambiguous mapping between EBCDIC and extended ASCII
to be able to provide a global stronly monotonous order for comparisons and
bracket expression ranges
2017-05-03 21:50:33 +00:00
tg efa4d0d2cf ensure NUL in ASCII and EBCDIC both always occurs ordinal 0 2017-05-03 17:51:06 +00:00
tg cb4bac0615 keep ksh_ctypes[] array keys in EBCDIC
we set $IFS massively less often than use ctype()
2017-04-28 11:31:53 +00:00
tg 7ff7821d6a fill the map backwards (to use first occurrence of duplicates);
add a cache to ensure basic ASCII mapping is bijective
2017-04-28 11:27:58 +00:00
tg 5743c00a5b add -DMKSH_FAUX_EBCDIC to test the codepaths better
waking up to: Lanfear - Just Another Broken Shell
2017-04-28 11:13:49 +00:00
tg 5c2a0a1efc fix C array arithmetics 2017-04-28 04:13:19 +00:00
tg dba2efa290 oops, ctypes are indexed by ASCII value even on EBCDIC systems 2017-04-28 03:51:14 +00:00
tg 2482c8b73d fill two complete round-trip maps EBCDIC <-> ASCII 2017-04-28 02:40:26 +00:00
tg d658ad626b commit the EBCDIC run-time table conversion code, so it can be reviewed
XXX there’s still the issue of compile-time character conversion, and
XXX that runtime m̲u̲s̲t̲ use a compatible codepage, which we cannot check,
XXX and that we need the POSIX portable character set mapped, which we
XXX decide to not check (due to the above, mostly)
2017-04-28 01:15:51 +00:00
tg 2231ff566d commit the optimisation result from the new fast character classes 2017-04-28 00:38:33 +00:00
tg 9db3cb57b9 allow : and [ in alias names (but forbid [[ explicitly)
to make 'enable' completely work again
2017-04-27 23:33:22 +00:00
tg 13e91621ca fixup the remaining issues and last optimisations 2017-04-27 23:12:49 +00:00
tg 1080008a8f eliminate legacy macros 2017-04-27 19:33:53 +00:00
tg b228c59895 convert to the new fast character classes 2017-04-27 19:16:10 +00:00
tg 3dff460cde prepare the new fast character classes, not live yet: need sanity check
unfortunately we need at least 21 or so, maybe 19, classes, so sizing
things down to short is not possible; we can splurge with 32 bit thus
2017-04-22 00:07:10 +00:00
tg 1513145b0e ok, you’ve got a point there 2017-04-12 17:08:49 +00:00
tg 30cae62468 (very few) fixes and a couple of workarounds for Coverity 2017-04-12 16:46:23 +00:00
tg 718d397fff merge mksh-os2 by KO Myung-Hun <komh@chollian.net> from https://github.com/komh/mksh-os2 2017-04-02 15:00:45 +00:00
mirabilos a6619d1ef2 use new MKSH_WITH_TEXTMODE for several of the #ifdefs 2017-04-02 16:41:01 +02:00
KO Myung-Hun 20dbf6b45b Read in text mode in a needed place only
Converting CR+LF to LF in blocking_read() which is a underlying read
function, may affect to the functions which do not perform line-based
operation.

    modified:   funcs.c
    modified:   main.c
    modified:   misc.c
    modified:   os2.c
    modified:   shf.c
2016-12-19 08:27:06 +09:00
tg c3e794c4d0 rework string pooling; disable our own (rely on compiler’s)…
• if HAVE_STRING_POOLING is set to 1
• if HAVE_STRING_POOLING is set to 2 and not GCC < 4 is used
• if HAVE_STRING_POOLING is not set to 0 and LLVM or GCC >= 4 is used

Closes: LP#1580348
2016-07-25 00:04:48 +00:00
tg 5401a55a98 optimise away code for a case that’s almost unlikely to happen; fix pasto(?) 2016-07-24 23:07:19 +00:00
tg 9ab9ee194c fix shf.c-internal buffer overread on printing digits,
introduced by the utf_skipcols()-related fixes, more
specifically the check for combining multibyte characters
past end of given width (bogus mixed-up semantics we have here)
by reïntroducing the NUL byte from commitid 1005474EE1E4024A4E4
2016-05-17 15:36:35 +00:00
tg 92833fc6ce fix utf_widthadj/utf_skipcols handling for the remaining cases I can spot 2016-05-05 22:56:15 +00:00
tg 370b3e6008 fix trailing combining characters in all shf functions 2016-05-05 21:38:12 +00:00
tg 2e74da0953 fix potential off-by-one 2016-05-05 21:29:24 +00:00
tg cb0604767f address latest Debian gcc-snapshot’s warnings (some actual bugs!) 2016-03-04 14:26:16 +00:00
tg 54e31ce562 plug EEXIST 2015-12-31 20:38:59 +00:00
tg e32f7d933b clean up ifdefs; some errnos are mandatory anyway; add one of those 2015-10-09 15:38:36 +00:00
tg 4adcfe8b58 oksh sync, simplify *all* if(x)free(x); constructs, simplify x_push() and sync boilerplate while here 2015-09-05 19:19:12 +00:00
tg 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 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 b94b2e363a stop (ab)using the OS symbolic constant EOF, always use -1; plus misc fixes 2015-02-06 10:09:07 +00:00
tg 371ee4af07 kill a Clang 3.2 scan-build workaround (completely; tested by valgrind and
gcc-snapshot’s sanitisers to never be a problem)
2014-11-25 21:01:14 +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 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 d16705415a -Wunused-macros 2013-06-01 20:34:01 +00:00
tg d8ce0c480b *** empty log message *** 2013-04-26 19:49:07 +00:00
tg fa0d9fc499 rcsid-only sync with oksh, dropping this functionality:
• mail.c was removed anyway
• we do not use “long long” in mksh, since it’s not in ANSI C89

instead, we probably need some 64-bit ops in the long run, but we can
use some host types (might want to use time_t for tv_sec, but we cannot
print that yet); might need to handle them in some generic manner…
2013-04-26 17:39:30 +00:00
tg 5c2f250abc make "%#s" into print_value_quoted (ignoring field width and precision), if you can get it around gcc’s __printf__ __format__ attribute that is… 2013-03-30 15:39:16 +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 192ea7638b now that we found out the root case for the recent QNX problem…
03:11⎜«RT|AO:#!/bin/mksh» YES it WORKS now!
… there’s no reason for sys_nerr to not be const, either ☺
2012-12-28 03:20:35 +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 12c662b6e2 thanks to ISC (Interactive) Unix, we now know a few samples of errnos
that get used, plus one for the realpath-1 regression test; also make
sys_siglist_decl detection nicer and poison strerror() with non-const
return value ifdef DEBUG, make it always const
2012-12-17 23:18:11 +00:00
tg ae1ec32dbc fix whitespace; ACK RT’s Minix-vmd stmts 2012-12-17 22:57:50 +00:00
tg 4c5d7094ef RT also said what was missing on SunOS 4.1.1 (it also needs -DMKSH_UNEMPLOYED?) 2012-12-17 22:14:27 +00:00
tg 0780070d24 add a few assertions for LLVM+Clang 3.2 scan-build; no !DEBUG changes 2012-12-08 18:30:31 +00:00
tg f654a3dea4 fix libFirm/cparser -Wsign-compare 2012-12-05 19:38:25 +00:00
tg 9d2fefeac4 Be more careful with string array bounds! Found by LLVM+Clang scan-build. 2012-12-04 01:11:17 +00:00