DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 57LIGZpt1857440
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 57LIGZpt1857440
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=IhIhZBj4
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E97C2385E44B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1755800192;
	bh=HcgqEl8KBtLBIzBj4wAw2+SpFCToEWYLCDgoNjki++A=;
	h=Date:To:cc:Subject:In-Reply-To:References:List-Id:
	 List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
	 From:Reply-To:From;
	b=IhIhZBj4niLobZXboPq4wu8S9pgZ4JB54ljVtBXAVsDyFPORv4M9P2aA9UWK+qw12
	 DWifoJlWBtJyVhp9psqaF60zdmUCDXlGZReBSJ0qk4ZL3n4PzxQAwkNK9zC0G1ee/m
	 u9x9kbOuRvkY0tExBw3w/JNdBE5v6mGqUlrCLHJ0=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BBE4F385482F
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BBE4F385482F
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755800132; cv=none;
 b=sWSvxF+FNTxBL7TMepGxaaUCbUKQI64h+Nb6p7rU9T1GMus9kvnM/WzXsZiUM7/e6HRqCNM+boGn8hqdhDjDwgYPRbjF7bmaJ366NV7dZYWW4159cEuKbisWpq9SZ28Jfgr0FEcbycNfsXAj8wszmHfjZSYz2XdRh+odgpcsUPo=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1755800132; c=relaxed/simple;
 bh=YtoX8IuIB2R+j0SZc680myp0+0z3PT1DBZmJ7smlolA=;
 h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;
 b=siG/niDu+hXpqq1ep5RMgC+oZF7LyrPyAZYHnqgQGj8dfAFt4NrMPOy/O1L+gHIA68Bcnh9sYhw3ZsN4oahGB0FGi8KBZN1P7/G/AHPiE3P8D6GalyVf3Y5UFBR8Nt8ZEA8T3EpThwOG7iLMiaAZ3xWnJC7HkQBzPzioyb5yyFU=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BBE4F385482F
Date: Thu, 21 Aug 2025 11:15:31 -0700 (PDT)
X-X-Sender: jeremyd@resin.csoft.net
To: Thomas Wolff <towo@towo.net>
cc: cygwin@cygwin.com
Subject: Re: Runtime control per application
In-Reply-To: <c34b8878-0e03-44f2-ae79-6ba51def5452@towo.net>
Message-ID: <0dd0529b-04e2-37db-229c-070258d17689@jdrake.com>
References: <c34b8878-0e03-44f2-ae79-6ba51def5452@towo.net>
MIME-Version: 1.0
X-Content-Filtered-By: Mailman/MimeDel 2.1.30
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Jeremy Drake via Cygwin <cygwin@cygwin.com>
Reply-To: Jeremy Drake <cygwin@jdrake.com>
Content-Type: text/plain; charset="utf-8"
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 57LIGZpt1857440

On Mon, 18 Aug 2025, Thomas Wolff via Cygwin wrote:

> Hi,
> a recent patch in MSYS:
> https://github.com/msys2/msys2-runtime/commit/cd4b539b367dc2a21041405cb52d3bf5dbf1a3be
> supports finer-grained control about runtime behaviour as configured via
> MSYS/Cygwin environment.
> Maybe it would be a good idea to patch cygwin upstream likewise.
>
> Test case (here in Windows German language configuration):
>
> MSYS:
>  > xcopy
> Unzulässige Parameteranzahl
> 0 Datei(en) kopiert
>  > MSYS=disable_pcon xcopy
> Unzul▒ssige Parameteranzahl
> 0 Datei(en) kopiert
>  >
>
> Cygwin:
>  > xcopy
> Unzulässige Parameteranzahl
> 0 Datei(en) kopiert
>  > CYGWIN=disable_pcon xcopy
> Unzulässige Parameteranzahl
> 0 Datei(en) kopiert
>  > CYGWIN=disable_pcon sh -c xcopy
> Unzul�ssige Parameteranzahl
> 0 Datei(en) kopiert
>  >
>
> In Cygwin, an additional shell is needed to make the $CYGWIN
> configuration effective, in MSYS now it works directly.
> Question, being curious: How does this work at all? What system call of
> the shell makes the change effective?


In Cygwin, the CYGWIN environment variable (renamed to MSYS in MSYS2) is
parsed at process start and global variables are initialized based on what
settings are in there.  That MSYS2 patch causes the environment variable
to be re-parsed as the environment is prepared for spawning a new process.
This enables settings that change how a process is launched to take effect
for *that* process launch, instead of just initializing the variables in
the child differently so that processes *it* launches will be done with
the new settings.

A potential downside that I see is that settings changes might "leak" into
the parent process that were intended to only take effect for the child.

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

