This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Environment variables passed to inferior by MinGW build (PR 10989)
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 4 Oct 2011 13:12:57 +0200
- Subject: Re: [RFA] Environment variables passed to inferior by MinGW build (PR 10989)
- References: <E1R2jDx-00035B-Fq@fencepost.gnu.org> <E1R5YPa-0007H0-0B@fencepost.gnu.org> <E1R7mEx-0003rs-PZ@fencepost.gnu.org> <4E7FBF9E.20000@earthlink.net> <20110926171511.GJ17681@adacore.com> <20111004075325.GB13895@calimero.vinschen.de> <E1RB1JO-0007S1-ES@fencepost.gnu.org>
- Reply-to: gdb-patches at sourceware dot org
On Oct 4 05:29, Eli Zaretskii wrote:
> > Date: Tue, 4 Oct 2011 09:53:26 +0200
> > From: Corinna Vinschen <vinschen@redhat.com>
> > 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