delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/01/13/12:05:02

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 50DH51DB2905403
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 50DH51DB2905403
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=XBGiZGAM
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FF0A3858CDB
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1736787899;
bh=lsL3geLZp862UcjqLoOrybRzmViFzxi9q+I/30ImukU=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=XBGiZGAMiEsJa3dxYClicHj+aCSprYR3L3HFjj48RBjX5jSF17b1f5N0Lp8I/8V8t
Yw/owKwCC33y5o5yCRB2pC8A0Zp8t3Hf8T6k4YcHI6dmxyQn/GYu+pS1lZWpRqXqN2
WAVNHQNEFhkT4D2c6ma2Ip4J8/6/v0mJV0SzBPkQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 105B23858D21
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 105B23858D21
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736787815; cv=none;
b=WEnRjmymfKoSNZmaLKDW7Ihg/KqxAJux4v5Lkb3bB/2gyGCQDJ0lVakUA6V452d/shgD1j/d6UVY2w8kSXOj1ZntYZ6lYrM1KdjfM3cyg25UID8A6Fv2UTfbuK23+pY/9XZH4VhNPe0puRmKIcGjftj2x4PKVsEA+XTwvph+RYM=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1736787815; c=relaxed/simple;
bh=nydq+jXkkO/nfTcBtqSoQxjohZHFuXk0WPfCS4BtRhQ=;
h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;
b=r/vDw/5OYqJRCjZSE4sAkc6NqKJiHyamEWa1X7nDLHcNCGFeYZAZN6t0ip/9ZKtDK+7BWuVGcfjPx7vO3CkBwREWiH4nMFGI3Ox1BcQ5/M3O90UkN1yPyrkHkonogIwbGzSS1QwOUROhbev4UJtqMj9EscMvYlJyxhqQ5qEmLWU=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 105B23858D21
Message-ID: <251f0ab7-aae1-4198-a863-fbbe64d0c702@kircheis.it>
Date: Mon, 13 Jan 2025 18:03:27 +0100
MIME-Version: 1.0
Subject: Re: env and PATH
To: cygwin AT cygwin DOT com
References: <77a3709d-ec4d-497b-bf6c-75f29dc8c992 AT kircheis DOT it>
<1756102695 DOT 20250104044139 AT yandex DOT ru>
<21a99c98-1a16-4ffb-97f4-fa9480f7b02d AT kircheis DOT it>
<383539154 DOT 20250104231316 AT yandex DOT ru>
<dfce0589-5f52-408c-a8f9-f42771c724a3 AT kircheis DOT it>
<123712861 DOT 20250109103130 AT yandex DOT ru>
<9375d5cd-792e-45f4-958b-40521d15afd5 AT kircheis DOT it>
<1056238423 DOT 20250113115946 AT yandex DOT ru>
In-Reply-To: <1056238423.20250113115946@yandex.ru>
X-BeenThere: cygwin AT cygwin DOT 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 AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Federico Kircheis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Federico Kircheis <federico AT kircheis DOT it>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

On 13/01/2025 09.59, Andrey Repin wrote:
> Greetings, Federico Kircheis!
> 
>> On 09/01/2025 08.31, Andrey Repin wrote:
>>> The apparent issue you are missing is that you are calling native app from
>>> Cygwin environment.
>>> Each have its own rules, and to have it working with minimal issues, you'd
>>> need to satisfy both sides.
>>> In specific case, PATH is a special environment variable for both sides, and
>>> you have to correctly translate it from one side to the other.
> 
>> What do you mean?
>> I'm perfectly aware that PATH is special, and why it is, I also wrote it in the first mail.
> 
> It is special TO BOTH SIDES. The "both" is the key word.
> 
>> I questioned the statement that the conversion is expected _because_ `env`
>> expects POSIX semantics and parsed my command according to that.
> 
> No, it is expected because of its meaning to both sides AND because env don't
> know, what kind of program it is running.

But I know that the program is a windows program, thus a setting for 
manually disabling the conversion made sense (at least in my head).

> Runtime knows, env does not. Runtime does conversion, not env.

Ah, ok I missed the part that the conversion is not done by env but 
somewhere else, thus a flag for env does might not make that much sense.

>> Since POSIX says nothing about the interaction of env and PATH,
> 
> Why it should? This is Cygwin specifics.
> 
>> and conversions are not described by the standard (as you confirmed), the
>> behavior is expected because of what cygwin does, not because of POSIX. (and
>> yes, I knew cygwin does the conversion from cygwin PATH to Windows PATH, so
>> that was expected, I did not expect it to break a Windows PATH and to depend
>> on the current drive)
> 
> env don't expect Windows paths to begin with. And dependency on current drive
> is coincidental, since your paths, read as POSIX, were interpreted as relative.
> 
>> The main question of this thread was:
> 
>> "I noticed that PATH is converted, and cannot find a switch do disable this
>> conversion. Is it possible to define an environment and use it as is,
>> without having some implicit conversions?"
> 
>> I mean, there are other variables that have special meanings; all those that define a path.
>> (Examples would be HOME, XDG_CACHE_HOME, XDG_DATA_HOME, ...)
> 
> Special to both sides?
> While HOME and TMP do have a meaning to both sides (though, HOME is
> questionable), XDG_* ones are purely *NIX specific.

XDG_* are not purely unix specific; they are just environment variables.
For example, I actually expect a multiplatform programs that respect 
XDG_* on a Linux machine to respect it also on Windows.
Why should a program that supports XDG_* environment variables go out of 
it's way and explicitly ignore them?

>> The answer seems to be no (which was what I feared).
> 
>> Thus special casing for some environment variables is necessary as there is no such switch.
>> I saw PATH as particularly problematic because I was not aware of the option --path of cygpath.
> 
>>> I provided a wrapper script I use myself, you could add any massaging to it
>>> that you feel necessary. Like `unset TERM` or PATH modifications.
> 
>> Attachment seems to be missing,
> 
> Was not an attachment. (The list is not very tolerant to those.)

Ah sorry, I thought you provided a wrapper script as attachment, and 
could not find it.

>> but I think unsetting environment variables
>> one by one, changing existing, and adding the missing, is too error-prone.
>> Defining a "clean" environment once seems to have less chances to have some errors.
> 
> That's up to you.
> I have more intricate wrappers than this one. Just didn't want to flood the
> list.


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019