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

Corinna Vinschen
2012-12-10T16:54:11Z

On Dec 10 17:26, Pierre Muller wrote:
>
>
> > -----Message d'origine-----
> > DeÂ : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> > owner@sourceware.org] De la part de 'Jerome Guitton'
> > EnvoyÃ©Â : lundi 10 dÃ©cembre 2012 17:19
> > Ã€Â : Pierre Muller
> > CcÂ : gdb-patches@sourceware.org
> > ObjetÂ : Re: [RFA/mingw32] environment variables are case-insensitive on
> > win32
> >
> > Pierre Muller (pierre.muller@ics-cnrs.unistra.fr):
> >
> > > I am not sure, but I have the impression that the case_preserving
> > > environment of Windows OS is more a shell issue than an OS issue.
> >
> > I don't think so, because I see the same problem by using "set env"
> > from GDB. But it does not matter much. I am now convinced that my
> > setup is to blame. So I'm happy to withdraw the Cygwin-specific part
> > of my patch.
>
> But my email was not about the cygwin part,
> it was really about the mingw executable:
> Currently, you can set several separate environment variables
> having the same upeercase'd name, which
> can be passed correctly to the debuggee.

Just as a data point:

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.

Corinna

--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat