alioth/wtf-mksh.git
2 years agofix typo in comment
tg [Mon, 20 Nov 2017 02:32:32 +0000 (02:32 +0000)]
fix typo in comment

2 years agorefresh with up-to-date eawparse
tg [Sat, 18 Nov 2017 12:01:53 +0000 (12:01 +0000)]
refresh with up-to-date eawparse

thankfully, this is now all in glibc master, too
(thanks Mike FABIAN)

3 years agotentatively fix Debian #878947 by putting an end to (some) nesting
tg [Tue, 17 Oct 2017 23:45:19 +0000 (23:45 +0000)]
tentatively fix Debian #878947 by putting an end to (some) nesting

‣ also makes the error message nicer:
tg@blau:/usr/obj/bin/mksh $ mksh -n -c '${0$(($(o[))&$(($(p[))&)'
internal error: can't allocate 8388628 data bytes
tg@blau:/usr/obj/bin/mksh $ mksh -n -c '${0$(($(o[))&$(($(p[))&)^J'
mksh: no closing quote
1|tg@blau:/usr/obj/bin/mksh $ ./mksh -n -c '${0$(($(o[))&$(($(p[))&)'
./mksh: syntax error: unmatched '('
1|tg@blau:/usr/obj/bin/mksh $ ./mksh -n -c '${0$(($(o[))&$(($(p[))&)^J'
./mksh: syntax error: unmatched '('

‣ alternative fix would be to keep the block and do…
- } else {
+ } else if (source->type != SEOF) {
… but that would keep “no closing quote” for the case with newline,
and since this seems to not break… nuking unused code is always good ☻

3 years agoapply another quickfix by komh
tg [Sun, 15 Oct 2017 20:21:51 +0000 (20:21 +0000)]
apply another quickfix by komh

really, getdrvwd should be passed an Xstring (probably with Xinit0 in
the callers), especially as one caller already didn’t update ldestlen
properly… (but not tonight as I’ve really got no head for that left)

3 years agomove getdrvwd() declaration out of OS/2-specific part:
tg [Sat, 14 Oct 2017 21:09:48 +0000 (21:09 +0000)]
move getdrvwd() declaration out of OS/2-specific part:
each MKSH_DOSPATH port is required to define it (and, later, others)

3 years agoadd MKSH_ENVDIR code for Jehanne (OS by Shamar (giacomotesio) from IRC):
tg [Sat, 14 Oct 2017 21:05:22 +0000 (21:05 +0000)]
add MKSH_ENVDIR code for Jehanne (OS by Shamar (giacomotesio) from IRC):
instead of parsing extern char **environ; read it from a filesystem
(typical for Plan 9, though this one is __jehanne__ per ifdef)

tested on MirBSD and found to be working

3 years agofix “cd e:foo” on DOSPATH systems (I think)
tg [Sat, 14 Oct 2017 20:11:30 +0000 (20:11 +0000)]
fix “cd e:foo” on DOSPATH systems (I think)

3 years agomove slashifying of PATH, TMPDIR and two OS/2-specific variables from
tg [Fri, 13 Oct 2017 23:34:49 +0000 (23:34 +0000)]
move slashifying of PATH, TMPDIR and two OS/2-specific variables from
OS/2-specific to common DOSPATH-specific code (ifdef for the latter two)

also gets us rid of the use of getenv

3 years agofix a longstanding double substitution
tg [Fri, 13 Oct 2017 23:02:11 +0000 (23:02 +0000)]
fix a longstanding double substitution

3 years agokomh says these are redundant
tg [Fri, 13 Oct 2017 11:54:06 +0000 (11:54 +0000)]
komh says these are redundant

3 years agoapply fixes from code review by @komh
tg [Thu, 12 Oct 2017 15:17:04 +0000 (15:17 +0000)]
apply fixes from code review by @komh

3 years agonote on rooted pathnames, concept found in original pdksh which had
tg [Wed, 11 Oct 2017 23:48:36 +0000 (23:48 +0000)]
note on rooted pathnames, concept found in original pdksh which had
various forms of path attributes (not just absolute or not), though
we shouldn’t just copy theirs either

3 years agohandle drive-qualified nōn-absolute pathnames in do_realpath(), untested
tg [Wed, 11 Oct 2017 23:23:03 +0000 (23:23 +0000)]
handle drive-qualified nōn-absolute pathnames in do_realpath(), untested

the idea here is that:

- /foo/bar and a:/foo/bar are absolute
- foo/bar is relative
- a:foo/bar needs to be handled specially,
  mostly per making it into an absolute (“a:/” + getcwd(a:) + “foo/bar”)

3 years agomksh_abspath() on OS/2 now requires a dir separator after the drive letter
tg [Wed, 11 Oct 2017 21:52:46 +0000 (21:52 +0000)]
mksh_abspath() on OS/2 now requires a dir separator after the drive letter
and colon for it to recognise a pathname as absolute, as it should be

XXX make_path() unreviewed wrt this change

3 years agofurther OS/2 fixes for simplify_path()
tg [Wed, 11 Oct 2017 21:49:06 +0000 (21:49 +0000)]
further OS/2 fixes for simplify_path()

3 years agoall uses of mksh_vdirsep should exclude “\builtin” from triggering it
tg [Wed, 11 Oct 2017 21:09:24 +0000 (21:09 +0000)]
all uses of mksh_vdirsep should exclude “\builtin” from triggering it

3 years agoupdate comment to unpuzzle a future me
tg [Wed, 11 Oct 2017 21:04:59 +0000 (21:04 +0000)]
update comment to unpuzzle a future me

(I just had to use git annotate and look at the two commits from komh
to figure out that the condition in the if is correct here and what
this is supposed to do)

3 years agoeval.c has the only mksh_sdirsep caller and uses it on substrings,
tg [Wed, 11 Oct 2017 20:55:06 +0000 (20:55 +0000)]
eval.c has the only mksh_sdirsep caller and uses it on substrings,
so OS/2 drive letter checks are not correct there

3 years agoinline OS/2’s mksh_sdirsep() into its mksh_vdirsep()
tg [Wed, 11 Oct 2017 20:50:46 +0000 (20:50 +0000)]
inline OS/2’s mksh_sdirsep() into its mksh_vdirsep()
because we must separate these two

3 years agokeep drive letter when simplifying path (untested)
tg [Wed, 11 Oct 2017 20:46:14 +0000 (20:46 +0000)]
keep drive letter when simplifying path (untested)

3 years agointroduce mksh_drvltr(s) short-hand macro
tg [Wed, 11 Oct 2017 20:29:05 +0000 (20:29 +0000)]
introduce mksh_drvltr(s) short-hand macro

3 years agoturns out the slash was already added (later), 10x komh
tg [Wed, 11 Oct 2017 19:06:44 +0000 (19:06 +0000)]
turns out the slash was already added (later), 10x komh

3 years agofix part of realpath for drive-qualified DOS paths:
tg [Tue, 10 Oct 2017 21:30:43 +0000 (21:30 +0000)]
fix part of realpath for drive-qualified DOS paths:

if a path or symlink target is drive-qualified, keep the drive letter
(this part from komh) and, if present, a leading (back)slash (from me)

missing: if a drive qualification is *not* followed by a (back)slash,
we must retrieve the per-drive cwd for the target drive and insert it
just like we insert the cwd for (normal/Unix) relative paths; maybe
consider redoing absolute/relative path logic, DOS paths are tristate

komh’s commit: fix realpath failure on OS/2

On OS/2, an absolute path is 'x:/path/to/file'. Because it has not
a leading slash, '/' is prepended, that is, '/x:/path/to/file'. As a
result, it fails to find a requested file.

3 years agoremove redundant OS/2 codes (from komh)
tg [Tue, 10 Oct 2017 21:19:43 +0000 (21:19 +0000)]
remove redundant OS/2 codes (from komh)

os2_init() does it.

3 years agomonkey-patch offsetof for a klibc/dietlibc warning; bump to R56b (bugfixes)
tg [Tue, 29 Aug 2017 13:38:31 +0000 (13:38 +0000)]
monkey-patch offsetof for a klibc/dietlibc warning; bump to R56b (bugfixes)

3 years agoquell a Fink compiler warning; not entirely correct but no harm done either
tg [Mon, 28 Aug 2017 23:27:51 +0000 (23:27 +0000)]
quell a Fink compiler warning; not entirely correct but no harm done either

3 years agounbreak vi mode '0' movement, bug introduced in r1.323
tg [Sun, 27 Aug 2017 23:33:50 +0000 (23:33 +0000)]
unbreak vi mode '0' movement, bug introduced in r1.323
reported by Larry Hynes <larry@larryhynes.com>

3 years agofix documentation bug, thanks panpo and Riviera for spotting
tg [Wed, 16 Aug 2017 21:40:14 +0000 (21:40 +0000)]
fix documentation bug, thanks panpo and Riviera for spotting

3 years agowe have a FAQ now! (well, two of them, different scope though)
tg [Thu, 10 Aug 2017 19:25:12 +0000 (19:25 +0000)]
we have a FAQ now! (well, two of them, different scope though)

3 years agobump
tg [Tue, 8 Aug 2017 21:11:20 +0000 (21:11 +0000)]
bump

3 years agooh wait, actually…
tg [Tue, 8 Aug 2017 21:10:21 +0000 (21:10 +0000)]
oh wait, actually…

• besides the previously-set $EDITOR take [jupp jstar mcedit ed vi]
  as sorted list, first one found wins
• set -eu safe, and in the lksh part

3 years agopromote jupp to default editor if installed, in the customisation section
tg [Tue, 8 Aug 2017 20:52:11 +0000 (20:52 +0000)]
promote jupp to default editor if installed, in the customisation section

3 years agocomment
tg [Tue, 8 Aug 2017 20:50:34 +0000 (20:50 +0000)]
comment

3 years agolet hd_mksh take from stdin, great simplification
tg [Tue, 8 Aug 2017 20:42:16 +0000 (20:42 +0000)]
let hd_mksh take from stdin, great simplification

3 years agomake EBCDIC-safe
tg [Tue, 8 Aug 2017 20:40:25 +0000 (20:40 +0000)]
make EBCDIC-safe

3 years agoperform in chunks, don’t read the entire file into memory ahead
tg [Tue, 8 Aug 2017 20:38:08 +0000 (20:38 +0000)]
perform in chunks, don’t read the entire file into memory ahead

3 years agoalways expone mksh’s hexdumper
tg [Tue, 8 Aug 2017 20:22:16 +0000 (20:22 +0000)]
always expone mksh’s hexdumper

3 years agofix Red Hat BZ#1479320 by making interactive shells remember async PIDs too
tg [Tue, 8 Aug 2017 14:30:10 +0000 (14:30 +0000)]
fix Red Hat BZ#1479320 by making interactive shells remember async PIDs too

3 years agooptimise structure size calculation to take alignment into account
tg [Tue, 8 Aug 2017 14:29:23 +0000 (14:29 +0000)]
optimise structure size calculation to take alignment into account

3 years agogo home Coverity, you’re drunk
tg [Tue, 8 Aug 2017 00:03:56 +0000 (00:03 +0000)]
go home Coverity, you’re drunk

code refactoring to work around it not recognising the correct code path

3 years agoCoverity 1416282
tg [Mon, 7 Aug 2017 23:25:09 +0000 (23:25 +0000)]
Coverity 1416282

3 years agoCoverity 1416283
tg [Mon, 7 Aug 2017 23:23:12 +0000 (23:23 +0000)]
Coverity 1416283

3 years agoCoverity 1416285
tg [Mon, 7 Aug 2017 23:15:47 +0000 (23:15 +0000)]
Coverity 1416285

3 years agofix a GCC 7 pointer target signedness warning
tg [Mon, 7 Aug 2017 21:56:54 +0000 (21:56 +0000)]
fix a GCC 7 pointer target signedness warning

3 years agorelease
tg [Mon, 7 Aug 2017 21:39:26 +0000 (21:39 +0000)]
release

3 years agofixup by regenerating with new eawparse which matches what I submitted to
tg [Mon, 7 Aug 2017 21:38:55 +0000 (21:38 +0000)]
fixup by regenerating with new eawparse which matches what I submitted to
https://sourceware.org/bugzilla/show_bug.cgi?id=21750 even if only FF00
actually changed due to the algorithms in use

3 years agofuck POSIX
tg [Mon, 7 Aug 2017 21:16:32 +0000 (21:16 +0000)]
fuck POSIX

3 years agoturn off UTF-8 mode upon entering POSIX mode, for J�rg
tg [Mon, 7 Aug 2017 20:49:42 +0000 (20:49 +0000)]
turn off UTF-8 mode upon entering POSIX mode, for J�rg

3 years agopart 2: don’t stop using the history if the file has been truncated
tg [Mon, 7 Aug 2017 20:43:00 +0000 (20:43 +0000)]
part 2: don’t stop using the history if the file has been truncated

3 years agoplug part of the history problems until we can do better:
tg [Mon, 7 Aug 2017 20:40:57 +0000 (20:40 +0000)]
plug part of the history problems until we can do better:
do not change the underlying file when truncating; rather,
copy everything back from the tmpfile to histfd while the
latter is locked

3 years agomake readonly idempotent; spotted by selk from Dragora
tg [Wed, 26 Jul 2017 23:02:28 +0000 (23:02 +0000)]
make readonly idempotent; spotted by selk from Dragora

3 years agoUnicode 10.0.0
tg [Sat, 8 Jul 2017 15:11:52 +0000 (15:11 +0000)]
Unicode 10.0.0

3 years agomerge commit b0a2ea76327760a7ecf35172fe525f8aa39320b2 from Harvey-OS:
tg [Mon, 15 May 2017 13:35:38 +0000 (13:35 +0000)]
merge commit b0a2ea76327760a7ecf35172fe525f8aa39320b2 from Harvey-OS:

“Until sigsuspend could work propery”[sic]

3 years agoexclude nōn-HPFS-safe pathname-using test from OS/2 (thanks komh)
tg [Sun, 14 May 2017 19:05:44 +0000 (19:05 +0000)]
exclude nōn-HPFS-safe pathname-using test from OS/2 (thanks komh)
also exclude on cygwin/msys as not FAT/NTFS-safe

3 years agooops, reverted not enough in commitid 1005909EE7C16B07DC3
tg [Fri, 5 May 2017 22:59:36 +0000 (22:59 +0000)]
oops, reverted not enough in commitid 1005909EE7C16B07DC3

3 years agosprinkle tons more ord() around
tg [Fri, 5 May 2017 22:53:32 +0000 (22:53 +0000)]
sprinkle tons more ord() around

this is really not funny… mksh-ng will use even more “unsigned only”

3 years agoadd EBCDIC primer and attribution for iSKUNK
tg [Fri, 5 May 2017 22:45:58 +0000 (22:45 +0000)]
add EBCDIC primer and attribution for iSKUNK

3 years agocatch z/OS not having $Config not filling in the __perlpath env correctly
tg [Fri, 5 May 2017 21:17:31 +0000 (21:17 +0000)]
catch z/OS not having $Config not filling in the __perlpath env correctly

3 years agoswitch EBCDIC to “nega-UTF8”
tg [Fri, 5 May 2017 20:36:03 +0000 (20:36 +0000)]
switch EBCDIC to “nega-UTF8”

3 years agosome more small EBCDIC fixes
tg [Fri, 5 May 2017 19:43:52 +0000 (19:43 +0000)]
some more small EBCDIC fixes

3 years agowe absolutely require unambiguous mapping between EBCDIC and extended ASCII
tg [Wed, 3 May 2017 21:50:33 +0000 (21:50 +0000)]
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

3 years agoensure NUL in ASCII and EBCDIC both always occurs ordinal 0
tg [Wed, 3 May 2017 17:51:06 +0000 (17:51 +0000)]
ensure NUL in ASCII and EBCDIC both always occurs ordinal 0

3 years agofirst cut at the new matching code, IT WORKS!!! in the FIRST try!
tg [Wed, 3 May 2017 17:48:08 +0000 (17:48 +0000)]
first cut at the new matching code, IT WORKS!!! in the FIRST try!

missing:
- tons of new testcases
- EBCDIC support with ASCII ordering for POSIX ranges

3 years agosplit and adapt some testcases for EBCDIC
tg [Wed, 3 May 2017 16:17:08 +0000 (16:17 +0000)]
split and adapt some testcases for EBCDIC

3 years agomove the constants to an EBCDIC-friendly range
tg [Wed, 3 May 2017 15:36:12 +0000 (15:36 +0000)]
move the constants to an EBCDIC-friendly range

3 years agomove magic constants into definitions
tg [Wed, 3 May 2017 15:33:16 +0000 (15:33 +0000)]
move magic constants into definitions

3 years agosprinkle a few ord() and add an indicator of why some code fails on EBCDIC
tg [Wed, 3 May 2017 14:51:25 +0000 (14:51 +0000)]
sprinkle a few ord() and add an indicator of why some code fails on EBCDIC

3 years agomove more EBCDIC logic into check.pl
tg [Wed, 3 May 2017 14:51:15 +0000 (14:51 +0000)]
move more EBCDIC logic into check.pl

3 years agohandle EBCDIC in the testsuite runner (error display)
tg [Wed, 3 May 2017 13:00:10 +0000 (13:00 +0000)]
handle EBCDIC in the testsuite runner (error display)

- move categories for that to test.sh, simplifying it
- $ebcdic in Build.sh is now for the target, not the buildhost

3 years agoadd -U to test.sh as well, oops…
tg [Mon, 1 May 2017 20:03:25 +0000 (20:03 +0000)]
add -U to test.sh as well, oops…

3 years agocommit my WIP for the Beltane Snapshot of the Mainframe Korn Shell, not going to...
tg [Mon, 1 May 2017 19:44:29 +0000 (19:44 +0000)]
commit my WIP for the Beltane Snapshot of the Mainframe Korn Shell, not going to make finishing it tonight ☹

3 years agonuke unused stuff
tg [Mon, 1 May 2017 19:44:16 +0000 (19:44 +0000)]
nuke unused stuff

3 years agorequire Config only if it exists, which it reportedly doesn’t on OS/390
tg [Mon, 1 May 2017 19:43:23 +0000 (19:43 +0000)]
require Config only if it exists, which it reportedly doesn’t on OS/390

3 years agoclarify; default to xlc(1) as $CC on z/OS
tg [Mon, 1 May 2017 19:22:53 +0000 (19:22 +0000)]
clarify; default to xlc(1) as $CC on z/OS

3 years agoadd BSDish [[:<:]] and [[:>:]] matching (angle brackets must be escaped)
tg [Mon, 1 May 2017 15:59:45 +0000 (15:59 +0000)]
add BSDish [[:<:]] and [[:>:]] matching (angle brackets must be escaped)

3 years agouse strnul(); optimise
tg [Sat, 29 Apr 2017 22:04:31 +0000 (22:04 +0000)]
use strnul(); optimise

3 years agoreimplement has_globbing() with proper bracket expression parsing,
tg [Sat, 29 Apr 2017 21:49:07 +0000 (21:49 +0000)]
reimplement has_globbing() with proper bracket expression parsing,
and take ahead parsing collating symbols, equivalence classes and
character classes already (heck my first draft of this already did
better than GNU bash, ksh93 I still don’t grok its code at all)

3 years agoclean up OS exclusions somewhat: have Perl substitute the UTF-8 locale
tg [Sat, 29 Apr 2017 15:18:25 +0000 (15:18 +0000)]
clean up OS exclusions somewhat: have Perl substitute the UTF-8 locale

3 years agohandle expected utf8opt-2a failures better (i.e. don’t even try)
tg [Sat, 29 Apr 2017 14:36:13 +0000 (14:36 +0000)]
handle expected utf8opt-2a failures better (i.e. don’t even try)

3 years agoinstead of disabling, make it work
tg [Sat, 29 Apr 2017 14:20:24 +0000 (14:20 +0000)]
instead of disabling, make it work

3 years agooptimise <0x20/>0x7E into !C_PRINT
tg [Fri, 28 Apr 2017 21:43:30 +0000 (21:43 +0000)]
optimise <0x20/>0x7E into !C_PRINT

3 years agosince we have -DMKSH_ASSUME_UTF8=0 on z/OS, omit the known-to-fail check on OS/390
tg [Fri, 28 Apr 2017 21:43:02 +0000 (21:43 +0000)]
since we have -DMKSH_ASSUME_UTF8=0 on z/OS, omit the known-to-fail check on OS/390

3 years agoadd C_ASCII (0x01 .. 0x7F: 7-bit ASCII except NUL)
tg [Fri, 28 Apr 2017 12:02:41 +0000 (12:02 +0000)]
add C_ASCII (0x01 .. 0x7F: 7-bit ASCII except NUL)

3 years agomove three variables into common data, meaning .bss (hopefully)
tg [Fri, 28 Apr 2017 11:51:40 +0000 (11:51 +0000)]
move three variables into common data, meaning .bss (hopefully)

3 years agoconst
tg [Fri, 28 Apr 2017 11:48:46 +0000 (11:48 +0000)]
const

3 years agokeep ksh_ctypes[] array keys in EBCDIC
tg [Fri, 28 Apr 2017 11:31:53 +0000 (11:31 +0000)]
keep ksh_ctypes[] array keys in EBCDIC

we set $IFS massively less often than use ctype()

3 years agofill the map backwards (to use first occurrence of duplicates);
tg [Fri, 28 Apr 2017 11:27:58 +0000 (11:27 +0000)]
fill the map backwards (to use first occurrence of duplicates);
add a cache to ensure basic ASCII mapping is bijective

3 years agoadd -DMKSH_FAUX_EBCDIC to test the codepaths better
tg [Fri, 28 Apr 2017 11:13:49 +0000 (11:13 +0000)]
add -DMKSH_FAUX_EBCDIC to test the codepaths better

waking up to: Lanfear - Just Another Broken Shell

3 years agofix C array arithmetics
tg [Fri, 28 Apr 2017 04:13:19 +0000 (04:13 +0000)]
fix C array arithmetics

3 years agooops, ctypes are indexed by ASCII value even on EBCDIC systems
tg [Fri, 28 Apr 2017 03:51:14 +0000 (03:51 +0000)]
oops, ctypes are indexed by ASCII value even on EBCDIC systems

3 years agorename asc() to asciibetical() to make clear it’s for POSIX ordering only
tg [Fri, 28 Apr 2017 03:46:50 +0000 (03:46 +0000)]
rename asc() to asciibetical() to make clear it’s for POSIX ordering only
and switch remaining consumers, except the allowed one, to rtt2asc()

3 years agoallow backslash escapes for bind for ^ and \ o̲n̲l̲y̲; also more EBCDIC-friendly
tg [Fri, 28 Apr 2017 03:37:44 +0000 (03:37 +0000)]
allow backslash escapes for bind for ^ and \ o̲n̲l̲y̲; also more EBCDIC-friendly

3 years agocontrol character madness, but more compiler-friendly
tg [Fri, 28 Apr 2017 03:28:19 +0000 (03:28 +0000)]
control character madness, but more compiler-friendly

3 years agofill two complete round-trip maps EBCDIC <-> ASCII
tg [Fri, 28 Apr 2017 02:40:26 +0000 (02:40 +0000)]
fill two complete round-trip maps EBCDIC <-> ASCII

3 years agoapply most of the remaining parts of the EBCDIC patch, sans the CTRL() changes
tg [Fri, 28 Apr 2017 02:24:58 +0000 (02:24 +0000)]
apply most of the remaining parts of the EBCDIC patch, sans the CTRL() changes

3 years agocommit the EBCDIC run-time table conversion code, so it can be reviewed
tg [Fri, 28 Apr 2017 01:15:51 +0000 (01:15 +0000)]
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)

3 years agoBEL was, and Vi mode is, not EBCDIC-safe
tg [Fri, 28 Apr 2017 00:49:33 +0000 (00:49 +0000)]
BEL was, and Vi mode is, not EBCDIC-safe

3 years agocommit the optimisation result from the new fast character classes
tg [Fri, 28 Apr 2017 00:38:33 +0000 (00:38 +0000)]
commit the optimisation result from the new fast character classes

3 years agoadjust
tg [Fri, 28 Apr 2017 00:33:15 +0000 (00:33 +0000)]
adjust

3 years agoprepare for EBCDIC target environments (with -E option)
tg [Fri, 28 Apr 2017 00:27:48 +0000 (00:27 +0000)]
prepare for EBCDIC target environments (with -E option)

this differs from EBCDIC build hosts which can be autodetected