X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; q=dns; s=default; b=tI kg56zuO+N1SvvPh1X8iuFMhHE4l/X0dcjhaaylPvRrHzHhaWprz4FM8QjUQGZIRu kB0QP6rdtj9Pn4g5YzfkJ9xljNIVVyIkGbDSwyYdj5RacXlTVdX1uuU+CILiXhEi ge1cueDob6/xGKPpsWJGhAclpPZ8fy77E2oSSwdgA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; s=default; bh=wdFFXxgG AhkLUHRtQWnjUq3Vo68=; b=fwufgXSS6QqE60BCdaSTN5warGxjju29/1wXTZOh DpDv6mYxl3yzj/bNoIMvPfO7kwxiaK+dDpdaiOReb4bgeBce0/qVYXavHTB49yo2 Bnr58CS+SKaasYQ2gdZNArMya6gWZL+a5/Yq5fAwRsutzy+6/gPkbl/taCxoW11S VdM= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f41.google.com MIME-Version: 1.0 X-Received: by 10.152.42.129 with SMTP id o1mr5057333lal.19.1391682099631; Thu, 06 Feb 2014 02:21:39 -0800 (PST) In-Reply-To: References: Date: Thu, 6 Feb 2014 11:21:39 +0100 Message-ID: Subject: Re: $PATH contains dot but unclear where it comes from From: Robert Klemme To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes On Thu, Feb 6, 2014 at 10:14 AM, Csaba Raduly wrote: > Hi Robert, > > On Thu, Feb 6, 2014 at 10:01 AM, Robert Klemme wrote: >> Hi, >> >> in cygwin64 on Win 7 64 bit I find "." in $PATH: >> >> $ echo "$PATH" | tr : \\n | egrep '^\.$' >> . >> >> However, I was not able to detect where this came from. It's neither >> in the Windows system environment variables nor in the user >> environment variables - as you can also see on a cmd prompt: > > Windows always looks into the current directory when searching for > programs, so '.' is usually not in the Winows version of PATH (which > Cygwin imports). I know. But this is completely irrelevant here as I am trying to determine how the dot appeared in $PATH. > Almost certainly, the dot was put into the PATH by one of the Bash > initialization files. Here are some off the top of my head (`info > bash` , 6.2 Bash startup files, has the complete list). > > /etc/profile > /etc/bash.bashrc > ~/.bash_profile > ~/.profile > ~/.bashrc Apparently you did not really read my last email. > You can try running > > bash -x --login > > This will spew the shell commands being executed while interpreting > the startup scripts (make sure you have a large scroll-back buffer :) > Alternatively > > bash -x --login > bash_init.txt 2>&1 > > then type 'exit' blindly into the terminal (maybe 'tee' would work > better but I don't have access to Cygwin right now). > > If you saved to a file, you can grep for PATH and try to identify > which initialization file put the dot in. 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. Cheers 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