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: bash adds dot to $PATH (was: Re: $PATH contains dot but unclear where it comes from)


On Tue, Mar 25, 2014 at 4:53 PM, Warren Young <warren@etr-usa.com> wrote:
> 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

You need at least "-c" before exit.

> 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 did that a while ago: http://cygwin.com/ml/cygwin/2014-02/msg00091.html

C:\Users\rklemme>C:\cygwin64\bin\bash.exe --norc --noprofile -x -c exit
+ exit

C:\Users\rklemme>C:\cygwin64\bin\bash.exe -x -c exit
+ exit

Now:

C:\Users\rklemme>C:\cygwin64\bin\bash.exe -i -x -c exit >bash-log.txt 2>&1

First line that contains PATH looks like this:

++ PATH='/cygdrive/c/PROGRAM FILES (X86)/NVIDIA
CORPORATION/PHYSX/COMMON:/cygdrive/c/PROGRAM FILES (X86)/INTEL/ICLS
CLIENT:/cygdrive/c/PROGRAM FILES/INTEL/ICLS CLIENT:/cygdrive/c/PROGRAM
FILES (X86)/RSA SECURID TOKEN COMMON:/cygdrive/c/PROGRAM FILES/COMMON
FILES/MICROSOFT SHARED/WINDOWS LIVE:/cygdrive/c/PROGRAM FILES
(X86)/COMMON FILES/MICROSOFT SHARED/WINDOWS
LIVE:/cygdrive/c/Windows/SYSTEM32:/cygdrive/c/Windows:/cygdrive/c/Windows/SYSTEM32/WBEM:/cygdrive/c/Windows/SYSTEM32/WINDOWSPOWERSHELL/V1.0:/cygdrive/c/PROGRAM
FILES/DELL/DELL DATA PROTECTION/ACCESS/ADVANCED/WAVE/GEMALTO/ACCESS
CLIENT/V5:/cygdrive/c/PROGRAM FILES (X86)/NTRU CRYPTOSYSTEMS/NTRU TCG
SOFTWARE STACK/BIN:/cygdrive/c/PROGRAM FILES/NTRU CRYPTOSYSTEMS/NTRU
TCG SOFTWARE STACK/BIN:/cygdrive/c/PROGRAM FILES (X86)/WINDOWS
LIVE/SHARED:/cygdrive/c/PROGRAM FILES/INTEL/INTEL(R) MANAGEMENT ENGINE
COMPONENTS/DAL:/cygdrive/c/PROGRAM FILES/INTEL/INTEL(R) MANAGEMENT
ENGINE COMPONENTS/IPT:/cygdrive/c/PROGRAM FILES (X86)/INTEL/INTEL(R)
MANAGEMENT ENGINE COMPONENTS/DAL:/cygdrive/c/PROGRAM FILES
(X86)/INTEL/INTEL(R) MANAGEMENT ENGINE
COMPONENTS/IPT:/cygdrive/c/Program Files/WIDCOMM/Bluetooth
Software:/cygdrive/c/Program Files/WIDCOMM/Bluetooth
Software/syswow64:/cygdrive/c/Program Files (x86)/Intel/OpenCL
SDK/2.0/bin/x86:/cygdrive/c/Program Files (x86)/Intel/OpenCL
SDK/2.0/bin/x64:/cygdrive/c/Program Files/Intel/Intel(R) Management
Engine Components/DAL:/cygdrive/c/Program Files/Intel/Intel(R)
Management Engine Components/IPT:/cygdrive/c/Program Files
(x86)/Intel/Intel(R) Management Engine
Components/DAL:/cygdrive/c/Program Files (x86)/Intel/Intel(R)
Management Engine Components/IPT:/cygdrive/c/Program
Files/Intel/WiFi/bin:/cygdrive/c/Program Files/Common
Files/Intel/WirelessCommon:/cygdrive/c/Users/rklemme/Applications/SysinternalsSuite:.:/sbin:/usr/sbin:/usr/local/sbin'

You can spot the dot after "SysinternalsSuite".

Now a login shell

C:\Users\rklemme>C:\cygwin64\bin\bash.exe -i -l -x -c exit >bash-log.txt 2>&1

The very first line in the file is the first one that contains PATH
and looks like this:

+ PATH='/usr/local/bin:/usr/bin:/cygdrive/c/PROGRAM FILES (X86)/NVIDIA
CORPORATION/PHYSX/COMMON:/cygdrive/c/PROGRAM FILES (X86)/INTEL/ICLS
CLIENT:/cygdrive/c/PROGRAM FILES/INTEL/ICLS CLIENT:/cygdrive/c/PROGRAM
FILES (X86)/RSA SECURID TOKEN COMMON:/cygdrive/c/PROGRAM FILES/COMMON
FILES/MICROSOFT SHARED/WINDOWS LIVE:/cygdrive/c/PROGRAM FILES
(X86)/COMMON FILES/MICROSOFT SHARED/WINDOWS
LIVE:/cygdrive/c/Windows/SYSTEM32:/cygdrive/c/Windows:/cygdrive/c/Windows/SYSTEM32/WBEM:/cygdrive/c/Windows/SYSTEM32/WINDOWSPOWERSHELL/V1.0:/cygdrive/c/PROGRAM
FILES/DELL/DELL DATA PROTECTION/ACCESS/ADVANCED/WAVE/GEMALTO/ACCESS
CLIENT/V5:/cygdrive/c/PROGRAM FILES (X86)/NTRU CRYPTOSYSTEMS/NTRU TCG
SOFTWARE STACK/BIN:/cygdrive/c/PROGRAM FILES/NTRU CRYPTOSYSTEMS/NTRU
TCG SOFTWARE STACK/BIN:/cygdrive/c/PROGRAM FILES (X86)/WINDOWS
LIVE/SHARED:/cygdrive/c/PROGRAM FILES/INTEL/INTEL(R) MANAGEMENT ENGINE
COMPONENTS/DAL:/cygdrive/c/PROGRAM FILES/INTEL/INTEL(R) MANAGEMENT
ENGINE COMPONENTS/IPT:/cygdrive/c/PROGRAM FILES (X86)/INTEL/INTEL(R)
MANAGEMENT ENGINE COMPONENTS/DAL:/cygdrive/c/PROGRAM FILES
(X86)/INTEL/INTEL(R) MANAGEMENT ENGINE
COMPONENTS/IPT:/cygdrive/c/Program Files/WIDCOMM/Bluetooth
Software:/cygdrive/c/Program Files/WIDCOMM/Bluetooth
Software/syswow64:/cygdrive/c/Program Files (x86)/Intel/OpenCL
SDK/2.0/bin/x86:/cygdrive/c/Program Files (x86)/Intel/OpenCL
SDK/2.0/bin/x64:/cygdrive/c/Program Files/Intel/Intel(R) Management
Engine Components/DAL:/cygdrive/c/Program Files/Intel/Intel(R)
Management Engine Components/IPT:/cygdrive/c/Program Files
(x86)/Intel/Intel(R) Management Engine
Components/DAL:/cygdrive/c/Program Files (x86)/Intel/Intel(R)
Management Engine Components/IPT:/cygdrive/c/Program
Files/Intel/WiFi/bin:/cygdrive/c/Program Files/Common
Files/Intel/WirelessCommon:/cygdrive/c/Users/rklemme/Applications/SysinternalsSuite:.'

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

Exactly. First, I run it from bash, then I run it directly. There, no
dot appears. Same for other shells. Please see the earlier thread.

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

No. That does not exist. See above.

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

Yes.

C:\Users\rklemme>dir C:\cygwin
 Datenträger in Laufwerk C: ist OS
 Volumeseriennummer: 78DB-9518

 Verzeichnis von C:\

Datei nicht gefunden

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

No, it's not screwed up. That is simply the effect of running cygcheck
from a cmd prompt and not from mintty, i.e. bash or other shell prompt
where the environment is set up properly. I've attached output of
cygcheck -s -v -r when run from a sh prompt. sh was started as a login
shell:

c:\cygwin64\bin\sh -l -i

> 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'm sorry but you are chasing shadows here. To reiterate what I wrote
earlier: bash is the only Cygwin shell that exhibits the phenomenon,
all others I have tested do not. So it appears to be somehow related
to bash. OTOH other Windows processes also have the dot in the
environment despite it's nowhere defined in Windows environment
settings. So it appears to be something caused by Windows (or any
service) interacting with processes that share a particular property
which I haven't found yet.

Kind regards

robert

-- 
[guy, jim].each {|him| remember.him do |as, often| as.you_can - without end}
http://blog.rubybestpractices.com/

Attachment: cygcheck.out
Description: Binary data

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