Commit Graph

3189 Commits

Author SHA1 Message Date
tg
aa530d4343 implement early (mediæval) locale tracking, as a compile-time option,
for SuSE; slightly inspired by the original patch submitted by
From: Dr. Werner Fink <werner@suse.de>
2018-01-13 21:38:10 +00:00
tg
9f3c0efefc small cleanup for systems without core dumps, such as Jehanne 2018-01-05 20:08:34 +00:00
tg
82265de5d7 merge Jehanne cleanup patch
From: Giacomo Tesio <giacomo@tesio.it>
2018-01-05 20:05:26 +00:00
tg
3d522cfa27 turns out that Plan 9 does *not* have symlink(7)s
cf. https://github.com/brho/plan9/blob/master/sys/src/ape/lib/ap/plan9/dirtostat.c
despite https://github.com/brho/plan9/blob/master/sys/include/ape/sys/stat.h

see http://static.usenix.org/events/usenix2000/general/full_papers/pikelex/pikelex.pdf though…
2017-12-22 18:36:21 +00:00
tg
942035921c Pass arguments via a resonse file if executing a child fails
Command line length limit of OS/2 is 32KiB. If the total length of
all arguments is larger than this limit, it's needed to use a
response file.

Previously, the total length calculation was simply to add length of
all arguments. However, this result was not match with real length of
arguments, which are passed to child processes with OS/2 APIs.

Because conversion methods of arguments from libc to OS/2 APIs are
different depending on libc.

For example, kLIBC inserts its signature to an argument list. In
addition, it passes arguments with a leading space like:

    arg0
     kLIBC signature
     arg1
     arg2
     ...

Whereas, EMX just distinguishes arg0 and others like:

    arg0
    arg1 arg2 arg3 ...

After all, simple sum of a length of arguments are not correct.

The better way is to try to execute a child process, and to retry with
a response file if it fails due to arguments-too-long.

This has been found while doing 'bootstrap', especially 'autoreconf'
in coreutils git repo. It stops with:

    autom4te: /usr/local/bin/m4: Invalid argument

From: KO Myung-Hun <komh@chollian.net>
2017-12-22 16:41:42 +00:00
tg
d93bd77f28 Set stdin to text mode before executing child processes
Normal OS/2 programs expect that standard IOs, especially stdin,
are opened in text mode at the startup. By the way, on OS/2 kLIBC
child processes inherit a translation mode of a parent process.
As a result, if stdin is set to binary mode in a parent process,
stdin of child processes is opened in binary mode as well at the
startup. In this case, some programs such as sed suffer from CR.

This is the regression fix of commit 20dbf6.

From: KO Myung-Hun <komh@chollian.net>
2017-12-22 16:37:14 +00:00
tg
0faaab7bbc add patch for the Jehanne operating system, from Shamar on IRC 2017-12-22 16:30:00 +00:00
tg
a685208b7f increase some sleep and time limits, reported by Dr. Werner Fink
from OpenSuSE: their qemu-based powerpc systems have timing issues
2017-12-15 13:35:34 +00:00
tg
11953c9605 fix typo in comment 2017-11-20 02:32:32 +00:00
tg
8fe6311a01 refresh with up-to-date eawparse
thankfully, this is now all in glibc master, too
(thanks Mike FABIAN)
2017-11-18 12:01:53 +00:00
tg
0e478dceae 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 ☻
2017-10-17 23:45:19 +00:00
tg
c94bfd71e8 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)
2017-10-15 20:21:51 +00:00
tg
cfa08b1c3f move getdrvwd() declaration out of OS/2-specific part:
each MKSH_DOSPATH port is required to define it (and, later, others)
2017-10-14 21:09:48 +00:00
tg
d76a7e5813 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
2017-10-14 21:05:22 +00:00
tg
63cf261f11 fix “cd e:foo” on DOSPATH systems (I think) 2017-10-14 20:11:30 +00:00
tg
5468d726b3 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
2017-10-13 23:34:49 +00:00
tg
524e63b4a1 fix a longstanding double substitution 2017-10-13 23:02:11 +00:00
tg
7d18c762d2 komh says these are redundant 2017-10-13 11:54:06 +00:00
tg
0ba04f9bb7 apply fixes from code review by @komh 2017-10-12 15:17:04 +00:00
tg
34fc7afc8c 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
2017-10-11 23:48:36 +00:00
tg
5db583cd81 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”)
2017-10-11 23:23:03 +00:00
tg
d5a29d5e60 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
2017-10-11 21:52:46 +00:00
tg
2cdd9d77de further OS/2 fixes for simplify_path() 2017-10-11 21:49:06 +00:00
tg
af61fd186a all uses of mksh_vdirsep should exclude “\builtin” from triggering it 2017-10-11 21:09:24 +00:00
tg
5a89f6d959 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)
2017-10-11 21:04:59 +00:00
tg
f578d7cd10 eval.c has the only mksh_sdirsep caller and uses it on substrings,
so OS/2 drive letter checks are not correct there
2017-10-11 20:55:06 +00:00
tg
99db3ecb5c inline OS/2’s mksh_sdirsep() into its mksh_vdirsep()
because we must separate these two
2017-10-11 20:50:46 +00:00
tg
9dc689dd17 keep drive letter when simplifying path (untested) 2017-10-11 20:46:14 +00:00
tg
2b329c9343 introduce mksh_drvltr(s) short-hand macro 2017-10-11 20:29:05 +00:00
tg
f20af3a14f turns out the slash was already added (later), 10x komh 2017-10-11 19:06:44 +00:00
tg
694aab50ce 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.
2017-10-10 21:30:43 +00:00
tg
7f38eafe26 remove redundant OS/2 codes (from komh)
os2_init() does it.
2017-10-10 21:19:43 +00:00
tg
4d23a65454 monkey-patch offsetof for a klibc/dietlibc warning; bump to R56b (bugfixes) 2017-08-29 13:38:31 +00:00
tg
7cbce8f98e quell a Fink compiler warning; not entirely correct but no harm done either 2017-08-28 23:27:51 +00:00
tg
c4acfa38cc unbreak vi mode '0' movement, bug introduced in r1.323
reported by Larry Hynes <larry@larryhynes.com>
2017-08-27 23:33:50 +00:00
tg
3a4eaf6f59 fix documentation bug, thanks panpo and Riviera for spotting 2017-08-16 21:40:14 +00:00
tg
53fbbc9693 we have a FAQ now! (well, two of them, different scope though) 2017-08-10 19:25:12 +00:00
tg
bee53eb667 bump 2017-08-08 21:11:20 +00:00
tg
b52badd958 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
2017-08-08 21:10:21 +00:00
tg
b00e5b01b4 promote jupp to default editor if installed, in the customisation section 2017-08-08 20:52:11 +00:00
tg
bc1746bccb comment 2017-08-08 20:50:34 +00:00
tg
0af974d905 let hd_mksh take from stdin, great simplification 2017-08-08 20:42:16 +00:00
tg
7f7fb75205 make EBCDIC-safe 2017-08-08 20:40:25 +00:00
tg
252c4b181b perform in chunks, don’t read the entire file into memory ahead 2017-08-08 20:38:08 +00:00
tg
ce64148abb always expone mksh’s hexdumper 2017-08-08 20:22:16 +00:00
tg
6327ca02f2 fix Red Hat BZ#1479320 by making interactive shells remember async PIDs too 2017-08-08 14:30:10 +00:00
tg
1fa38c9c2c optimise structure size calculation to take alignment into account 2017-08-08 14:29:23 +00:00
tg
d8d8ec4466 go home Coverity, you’re drunk
code refactoring to work around it not recognising the correct code path
2017-08-08 00:03:56 +00:00
tg
23320b7a72 Coverity 1416282 2017-08-07 23:25:09 +00:00
tg
a318b33ace Coverity 1416283 2017-08-07 23:23:12 +00:00