environment setup problem with "env -"

Christopher Faylor cgf@redhat.com
Mon Jan 12 18:20:00 GMT 2004

On Mon, Jan 12, 2004 at 12:53:32PM -0500, Igor Pechtchanski wrote:
>On Mon, 12 Jan 2004, Joe Buehler wrote:
>>It is apparently the case that the Cygwin DLL initializes certain
>>environment variables when it starts up.  This breaks the functionality
>>of the "env -" command (run a program, discarding the entire current
>>environment and using settings specified on the command line), which is
>>expecting to be able to strictly control the environment of the command
>>it invokes.  I'm not sure what the best solution is here...
>Hmm, looking at the sources, the only variable I can see being set by
>the DLL is CYGWIN (if the "export" option is on).  Some other variables
>(TMP, TEMP, TMPDIR, PATH, HOME, and LD_LIBRARY_PATH) are converted to
>the POSIX form *if they are present* in the environment.  IIUC, "env -"
>should clear the environment completely.  Which variables do you see
>being set?

"CYGWIN" is only set if explicitly asked for, presumably in the registry.
However, "TERM" will be set if it doesn't exist, ditto "HOME".

We could detect the case where there is no environment and avoid setting
"TERM" or "HOME" in that situation.

*I'm* not going to write a patch for that, however.


More information about the Cygwin-developers mailing list