Re: [RFA/mingw32] environment variables are case-insensitive on win32

Pedro Alves
2012-12-11T15:07:10Z

On 12/11/2012 02:40 PM, Corinna Vinschen wrote:

> I phrased my reply too simple, sorry! What happens is this:

Thanks! This clarifies things for me. One follow-up FAOD-like question
below.

> Internally, Cygwin doesn't use the Windows environment, but rather a
> POSIX equivalent. When a Cygwin process forks or executes another
> Cygwin process, the environment is given to the child process in the
> POSIXified layout, not using the CreateProcess environment pointer.
>
> However, when a Cygwin process gets started by a *non*-Cygwin process,
> this internal mechanism can't work, and the POSIX environment is created
> from the Windows environment. Up until 2008, all environment variables
> in the Windows env were converted to uppercase when creating the POSIX
> env. In 2008 we changed that mechanism to uppercase only a certain set
> of env vars, and that's done up to today for compatibility reasons. The
> list of still uppercased vars 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

Then, the situation of GDB (a Cygwin process) starting the inferior with
CreateProcess ends up being the same as if GDB was not a Cygwin process, and
that set of vars always ends up uppercased in the inferior, right? Or does
Cygwin have some magic that detects the case, and avoids the uppercasing in
this case?

--
Pedro Alves