Opened 10 years ago
Last modified 10 years ago
#303 reopened enhancement
__spawnvpe: Support more than 32K of arguments and 32KB enviroment.
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 )
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.
Attachments (2)
Change History (9)
comment:1 by , 10 years ago
comment:2 by , 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 , 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 , 10 years ago
Resolution: | → needsmoreinput |
---|---|
Status: | new → closed |
comment:5 by , 10 years ago
Resolution: | needsmoreinput |
---|---|
Status: | closed → reopened |
DosExecPgm returned ERROR_BAD_ENVIRONMENT. I attach the testcases I used.
comment:6 by , 10 years ago
Component: | libc → libc-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: | defect → enhancement |
comment:7 by , 10 years ago
I can second the request. Here is another case when it screws things up: http://trac.netlabs.org/ports/ticket/58. Note that it seems that if there is a large number of arguments kLIBC screws up before coming down to DosExecPgm
. At least, here, if you take the simple parent.c
example from #343, build it with -Zwild-args
and then run parent.exe *
in a directory that contains very many files (got 1366 here), the parent.exe
process will hard-hang the system (only the reboot helps) while just printing the argument list. Due to the hard hang, I can't tell more as all logs are killed by chkdsk after reboot (JFS). Perhaps, the argv
array contains invalid pointers or such.
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 ?