This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: /etc/profile: avoid multiple /usr/bin in PATH


On 4 September 2016 at 05:32, Achim Gratz wrote:
> Helmut Karlowski writes:
>> I set C:/cygwin/usr/bin in my windows-environment. Now /etc/profile
>> always adds /usr/bin to PATH resulting in /usr/bin being twice in my
>> cygwin-PATH.
>>
>> The attached patch fixes this.
>
> I've added the option to just use the already set-up PATH variable from
> Windows for this use case.  Set CYGWIN_USEWINPATH before starting up.
>

Please make sure that this version of cygwin.bat will work correctly
when CYGWIN_NOWINPATH=1 is set in the windows environment.

I use this to isolate my cygwin environment from random windows stuff.
When I need to execute windows executables, I wrap the call in a
script or alias that makes just enough of the window's path available
to let it work.

This makes it much safer when running multiple cygwins, intentionally
for 32bit and 64bit, or unintentionally as when running windows apps
that include a cygwin.dll, e.g. GitHub for Windows. Also it avoids
accidentally running non-cygwin versions of *nix programs such as can
happen when you have Gnu for Windows or MSYS in your windows path.

Note that CYGWIN_NOWINPATH is still undocumented, except in the email
archives. See, e.g.

    https://www.google.ca/search?q=CYGWIN_NOWINPATH+site:cygwin.com

CYGWIN_USEWINPATH is also undocumented, except in a non-cygwin.com
email archive.

Thanks,
Doug

-- 
Doug Henderson, Calgary, Alberta, Canada

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]