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>
‣ 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 ☻
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)
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
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”)
(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)
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.