X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; q=dns; s=
	default; b=Uax+mHjVEHD/VPzspkWgiql5CPclFS9GJUtZwlqlNGZC9LbFKzjDD
	tbukl/FDM2awhforqAP4p6I4W4WSWzFpoBU1aVZ7YdXENyj81rWB/8wyRzVW01V6
	ZS/qvwbOfNk77sPsPXGuMH9ZVg4PFvlxDcmhefssdA2PlwR7tneNug=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; s=default;
	 bh=tY+7sB1nr8AxVPZwEX9jyQuAIhY=; b=B7hBIr8qxQxYJKM9zgTtlTp1NW4k
	w3sUDqplly9iAAsfenazfBNALNcdC9iuGeP2pFO3vvK4kVEFmLrCNk+o/NCZ7hoC
	Tu2tTshaBNHMxY3EierzOhgR4JK6GNt+vil/do1oDMCZAjiQTnhIeIY9+FrhCy9X
	L6dYc+fj6d6W+RA=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-101.5 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=rice, Rice, Vince, vince
X-HELO: drew.franken.de
Date: Thu, 17 Nov 2016 20:34:22 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: CYGWIN_NOWINPATH (was Re: /etc/profile: avoid multiple /usr/bin in PATH)
Message-ID: <20161117193422.GA31883@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <CAK-n8j7X7XkqO8Ny=_1CRLX=9cLY4nx6Pau2Q5mSq8ODVjNMtQ@mail.gmail.com> <CAJ1FpuMm_agFZZGbW=nCHes4uuNL2FPJWdgYb=0uRMoXdWZrCw@mail.gmail.com> <20160908120718.GE3860@calimero.vinschen.de> <o0krfu$cob$1@blaine.gmane.org> <5254219C-D6EF-47E7-BE79-3EEDC8DA6604@solidrocksystems.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;	protocol="application/pgp-signature"; boundary="qDbXVdCdHGoSgWSk"
Content-Disposition: inline
In-Reply-To: <5254219C-D6EF-47E7-BE79-3EEDC8DA6604@solidrocksystems.com>
User-Agent: Mutt/1.7.1 (2016-10-04)

--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Nov 17 12:11, Vince Rice wrote:
> > On Nov 17, 2016, at 12:04 PM, Francis Litterio <flitterio@gmail.com> wr=
ote:
> >=20
> > On 9/8/2016 8:07 AM, Corinna Vinschen wrote:
> >> On Sep  5 10:36, Doug Henderson wrote:
> >=20
> >>> I set CYGWIN_NOWINPATH=3D1 in my user environment variables, i.e. in
> >>> registry, not in a cmd shell. I expect it needs to be seen when the
> >>> first cygwin1.dll instance starts, so you would need to stop all
> >>> cygwin processes and servers, just like you do when you run the cygwin
> >>> setup, for this to be effective.
> >>=20
> >> Ouch, no!  Environment variables are handed down from parent to child
> >> process.  On all systems, be it Windows, Cygwin, Linux or whatever.
> >> There's *no* other magic involved.  It's just a bunch of strings
> >> inherited from the parent process.
> >=20
> > Yes, but Explorer induces confusion as follows (seen on Windows 7):
> >=20
> > 1. Open a Command Prompt from the Start Menu (so cmd.exe is a child of =
explorer.exe), and enter "echo %foobar%".  See output "%foobar%". Environme=
nt variable foobar is not set.
> >=20
> > 2. Enter "setx foobar 99" to add foobar to the persistent environment v=
ariables in the Registry.
> >=20
> > 3. Enter "echo %foobar%" again in the same Command Prompt.  Still see "=
%foobar%".  No change in that process's environment, as expected.
> >=20
> > 4. Launch a new Command Prompt from the Start Menu.  Enter "echo %fooba=
r%".  See "99".  Clearly, Explorer updated it's environment from the Regist=
ry and passed the change to the new child process.
> >=20
> > This leads people to think that environment variables stored in the Reg=
istry are special, when in fact it's Explorer's doing.
>=20
> None of which has anything to do with needing to re-start cygwin,
> which was Corinna's point.  And, for the record, Explorer doesn't
> induce any confusion at all. A new process gets its environment when
> it starts. Pretty simple to understand.

Well, Francis raises a good point.  The question is of course this:

If Explorer is a process as any other process (and it is), then when you
change the system env, how is it that Explorer notices it and
starts child processes with the changed env?

Under normal inheritence rules this *is* puzzeling.

The solution: Windows GUI applications receive a message in the Windows
Message Queue notifing them of the fact that the system env has been
changed.  If the GUI app cares for this, and Explorer does, the app can
then re-read the system env and refresh its own env with the new data.

This explains how processes started from Explorer *after* changing the
system env immediatly see the changes.


HTH,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--qDbXVdCdHGoSgWSk
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJYLgY+AAoJEPU2Bp2uRE+gS4IP/2IUR4hB13xi/CKu4kIjgFPe
BmfqQg8tiezbLKg5+5PmmUNmY00sGBdyig1HC9lGj5g3bBPRH+sVWxfTN4N0s69q
9Sgnfrex5Ucn7+tKw18eWxBqjavKl7SpfKcFOvuj1RFnP+Gai1UKmad24aYo9Yai
JVOrxqXOc5PHfBF3Ne7P08TeU5AkgsFUbU3+yp/T8X2/EUJiZ/PaTGcnN0/sMtEE
mFMUkRbd2ZbVw9AUL73eRBlHYg5uehs/hl9PQzSPLjPT6agAiWVf0zNy/qiXnt6c
PAGf7SLMwO8RDudEvr6CsLIQRryGClKa8aqkcsnpAKWZLWwiR99O2joXzN46OBBR
lEw8D9BoB0bkUCUXmFy058ar/I/pnEd9WcMQcyceNKegMZQ9Ht7kNWogMoyOf8uV
THgXm91uQfoyZROG0iIzD5O8wlA11Zuh911WTiEIY5GWakqqgB8OJW07rngaMyh0
/7MtNT4DtGDVIE51k1alkR1K5kS/4C0kP7oB2h0uBVmYA7ExXiwBrT37W68QOSqN
pHJwj5Bmx9QwffORbvH+AS8scXWdfq3mlnmhKMbLrI/ZmLnryQgeFVBgiLQCYo2D
75Ags13ER2QsLVHoXDjbq7wpE0hXp56Cmja+pZXmbjxRrLn3lbj/YltXqhpxKzLg
wx6cvz4FHUoEEcwGR1Pn
=bLmg
-----END PGP SIGNATURE-----

--qDbXVdCdHGoSgWSk--
