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>
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>
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”)
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
On kLIBC, a child inherits a translation mode of stdio/stdout/stderr
of a parent. So if setting stdio handles of a parent to text mode,
a child reads CR+LF as LF and write LF to CR+LF. Especially, LF to
CR+LF conversion causes many troubles in UNIX programs.
Instead, if a child inherts a child inherit a current translation mode,
where stdin is text mode, stdout and stderr are binary mode, a child
would write LF as is.
This is the way for OS/2 to survive in UNIX jungle.
For example, 'make check' of libiconv fails due to mismatch of CR+LF
and LF.
PATH and TMPDIR are used by OS/2 as well. So they may have backslashes
as a directory separator. A backslash may cause an unexpected behavior
when do 'echo'. Because a backslash may be used as an escaped character.