From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3609 invoked by alias); 4 Oct 2011 11:13:46 -0000 Received: (qmail 3533 invoked by uid 22791); 4 Oct 2011 11:13:21 -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, 04 Oct 2011 11:13:00 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 403152C00DB; Tue, 4 Oct 2011 13:12:57 +0200 (CEST) Date: Tue, 04 Oct 2011 11:13:00 -0000 From: Corinna Vinschen To: gdb-patches@sourceware.org Subject: Re: [RFA] Environment variables passed to inferior by MinGW build (PR 10989) Message-ID: <20111004111257.GA22731@calimero.vinschen.de> Reply-To: gdb-patches@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org References: <4E7FBF9E.20000@earthlink.net> <20110926171511.GJ17681@adacore.com> <20111004075325.GB13895@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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: 2011-10/txt/msg00071.txt.bz2 On Oct 4 05:29, Eli Zaretskii wrote: > > Date: Tue, 4 Oct 2011 09:53:26 +0200 > > From: Corinna Vinschen > > Reply-To: gdb-patches@sourceware.org > > > > I was on vacation and I'm also not the area maintainer for windows-nat.c. > > No worries, I hope you had a good time ;-) > I CC'ed you because you made the change that I partially undid, and > also participated in some of the discussions I cited. > > > Eli's patch is ok, IMHO, but it's a pity that Pierre never followed up > > to http://sourceware.org/ml/gdb-patches/2011-04/msg00351.html since that > > means that now setting environment variables works in Mingw, but not in > > Cygwin. > > Could you elaborate why the behavior on Cygwin is incorrect? AFAICT, > Pierre's changes didn't get into GDB, so GDB still works as it did > before, and your changes that introduced the call to cygwin_internal > were supposed to fix the issue of "set environment" and "unset > environment", right? No, my changes from way back didn't handle `set env' and `unset env', they actually introduced the problem. The cygwin_internal call was necessary to sync Windows and Cygwin environment when calling CreateProcess. At the time I neglected the internally set environment vars and nobody noticed the mistake, apparently. So, your patch is fine, I was just commenting on the fact that it would have been nice if the patch cared for all code paths. > > So, as far as I can see, PR #10989 should not have been closed > > yet. > > But that bug report is for the MinGW host and target only, so if > Cygwin has a similar problem, it's a different issue and probably also > a different solution. > > OTOH, if the same code I re-introduced will work for Cygwin, it should > be a simple matter to remove the #if conditionals. Am I missing > something? I'm quite busy catching up after vacaction right now. Off the top of my head it might be the right thing to do, with a single exception: It would be most helpful if the Windows environment is created as UNICODE environment and CreateProcess uses the CREATE_UNICODE_ENVIRONMENT flag. This should work pretty much identically for both code paths. Using the Unicode environment has some advantages: - The ANSI environment block is restricted to 64K in size, the UNICODE environment block is not restricted at all. - Using UNICODE makes the environment codepage agnostic. - A single static function could be used to allocate and create the environment for both code paths. Corinna -- Corinna Vinschen Cygwin Project Co-Leader Red Hat