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

Pierre Muller
2012-12-10T16:09:56Z

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.
The current implementation of native windows compiled with
mingw32 seems to be perfectly able to pass
several different environment variables having the same uppercase name,
see below:

E:\pas\trunk\fpcsrc\rtl>gdbpurepython gdbpurepython
Python Exception <type 'exceptions.ImportError'> No module named gdb:

warning: Could not load the Python gdb module from
`e:\mingw\share\gdb/python'.

warning: Limited Python support is available from the _gdb module.
GNU gdb (GDB) 7.5.50.20121210-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
e:\pas\fpc-2.6.0\bin\i386-Win32\gdbpurepython.exe...done.
(gdb) set Test1=Mixed
No symbol "Test1" in current context.
(gdb) set env Test1=Mixed
(gdb) set env test1=lower
(gdb) set env TEST1=UPPER
(gdb) set prompt top>
top> r
Starting program: e:\pas\fpc-2.6.0\bin\i386-Win32\gdbpurepython.exe
... Some output suppressed
(gdb) [New Thread 5920.0xb04]
[New Thread 5920.0x1588]
show env
ALLUSERSPROFILE=C:\ProgramData
... More output suppressed
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
RoxioCentral=C:\Program Files (x86)\Common Files\Roxio Shared\10.0\Roxio
Central36\
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\Pierre\AppData\Local\Temp
test1=lower
Test1=Mixed
TEST1=UPPER
... More output suppressed
All three versions are passed successfully to child,
so I don't really understand why we want to remove that possibility
of passing different case versions of the same uppercase'd name.

It's only if I use
set Test1=Mixed
set TEST1=UPPER
and
set
on the windows console
that I do get only a unique line
Test1=UPPER

So that seems to me to be a feature of cmd.exe (or command.com)
more than from the Windows API...

Pierre Muller
GDB pascal language maintainer

> -----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 16:35
> À : Joel Brobecker
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFA/mingw32] environment variables are case-insensitive on
> win32
>
> Joel Brobecker (brobecker@adacore.com):
>
> > 1. Decide whether we want GDB to match environment variable names
> > using case-sensitive or case-insensentive functions on cygwin.
> > Right now, it's case-sensitive. FWIW, we are offering to change
> > that behavior, and it seems more user-friencly at the moment,
> > but either choice is fine with me. If no concensus can be reached
> > on this, then we'll revert to the original behavior.
> >
> > 2. Commit Jerome's patch which implements the decision from (1),
> > letting a more elaborate handling of environment variables
> > as a followup patch for someone more involved in cygwin than
> > we are.
>
> At this point my feeling is that there is something to clarify for
> Cygwin; the symptom being that the new test I submitted for
> testenv.exp fails on this platform. But for the moment I'd be inclined
> to let Cygwin's situation unchanged and let an expert handle it. The patch
> that I would submit would fix mingw32 only. So I guess that would be (2).
>
> The corresponding patch is in attachment.
>
>
>