From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19664 invoked by alias); 11 Dec 2012 14:41:17 -0000 Received: (qmail 19605 invoked by uid 22791); 11 Dec 2012 14:41:01 -0000 X-Spam-Check-By: sourceware.org Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.83/v0.83-20-g38e4449) with ESMTP; Tue, 11 Dec 2012 14:40:46 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id B3E706A09C9; Tue, 11 Dec 2012 15:40:43 +0100 (CET) Date: Tue, 11 Dec 2012 14:41:00 -0000 From: Corinna Vinschen To: gdb-patches@sourceware.org Subject: Re: [RFA/mingw32] environment variables are case-insensitive on win32 Message-ID: <20121211144043.GA19874@calimero.vinschen.de> Reply-To: gdb-patches@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org References: <50B902D0.6060809@redhat.com> <20121203113147.GB12055@adacore.com> <20121209235344.GA12152@ednor.casa.cgf.cx> <20121210105115.GB15147@adacore.com> <20121210110128.GA12570@calimero.vinschen.de> <20121210134935.GL31477@adacore.com> <20121210152408.GB11967@calimero.vinschen.de> <20121210154231.GC17188@adacore.com> <20121210155752.GA16027@calimero.vinschen.de> <50C74268.7090209@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <50C74268.7090209@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-12/txt/msg00330.txt.bz2 On Dec 11 14:25, Pedro Alves wrote: > On 12/10/2012 03:57 PM, Corinna Vinschen wrote: > > Probably an old Cygwin version. Older versions of Cygwin did not > > honor the case of env vars, but rather converted them all to uppercase, > > but this is pre-2008! > > I'm confused by this. It looks like even with such old Cygwin, Cygwin > programs treated environment variables as case-sensitive, otherwise > the > > $ env | grep TEST_GDB > TEST_GDB_V=1 > TEST_GDB_v=2 > > in Jerome's test would have only shown one TEST_GDB_V, right? I phrased my reply too simple, sorry! What happens is this: 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 Hope that clarifies the situation. Corinna -- Corinna Vinschen Cygwin Project Co-Leader Red Hat