DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 4BKGqO781480937
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 4BKGqO781480937
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=juAzetaf
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C9AA3858C32
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1734713543;
	bh=ZgxYufwENDuYSvPxZ/TVCQ+qeYXV7G6jBXbMOiGdcl4=;
	h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:
	 List-Help:List-Subscribe:From:Reply-To:From;
	b=juAzetafGL7BJFsMCD+a7jELaYZh44L6h3nlc1q/qrwLGRdhdG7OTIwPRrmX004J8
	 CWEHPpld+ijPncC7a08YpGR4mNfcqYBjm75taC4jXXD+tTP4I+YOeYSsAC3BFjMWSr
	 hOqvYlX1bNnC9yDP6Cet2vOWK8EYCHoikKdecGlA=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D23E43858D38
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D23E43858D38
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734713514; cv=none;
 b=w+5qpqIXm5qYB+FeG7pIeLyv3MjPkL9YfIAerpMecngMIQ1iNnXP+nK3c10gl8Hi+SOrnktGA6lNhNh9PAiDpdEL3/7tXP/1ytJjO5Sravv2pAopE+LjucipohsQsoig2ESzvDIWbfvo8Vf5PvKWAw8VoNw5O/xUwD+cnv5hP0E=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1734713514; c=relaxed/simple;
 bh=3aOgZp2RsrkJLqb2W/bMFNVdsTKyhij4vidnxcfbb60=;
 h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject;
 b=HEkwi2c7MlC9i26HuA6p3jNYsJ55h0TD20lojp7WAU/uHiJDWRSP5aQWv+VTjNMDYagbjx7DLbNW5a4A3hVx6gMmy+7u4mR8kf1S3daURmTp8gLntxww2ifYpWGwHlmVMcI2b0WS7MrtxRGgbq3s9MbUcM6ONxg2endUufmhQ+U=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D23E43858D38
Message-ID: <77a3709d-ec4d-497b-bf6c-75f29dc8c992@kircheis.it>
Date: Fri, 20 Dec 2024 17:51:48 +0100
MIME-Version: 1.0
To: cygwin <cygwin@cygwin.com>
Subject: env and PATH
X-Rspamd-Queue-Id: 4YFD3B6S9mz9stP
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
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: Federico Kircheis via Cygwin <cygwin@cygwin.com>
Reply-To: Federico Kircheis <federico@kircheis.it>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>

Hello to everyone,


I've noticed that env seems to handle the environment variable PATH in a 
particular way


-----
 > cd /d;
 > env -i PATH='C:\Windows;C:\Windows\system32;' 
/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe
# in the powershell instance
echo $env:PATH
C;D:\Windows;C;D:\Windows\system32;
----


 From this and other examples it seems that env uses for PATH  as 
separator, then preprends the current drive to all paths that begin with 
'\' (thus all of them), and ";" is treated as part of the path


I would like to use the PATH as-is in the invoked program, just like it 
is done for other variables, for example

----
cd /d
env -i OPATH='C:\Windows;C:\Windows\system32;' 
/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe
# in the powershell instance
echo $env:OPATH
C:\Windows;C:\Windows\system32;
----

in this case OPATH is forwarded as-is to powershell.exe.

I understand that PATH is special, that for cygwin processes some 
transformation might be necessary.

But is there any way to achieve what I'm trying?

I search if there is maybe a separation option for telling env to use 
PATH as-is, but could not find none.


Best

Federico

-- 
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
