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

Jerome Guitton
2012-12-10T18:22:00Z

Corinna Vinschen (vinschen@redhat.com):

> Only the Win32 function GetEnviromentVariable searches the environment
> case-insensitive, and SetEnviromentVariable overwrites the first
> occurence of a variable after a case-insensitive search. These
> functions are also used by CMD.EXE, so that it's case-insensitive as
> well.
>
> But that doesn't affect the ability to handle case-sensitive environments
> in applications NOT using GetEnviromentVariable/SetEnviromentVariable.
>
> If you give an environment to the CreateProcess function it will go
> unchanged to the inferior process. Fetching the complete environment
> with GetEnvironmentStrings in the inferior will show the full,
> unchanged, environment, with as much variables only differing by case as
> you like.

Thank you very much for this clarification Corinna!

At this point I feel that the most sensible thing to do for mingw32 is
to have case-insensitive env vars, even though on certain
circonstances case-sensitivity would work. I have one other good
reason to think that: the path command does not work today in mingw32
when running the debugger from CMD.EXE. That is caused by the fact the
corresponding environment variable has a different casing than PATH:
it's 'Path' (at least on my machine). So a case-sensitive lookup
fails, a new variable 'PATH' is created in the environment vector, and
the inferior ends up with a truncated environment.