bash adds dot to $PATH (was: Re: $PATH contains dot but unclear where it comes from)

Warren Young
Tue Mar 25 16:23:00 GMT 2014

On 3/6/2014 05:29, Robert Klemme wrote:
> The phenomenon persists, for these executions:
> c:\cygwin64\bin\bash.exe --norc --noprofile -i
> c:\cygwin64\bin\bash.exe --norc --noprofile
> c:\cygwin64\bin\bash.exe -i -l
> Actually I could not find a commandline with bash that did not lead to
> the dot appended.

Try something a bit different for me, please.  At a cmd.exe prompt:

     c:\cygwin64\bin\bash -x exit > Links\Desktop\bashlog.txt 2>&1

Examine that log file carefully, or attach it to a reply here if you 
don't mind sharing its potentially sensitive contents.  I think you'll 
find -- among the hundreds of commands that get logged by bash -x -- 
that . is explicitly being added somewhere along the way.

> I created the attached cygcheck.out

Did you notice that there is no dot in the path in either path dump in 
the first part of that file?  Presumably you ran cygcheck under Bash, 
which inherited the PATH that Bash had.

Unless this is some weird feature of Bash that you've turned on, the 
only way I can think of that this can happen is that you have a shell 
startup script that is appending . to the path without exporting it.

You could confirm with:

     $ export PATH
     $ cygcheck -srv > x

Then look at 'x' and see if the path dumps at the start of that file now 
contain the dot.

Other oddities in that cygcheck output:

> Cygwin installations found in the registry:
>   System: Key: e022582115c10879 Path: C:\cygwin64
>   User:   Key: c5e39b7a9d22bafb Path: C:\cygwin (ORPHANED)
>   User:   Key: e022582115c10879 Path: c:\cygwin64

Is c:\cygwin entirely removed?

> c:\cygwin64      /          system  binary,auto
> c:\cygwin64\bin  /usr/bin   system  binary,auto
> c:\cygwin64\lib  /usr/lib   system  binary,auto
> cygdrive prefix  /cygdrive  user    binary,posix=0,auto
> Not Found: awk
> Not Found: bash
> Not Found: cat
> Not Found: cp
> Not Found: cpp (good!)
> Not Found: crontab
> Found: C:\Windows\SYSTEM32\find.exe
> Not Found: gcc
> Not Found: gdb
> Not Found: grep
> Not Found: kill
> Not Found: ld
> Not Found: ls
> Not Found: make
> Not Found: mv
> Not Found: patch
> Not Found: perl
> Not Found: rm
> Not Found: sed
> Not Found: ssh
> Not Found: sh
> Not Found: tar
> Not Found: test
> Not Found: vi
> Not Found: vim
> Warning: cygwin1.dll not found on your path

This system is fairly screwed up.  This tells me that Cygwin's bin is 
mounted on /usr/bin, yet above we saw that c:\cygwin64\bin isn't in your 
PATH.  I'm thinking someone has monkeyed with your shell startup scripts.

I suspect both of these problems are related.  The same thing that has 
added . to your PATH has removed Cygwin's bin from it.

I don't see how you got cygcheck to run at all.

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list