Change to environment variable handling

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Nov 11 10:57:00 GMT 2008


Hi guys,


I just applied a customer induced patch which changes the way the
environment is treated when a Cygwin process is started from a
non-Cygwin process.  For the last ten years all environment variables
were unconditionally uppercased.  Now the user has a choice.  The new
CYGWIN option "upcaseenv" allows to choose between the old model
"upcaseenv", always uppercase whole environment, and the new default
model "noupcaseenv", which only uppercases a small set of environment
variables for backward compatibility and POSIX compatibility.

The current set of variables which get uppercased in both modes is this:

  ALLUSERSPROFILE
  COMMONPROGRAMFILES
  COMPUTERNAME
  COMSPEC
  HOME
  HOMEDRIVE
  HOMEPATH
  NUMBER_OF_PROCESSORS
  OS
  PATH
  PATHEXT
  PROCESSOR_ARCHITECTURE
  PROCESSOR_IDENTIFIER
  PROCESSOR_LEVEL
  PROCESSOR_REVISION
  PROGRAMFILES
  SYSTEMDRIVE
  SYSTEMROOT
  TEMP
  TERM
  TMP
  TMPDIR
  WINDIR

I tried to make the function (environ.cc:ucreqenv) which matches the
incoming variable against this list as quick as possible.  In theory,
there should be no performance hit since the time used for scanning the
list is weighed against the time used to uppercase the entire
environment.

The above list is what I came up with to make sure Cygwin and most
(well, hopefully all) Cygwin applications still run even when not
uppercasing the whole environment.  If you think that variables are
missing in this list, please drop us a note together with an explanation
why these variables should be added to the list as well.

If the default works out fine, perhaps we can drop the CYGWIN option
at one point and make the default the only option.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-developers mailing list