delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 74D31383F87D |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1589133142; | |
bh=oGbOd5tIWsKiNj1EtMhPtvqiaWAojXgaHHvueqwF6Uw=; | |
h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: | |
From; | |
b=sNTUzdle0mxtfClz1h6fg+fX0FAbLhn7MNi/frmY/XyoPJhUYQABvOw3XffAuwAOE | |
oNU1oFblJsKb5sKFmsx7mbQLCj9GvItNw8kr4ChWB/Ev7YxXRV77IhnhSNt5Q9esHf | |
iKut/38DkaGHx7FAQKbB2dQyhB9MkPHIRoVqo5Tg= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.3.2 sourceware.org 6A840386F80C |
X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
d=1e100.net; s=20161025; | |
h=x-gm-message-state:mime-version:references:in-reply-to:from:date | |
:message-id:subject:to; | |
bh=VWLt80i+36l4//TemN5qvMToh+QmxiGea0V6kUNQMlc=; | |
b=c/dv7/JoCqJo+UxaPKFHI8UK1KewBcdBc2+sQcJxmif4smDLc+Jt0B4VliFr0EK4IH | |
Vtf1LWEItMr/mvtOG3homs92F05myz4DNzbKbknKwcs8gelDvjLjqaHPayEno3PfsiIM | |
Wyqfasc/oRm6JaCVGQVVaLQn9P6QipJzoDpmcEFujJzU3OAtdZJuGAGWVZn7Yh0qXgaL | |
orlLRuxncfQbiAEBqFTBX+h2AwDtqZnTW8+LPDEIR97qWnWFuy8AtpD+Dph6uCDnElk1 | |
D8oeX3eS8kRztiSyQADp/8zGTdJUdx3hkGeKP/oHHwK+14zU8fCcXjO2zoUWnyAeH4LL | |
CPQw== | |
X-Gm-Message-State: | AGi0Pua6RObZwsEzJdFI1gv0lektHC/uiZ3EbRxj0oUF6K0uGyaxd+7X |
euAwPyq2ChCs61gPdO0W9GpX4rhGmIcwmrAhqqsSyaGbU28= | |
X-Google-Smtp-Source: | APiQypI4q5BcbyyM71/cREdP6BZJVMawhL6PH4+eJtc9jU+jBEtpdmpmto/VLvl10M881ewz5MNUjpAaChtXvQZqGsk= |
X-Received: | by 2002:a5e:9904:: with SMTP id t4mr4351250ioj.59.1589133137562; |
Sun, 10 May 2020 10:52:17 -0700 (PDT) | |
MIME-Version: | 1.0 |
References: | <CAAXzdLX9-nhXdUV8s2XoHAjOaL=KQyGV7v473uU+MudD620PtA AT mail DOT gmail DOT com> |
In-Reply-To: | <CAAXzdLX9-nhXdUV8s2XoHAjOaL=KQyGV7v473uU+MudD620PtA@mail.gmail.com> |
Date: | Sun, 10 May 2020 11:52:05 -0600 |
Message-ID: | <CAJ1FpuMfB4tNjeFcApewe7=zjmG_j3_5Dt5KV_AfEZYj1MMMhA@mail.gmail.com> |
Subject: | Re: Cygwin convert environment paths |
To: | cygwin <cygwin AT cygwin DOT com> |
X-Spam-Status: | No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, |
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, | |
HK_RANDOM_ENVFROM, HK_RANDOM_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, | |
SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 | |
X-Spam-Checker-Version: | SpamAssassin 3.4.2 (2018-09-13) on |
server2.sourceware.org | |
X-Content-Filtered-By: | Mailman/MimeDel 2.1.29 |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.29 |
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: | <http://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
From: | Doug Henderson via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | Doug Henderson <djndnbvg AT gmail DOT com> |
Sender: | "Cygwin" <cygwin-bounces AT cygwin DOT com> |
On Sun, 10 May 2020 at 06:46, Steven Penny via Cygwin <> wrote: > <snip> > That Cygwin does convert some environment variables, from Windows format to > Unix format. For example HOME and TMP. But for me at least, are some > important > omissions. > <snip> > In general, converting environment variable owned by Windows to cygwin format is a very bad idea. These are the variables that are present in cmd.exe in a vanilla Windows install. The only exception is the PATH variable. Personally, I always set CYGWIN_NOWINPATH=1 in the system environment variables to avoid accidentally calling a windows program while in cygwin. Every time I want to call a windows program from cygwin, I explicitly use its full path. Or I have create and use a shell alias that contains that full path. There is no problem with HOME and TMP (and a few others like TEMP, BROWSER, EDITOR, INFOPATH, PWD, SHELL), because these are not normally set in the Windows environment, or during the execution of cmd.exe. (I can't comment on powershell, as I don't use it.) I experimented with using cygpath to pre-convert several variables that have windows paths, or windows path lists in order to interchangeably run the cygwin version and a windows version of the same application, and to spawn windows programs from cygwin programs and cygwin programs from windows programs. I failed to create an environment that worked for both types of programs at the same time. What I found to partially work for interchangeability was to wrap the cygwin program in a bash script to perform environment conversions, This failed, though, when the cygwin program spawned a windows program which, of course, expected windows paths and path lists in its environment. I also tried wrapping the windows programs with similar conversion, An alternate approach, that worked for my own cygwin code was to create variables like CYG_HOMEDRIVE, or WIN_HOME. But this introduces a different set of problems. I also tried a couple of mingw64 installations: the standard one, and the one packaged with Git for Windows. Programs from those projects tended to work in the windows environment, but allowed you to use linux style file names directly. I did not try mixing cygwin and mingg64 programs. My conclusion was that there is no universal way to make unmodified programs work in the alternate environment. In the OP's specific case of using HOMEDRIVE, he must accept that this is a variable "owned" by windows, and thus not found in the linux environment. Any code that is meant to execute in both cygwin and linux must have code paths for each. And a cygwin program that wants to use a Windows variable, must perform its own conversions, either manually or using cygpath. As I understand it, the cygpath program is a thin wrapper over a library call, so a CFFI (C Foreign Function Interface) might work. HTH Doug -- Doug Henderson, Calgary, Alberta, Canada - from gmail.com -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |