Commit ID:      1005A3D35CB63B89011
CVSROOT:        /cvs
Module name:    src
Changes by:     [email protected]    2017/12/22 16:41:43 UTC

Modified files:
        bin/mksh       : os2.c

Log message:
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 <[email protected]>

To generate a diff of this changeset, execute the following commands:
cvs -R rdiff -kk -upr1.7 -r1.8 src/bin/mksh/os2.c

Reply via email to