Opened 10 years ago

Last modified 10 years ago

#303 reopened enhancement

__spawnvpe: Support more than 32K of arguments and 32KB enviroment. — at Version 6

Reported by: KO Myung-Hun Owned by:
Priority: low Milestone: libc-0.7
Component: libc-backend Version: 0.6.5
Severity: minor Keywords: __spawnvpe
Cc:

Description (last modified by bird)

OS/2 only allows up to 32KB long string lists for arguments and 32KB for the environment. This causes problems for some programs, like the tests harness of automake v1.13.1. It would be nice to be able to pass longer strings to kLibC programs. On option is to use a temporary file or two.

Change History (8)

comment:1 by KO Myung-Hun, 10 years ago

Further investigating revealed this problem was due to very large environment. This occurred when environment size was 65172. OS/2 allows up to 64K including argument size. Maybe environment size seemed to approach to the limit of OS/2.

Even though passing some infos through very large env vars, is absolutely insane appraoch, is it worth trying to workaround this problem like passing very long arguments ?

comment:2 by KO Myung-Hun, 10 years ago

I've confirmed that the maximum environment size is 32KB(32768 bytes) except a mark of end, '\0', of an environemnt.

comment:3 by bird, 10 years ago

This is a OS specific limitation that would be very tedious to work around (would require shared memory, temporary argument file, or some other form of IPC to set up). The argument limit is expressed by the NCARGS (sys/params.h) and ARG_MAX (sys/syslimit.h) constants, there seems not to be any define giving the limit on the environment.

Now, I'd expect DosExecPgm to fail with ERROR_BAD_ENVIRONMENT or ERROR_BAD_ARGUMENTS if either the environment or argument list is longer than ~32KB. Some quick experiments with a very large environment value and/or argument shows that it _spawnv and _spawnve does consistently fail. Maybe something more complicated is required? Or maybe the failure wasn't due to shells, but rather spawn failure?

Anyway, if you want anything fixed here, you need to supply a simple testcase that reproduces the issue.

comment:4 by bird, 10 years ago

Resolution: needsmoreinput
Status: newclosed

comment:5 by KO Myung-Hun, 10 years ago

Resolution: needsmoreinput
Status: closedreopened

DosExecPgm returned ERROR_BAD_ENVIRONMENT. I attach the testcases I used.

by KO Myung-Hun, 10 years ago

Attachment: envtest.c added

main program of testcase

by KO Myung-Hun, 10 years ago

Attachment: envtest2.c added

child program of testcase

comment:6 by bird, 10 years ago

Component: libclibc-backend
Description: modified (diff)
Keywords: __spawnvpe added
Summary: spawnvpe() set COMSPEC and OS2_SHELL to NULL in some cases__spawnvpe: Support more than 32K of arguments and 32KB enviroment.
Type: defectenhancement
Note: See TracTickets for help on using tickets.