Closed dmik closed 3 years ago
Note that after closing bitwiseworks/libc#102 the above commit was not strictly necessary as the effect would be the same in case of P_2_APPENDENV because the current (parent) process variables would be shadowed by those from envp
w/o =
and spawnve
indirectly used by spawn2
would ignore them anyway.
However, spawnve
may change in the future and e.g. refuse accepting variables w/o =
so it's safer to not pass them from spawn2
at all.
Note that both appending and deletion is based using case sensitive comparison now as this is what POSIX requires for environment variables.
Some apps, e.g. git (see https://github.com/bitwiseworks/git-os2/issues/4#issuecomment-808804069) want to not only add some environment variables to their own environment when passing it to the child process but also remove some of them. Adding is currently done by passing variables to add in
envp
and setting P_2_APPENDENV inmode
. However, there is no way to perform removal.I propose to go the same way git goes: treat variables w/o an
=
character (i.e. w/o a value specification) as ones to be removed. This makes sense as there is no need to pass variables in such a form otherwise. BTW, both LIBC__spawnve
andDosExecPgm
accept such variable specifications pretty well but it appears from the program POV as the respective variables are simply never set (getenv
returns NULL for them,DosScanEnv
returns error 203 — ERROR_ENVVAR_NOT_FOUND).