delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/09/18/13:20:55

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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=kCWyflN87HPOHWVw74uz9uhZ+xxQqgMpW2TdhbC9YIP
Okc3hKtijnZW2n8Z9/ceYNsuPM5jb5cMFLhjt48uV4zfRfouvYHKqwwzFUF3DR6a
Wb8OHXJi77FBhcnb6KKPqhRg4W4SBx//VrROWLeuFv9dfViSh77ZburN4Ocl6Ggs
=
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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=HAQpL7C5LcFlbGtdC60PuB39WJo=; b=XHZxAygqtS7fSsptS
bwBepmJlKYGr4Ovk36g2Br/L92Ibr8Zi5nqk7TrsJnC6yb8eTS5AewcHmvXjDLAD
YLzpPzDVz9GVqPQBUEH+lSEAT8IzOpbIpzNHxyU/d4txwfBEL5uljDZZBTFc9HBW
NL3QGLwqZn0gORUEjw14jK+/TE=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL,BAYES_00,HELO_MISC_IP,KHOP_DYNAMIC,KHOP_THREADED,RCVD_IN_PBL,RCVD_IN_SORBS_DUL,RDNS_DYNAMIC,TVD_RCVD_IP autolearn=no version=3.3.2
X-HELO: konqorde.nl
Message-ID: <5239E0D8.7080703@mailme.ath.cx>
Date: Wed, 18 Sep 2013 19:20:24 +0200
From: bartels <bartels AT mailme DOT ath DOT cx>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130704 Icedove/17.0.7
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cygpath -m behaviour change
References: <CAF+hkWpba76MxiLzbcfUD=bHs=N=Xbti7vN4qLw7H2BWtWYQYw AT mail DOT gmail DOT com>
In-Reply-To: <CAF+hkWpba76MxiLzbcfUD=bHs=N=Xbti7vN4qLw7H2BWtWYQYw@mail.gmail.com>
X-IsSubscribed: yes

On 09/18/2013 04:34 PM, David Griffiths wrote:
> Hi, the script is attempting to determine the directory in which it
> exists, so CURRENT_DIR is a bit misleading. This is so that it can
> access other files in the same package relative to it (quite a common
> technique I think).
>
> Might be helpful to have some examples:
>
> /home/dgriff> mkdir test
> /home/dgriff> cd test
> /home/dgriff/test> cygpath -m "file\.."
> ./
> /home/dgriff/test> cygpath -m "file/.."
> cygpath: error converting "file/.." - No such file or directory
> /home/dgriff/test> cygpath -m "file\..\.."
> C:/cygwin/home/dgriff/
> /home/dgriff/test> cygpath -m "file/../.."
> cygpath: error converting "file/../.." - No such file or directory
> /home/dgriff/test> touch file
> /home/dgriff/test> cygpath -m "file/../.."
> cygpath: error converting "file/../.." - No such file or directory
> /home/dgriff/test> cygpath -m "file\..\.."
> C:/cygwin/home/dgriff/
> /home/dgriff/test> mkdir dir
> /home/dgriff/test> cygpath -m "dir/../.."
> C:/cygwin/home/dgriff/
>
> Note that the backslash variant always works and all of these used to
> work under previous levels of cygwin.

Conceptually, I have always considered relative paths to be relative to a directory.
Your one liners are creating a path relative to a file.

I think that approach is flawed and there is nothing wrong in the way cygpath works now.
Yesterday's cygpath behaviour was probably not intentional.

We have utilities like dirname and realpath available to help out.

Just my  thoughts . . .

- Bartels


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019