$PATH contains dot but unclear where it comes from

Robert Klemme shortcutter@googlemail.com
Thu Feb 6 15:32:00 GMT 2014


On Thu, Feb 6, 2014 at 12:56 PM, Andrey Repin wrote:
> Greetings, Robert Klemme!

Hello Andrey!

>> I should have mentioned that I did just that - to no avail.
>
>> $ echo exit | bash --login -i -x 2>|log
>> $ egrep -n 'PATH=(.:|.*:\.($|:))' log | head
>> 1:+ PATH=/usr/local/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
>> 140:+++ PATH=/usr/local/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.:/sbin:/usr/sbin:/usr/local/sbin
>> 145:+++ PATH=/usr/local/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.:/sbin:/usr/sbin:/usr/local/sbin
>> 152:+++ PATH=/usr/local/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.:/sbin:/usr/sbin:/usr/local/sbin
>> 159:+++ PATH=/usr/local/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.:/sbin:/usr/sbin:/usr/local/sbin
>> 166:+++ PATH=/usr/local/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.:/sbin:/usr/sbin:/usr/local/sbin
>> 171:+++ PATH=/usr/local/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.:/sbin:/usr/sbin:/usr/local/sbin
>> 178:+++ PATH=/usr/local/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.:/sbin:/usr/sbin:/usr/local/sbin
>> 183:+++ PATH=/usr/local/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.:/sbin:/usr/sbin:/usr/local/sbin
>> 190:+++ PATH=/usr/local/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.:/sbin:/usr/sbin:/usr/local/sbin
>
>> Also manual inspection does not show any line where the dot is
>> introduced.  The first line with an assignment to PATH which contains
>> the dot in the trace output is this one in /etc/profile:
>
>> PATH="/usr/local/bin:/usr/bin:${PATH}"
>
>> In the trace (see above):
>
>> + PATH=/usr/local/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
>
>> As you can see the dot is already there.  It seems it appears
>> somewhere in the mintty launching process.
>
> This seems much like you have an imposter somewhere in your system.
> Please start cmd.exe alone, and do the following in order:

Good idea to do it in cmd.exe!

> echo %PATH% > "%USERPROFILE%/bash-startup.log"
> bash --login -x 2>&1 | tee -a "%USERPROFILE%/bash-startup.log"

Why use tee here?  I did this:

C:\Users\rklemme>path >log

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

> Then check the logfile for issues.

Same story.  These are the first lines of the log

$ head -10 log | cut -c 1-80
PATH=C:\PROGRAM FILES (X86)\NVIDIA CORPORATION\PHYSX\COMMON;C:\PROGRAM FILES (X8
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
+ PATH='/usr/local/bin:/usr/bin:/cygdrive/c/PROGRAM FILES (X86)/NVIDIA CORPORATI
+ MANPATH=/usr/local/man:/usr/share/man:/usr/man:
+ INFOPATH=/usr/local/info:/usr/share/info:/usr/info:
++ id -un
+ USER=rklemme
+ ORIGINAL_TMP=/cygdrive/c/Users/rklemme/AppData/Local/Temp
+ ORIGINAL_TEMP=/cygdrive/c/Users/rklemme/AppData/Local/Temp

The first line does not contain the dot.  The fourth line contains the
dot at the end:

$ sed -nre '4s#^(.{20}).*(.{80})$#\1...\2#p' log
+ PATH='/usr/local/b...Intel/WirelessCommon:/cygdrive/c/Users/rklemme/Applications/SysinternalsSuite:.'

Concluding from the context (following lines) this is, as written
before, this line from /etc/profile:

PATH="/usr/local/bin:/usr/bin:${PATH}"
MANPATH="/usr/local/man:/usr/share/man:/usr/man:${MANPATH}"
INFOPATH="/usr/local/info:/usr/share/info:/usr/info:${INFOPATH}"

There is clearly no dot there. It's a mystery.

Wait, I tested with strace:

C:\Users\rklemme>echo exit | c:\cygwin64\bin\strace.exe -f /bin/bash
--login -x -i >str 2>&1

I found
...
   36    6393 [main] bash 8028 getwinenv: can't set native for PATH=
since no environ yet
...
   12    7518 [main] bash 8028 mount_info::conv_to_posix_path:
conv_to_posix_path (C:\Users\rklemme\Applications\SysinternalsSuite,
keep-rel, no-add-slash)
   12    7530 [main] bash 8028 normalize_win32_path:
C:\Users\rklemme\Applications\SysinternalsSuite = normalize_win32_path
(C:\Users\rklemme\Applications\SysinternalsSuite)
   14    7544 [main] bash 8028 mount_info::conv_to_posix_path:
/cygdrive/c/Users/rklemme/Applications/SysinternalsSuite =
conv_to_posix_path (C:\Users\rklemme\Applications\SysinternalsSuite)
   14    7558 [main] bash 8028 mount_info::conv_to_posix_path:
conv_to_posix_path (., keep-rel, no-add-slash)
   12    7570 [main] bash 8028 mount_info::conv_to_posix_path: . =
conv_to_posix_path (.)
   12    7582 [main] bash 8028 __set_errno: ssize_t
env_PATH_to_posix(const void*, void*, size_t):3570 setting errno 36
...
   12   12308 [main] bash 8028 mount_info::conv_to_win32_path:
src_path /cygdrive/c/Users/rklemme/Applications/SysinternalsSuite, dst
C:\Users\rklemme\Applications\SysinternalsSuite, flags 0x4022, rc 0
   35   12343 [main] bash 8028 symlink_info::check: 0x0 = NtCreateFile
(\??\C:\Users\rklemme\Applications\SysinternalsSuite)
   18   12361 [main] bash 8028 symlink_info::check: not a symlink
   21   12382 [main] bash 8028 symlink_info::check: 0 =
symlink.check(C:\Users\rklemme\Applications\SysinternalsSuite,
0x228DC0) (0x804022)
   13   12395 [main] bash 8028 path_conv::check:
this->path(C:\Users\rklemme\Applications\SysinternalsSuite),
has_acls(1)
   14   12409 [main] bash 8028 normalize_posix_path: src .
   11   12420 [main] bash 8028 cwdstuff::get: posix /cygdrive/c/Users/rklemme
   12   12432 [main] bash 8028 cwdstuff::get:
(/cygdrive/c/Users/rklemme) = cwdstuff::get (0x600000010, 32768, 1,
0), errno 36
   13   12445 [main] bash 8028 normalize_posix_path:
/cygdrive/c/Users/rklemme/ = normalize_posix_path (.)
   11   12456 [main] bash 8028 mount_info::conv_to_win32_path:
conv_to_win32_path (/cygdrive/c/Users/rklemme)
   12   12468 [main] bash 8028 mount_info::cygdrive_win32_path: src
'/cygdrive/c/Users/rklemme', dst 'C:\Users\rklemme'
   12   12480 [main] bash 8028 set_flags: flags: binary (0x2)
   11   12491 [main] bash 8028 mount_info::conv_to_win32_path:
src_path /cygdrive/c/Users/rklemme, dst C:\Users\rklemme, flags
0x4022, rc 0
   33   12524 [main] bash 8028 symlink_info::check: 0x0 = NtCreateFile
(\??\C:\Users\rklemme)
   17   12541 [main] bash 8028 symlink_info::check: not a symlink
   20   12561 [main] bash 8028 symlink_info::check: 0 =
symlink.check(C:\Users\rklemme, 0x228DC0) (0x804022)
   13   12574 [main] bash 8028 path_conv::check:
this->path(C:\Users\rklemme), has_acls(1)
   33   12607 [main] bash 8028 cwdstuff::get: posix /cygdrive/c/Users/rklemme
   12   12619 [main] bash 8028 cwdstuff::get: (C:\Users\rklemme) =
cwdstuff::get (0x600058F70, 32768, 0, 0), errno 36
   35   12654 [main] bash 8028 win_env::add_cache: posix
/cygdrive/c/PROGRAM FILES
(X86)/NVIDIA...Common:/cygdrive/c/Users/rklemme/Applications/SysinternalsSuite:.
   22   12676 [main] bash 8028 win_env::add_cache: native
PATH=C:\PROGRAM FILES
(X86)\NVIDIA...Common;C:\Users\rklemme\Applications\SysinternalsSuite;.
   39   12715 [main] bash 8028 posify_maybe: env var converted to
PATH=/cygdrive/c/PROGRAM FILES
(X86)/NVIDIA...lessCommon:/cygdrive/c/Users/rklemme/Applications/SysinternalsSuite:.
   41   12756 [main] bash 8028 environ_init: 0x600069CD0:
PATH=/cygdrive/c/PROGRAM FILES
(X86)/NVIDIA...elessCommon:/cygdrive/c/Users/rklemme/Applications/SysinternalsSuite:.

(Few items replaced by "..." to avoid extremely long lines.)

Can anybody make sense of that?  I can share the complete log with
individuals if it helps.

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

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



More information about the Cygwin mailing list