X-Recipient: archive-cygwin@delorie.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:from:date
	:message-id:subject:to:content-type; q=dns; s=default; b=c7SZMTO
	lKeRXTS8+Obcb5rfdsaFmYadiuD98ocDY+7Na5YkW9mxZndKTi6/1BCB0eb9a6eQ
	ibAHwGa2g+uCF07h4wYPh9SCG7sNDE9Olq4nbsyxHHH3E35Qm3NfrVdCDUpCOGQr
	OCtBZ9Kh8pc9ObxIB2NKCWEI1seFWWrc/r4A=
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:from:date
	:message-id:subject:to:content-type; s=default; bh=hRaJd5P6Dwurm
	n7W71Z0ZpDw2r8=; b=vTLnLabLyHrGLXhoXU5G0Hs7zk85Su3X1B+Y6YnaeDVF9
	AilSKiRiw5WcNQVKZrD1g53Z71VddIbY9T62jKb7tFNsraPchoucN5YmmRmcZIo/
	/0tPEa+WJkIxVCEuD6fRji3tMvuqAWnQUaNdvJo+Y/fsTdkh0vC0+ZpQ7kjeu0=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL,BAYES_05,KHOP_THREADED,RCVD_IN_PBL,RDNS_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2
X-HELO: mail-wi0-f182.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20130820;        h=x-gm-message-state:mime-version:sender:in-reply-to:references:from         :date:message-id:subject:to:content-type;        bh=D0rQ3R5oBMoDQ3gz4129lJyW3ZmRdLbRmoWvRUL9ghA=;        b=mcrDDnP4VB47wDCgmWwpOvmn4jtvx0Qw2lFzkLBC7XPAG4x9dmYiSrq2R+m75k5JiR         wJWS/xOQxnPFSPkj0nHwWswQLZGrdeqjz6rezVLo4WtMEqOtIQZhbRwQBSnfS29/+W30         JcsEnHsVhJDU/4N1X3hxT58pTXq3bIt1YrT7SGcALnLEZHQTtx3+Hvk525ZO3/wUIYbM         gN6v1AZfgcaCtAjZgbXWnK0A9LOyLJWxvURWqLeEDxPlznkckYtK1gfproAZqObBW0xC         AIO/XnhoU+6TAqgZBtwApg8BuRxrwOnRAtAkVKXW+OOCNTJY0lziKNbQ3ezR42bd1sX3         6AvA==
X-Gm-Message-State: ALoCoQm2KIN+o4DtLV5ypA73yeEnwotLpXUM6m4FmH39ooOhkqsuDmZGQg2PpGtvFIUthmW/kDyA
X-Received: by 10.195.13.164 with SMTP id ez4mr22642461wjd.11.1379338226039; Mon, 16 Sep 2013 06:30:26 -0700 (PDT)
MIME-Version: 1.0
In-Reply-To: <CAF+hkWo0jXKKLM8pS8gZLG0rak+wcLpWJdS2He2_=MxYb0gpYw@mail.gmail.com>
References: <CAF+hkWo0jXKKLM8pS8gZLG0rak+wcLpWJdS2He2_=MxYb0gpYw@mail.gmail.com>
From: Robert Pendell <shinji+cygwin@elite-systems.org>
Date: Mon, 16 Sep 2013 09:29:55 -0400
Message-ID: <CAAeCd-Pq=OOh1hHMT5g3wseqc8f-Wfjb4xX=2ZwOCFSUBQ_WgA@mail.gmail.com>
Subject: Re: cygpath -m behaviour change
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes

On Mon, Sep 16, 2013 at 5:56 AM, David Griffiths <> wrote:
>> Yes, that's exactly right, assuming that 'boo' doesn't exist.
>
> Hi, it happens even if boo does exist. To put it in context, the
> script in question was attempting to determine the current directory:
>
> CURRENT_DIR=$(cygpath -ma "${0}"/../)
>
> (I didn't write this script but I assume they did this for performance reasons.)
>
> But anyway, as you can see ${0} always exists.
>
> I looked at the other thread but don't see an immediate connection as
> that was checking for non-existing path members.
>
> Cheers,
>
> Dave
>

I have no idea why they are doing that.  ${0} always gives back the
name of the program you ran.  It is very common to use $0 in scripts
in order to refer to itself in text given back to the user.

If you need to get the current directory $PWD is always available and
you don't need to use your own variable for it. (just like in linux,
unix, and other similar environments following that they are not
exactly equal)

For a reference point I'll give you what cygwin gave me when I ran the
command as you showed it.

Robert@Shinji-PC ~
$ cygpath -ma ${0}/../
cygpath: unknown option -- b
Try `cygpath --help' for more information.

That would be expected because for me ${0} (during echo) gave back
-bash as the output and cygpath will interpret that as additional
options.

I also checked to make sure cygpath is working as expected (at least
the way I think it should be working) and it tested ok.

Robert@Shinji-PC ~
$ uname -a
CYGWIN_NT-6.2-WOW64 Shinji-PC 1.7.25(0.270/5/3) 2013-08-31 20:39 i686 Cygwin

Robert@Shinji-PC ~
$ mkdir test

Robert@Shinji-PC ~
$ cygpath -m test/..
./

Robert@Shinji-PC ~
$ rmdir test

Robert@Shinji-PC ~
$ cygpath -m test/..
cygpath: error converting "test/.." - No such file or directory

I did find another odd bit with cygpath though.  It seems that if you
have .. to start the path to check it will translate it no matter
what.  A bug maybe?

(STC)
Robert@Shinji-PC ~
$ ls ../
Robert

Robert@Shinji-PC ~
$ ls ../test
ls: cannot access ../test: No such file or directory

Robert@Shinji-PC ~
$ cygpath -ma ..
D:/cygwin/home

Robert@Shinji-PC ~
$ cygpath -ma ../test
D:/cygwin/home/test


Robert Pendell
A perfect world is one of chaos.

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

