delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/12/01/15:09:38

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4B1577F5.4000809@bopp.net>
Date: Tue, 01 Dec 2009 14:09:25 -0600
From: Jeremy Bopp <jeremy AT bopp DOT net>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: how to get the windows PATH env in cygwin
References: <8d7f7110911300444l7ab3c2c8l5ac1edf0097d2065 AT mail DOT gmail DOT com> <4B142061 DOT 6000200 AT cygwin DOT com> <8d7f7110911301717jbafbc2ci432817b1c713f1e6 AT mail DOT gmail DOT com> <20091201013022 DOT GA2336 AT KCJs-Computer> <4B147423 DOT 1050404 AT bopp DOT net> <20091201153816 DOT GA21362 AT win DOT tue DOT nl> <416096c60912010803o33bf4c7dgbca2178307c83bcc AT mail DOT gmail DOT com> <31b7d2790912011042k625d8adak88022ead8be9633d AT mail DOT gmail DOT com>
In-Reply-To: <31b7d2790912011042k625d8adak88022ead8be9633d@mail.gmail.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

DePriest, Jason R. wrote:
> On Tue, Dec 1, 2009 at 10:03 AM, Andy Koppe <> wrote:
>> 2009/12/1 Reinier Post:
>>>> If you want to see the Windows PATH setting unmolested by Cygwin, you
>>>> will either need to strip out the additions set by /etc/profile or avoid
>>>> running under an environment modified by /etc/profile.
>>> It doesn't add, actually - it replaces it.
>> You're wrong. The Cygwin DLL at startup translates the Windows PATH
>> variable. And this line in /etc/profile adds to it:
>>
>> PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH
>>
>>
> 
> This is completely and totally true.

I'm sorry, but it is not true.  Maybe there is a misunderstanding though.

> To verify it, all you have to do is open a bash prompt (Cygwin.bat,
> mintty, rxvt, whatever) and then launch a cmd.exe or powershell.
> 
> Check the path in the bash prompt and you will see the cygwin stuff at
> the beginning of it.

Yes, indeed you will see the Cygwin paths prepended to PATH as you say.
 Andy said this as well and even included the line from /etc/profile
which does this work when you run a login shell (i.e. bash --login under
rxvt or what-have-you).  However, since the remainder of PATH derives
from the Windows-native value of PATH (converted automatically by Cygwin
to POSIX-style), we're saying that the value of PATH was *modified*
rather than *replaced* entirely.  To say that PATH was entirely replaced
is to imply that the new value of PATH has no basis whatsoever in the
original value of PATH.

> Check the path in the cmd.exe or powershell prompt which was run
> *after* the bash script updated the path and you will see that it does
> *not* include the cygwin paths.
> 
> It doesn't override what you have set anywhere but in cygwin's magic space.

No one is arguing that Cygwin ever modifies PATH system-wide or for
anything aside from Cygwin programs.  In the base case, a Cygwin program
will see the value of PATH converted to POSIX-style.  If that same
Cygwin program is run from a login shell, it will see the PATH as
further modified by /etc/profile as Andy indicated.

Windows programs will only ever see a Windows-style PATH no matter what;
however, they WILL see the Cygwin paths converted to Windows-style and
prepended IF they were run from a login shell under Cygwin.

-Jeremy

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

- Raw text -


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