delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/09/16/11:12:50

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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=ShsRw2FA+daL5K7PzgwkMdhsj6EW9NxmB+lbfgbUxVzDsufZQspku
RaTJ6wFW8RnxP7LDCQ0x0wP1U2mXP7v9YlZ8UCyjY3O8gXKPxEDk7jIsKq7c4TyX
7NmtnQZ/kHDgvpykGNOyIweHvGOm7w36zOKrkTOb/LjQXzw5mnwQa8=
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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=LafpoNbn6LnccaxLVjs2x7HL0xA=; b=WyO83fBkmU55LHH5NMHEJfu5vFIL
PAH5VrgSCeBAkA9G8yiZdqmVuUhseP0qw8wlT2Ows4mGKc3oltHx7dGOpuQSaBEF
1IRiabFjN0v9+ILcEZG23qjyF5OUfGnAKvbVB71XboQCqc5DiCoZ5BV4oGisXzTB
NM2FsCo6O1kJHyg=
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: Yes, score=5.3 required=5.0 tests=AWL,BAYES_50,FSL_HELO_NON_FQDN_1,HELO_LOCALHOST,RCVD_IN_PBL,RCVD_IN_RP_RNBL,RCVD_IN_SORBS_DUL,RP_MATCHES_RCVD autolearn=no version=3.3.2
X-HELO: mho-01-ewr.mailhop.org
X-Mail-Handler: Dyn Standard SMTP by Dyn
X-Report-Abuse-To: abuse AT dyndns DOT com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information)
X-MHO-User: U2FsdGVkX19vV6/H0ei30r3cUqwVAPfY
Date: Mon, 16 Sep 2013 11:12:29 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygpath -m behaviour change
Message-ID: <20130916151229.GA4411@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CAF+hkWo0jXKKLM8pS8gZLG0rak+wcLpWJdS2He2_=MxYb0gpYw AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAF+hkWo0jXKKLM8pS8gZLG0rak+wcLpWJdS2He2_=MxYb0gpYw@mail.gmail.com>
User-Agent: Mutt/1.5.20 (2009-06-14)

On Mon, Sep 16, 2013 at 10:56:37AM +0100, David Griffiths wrote:
>> Yes, that's exactly right, assuming that 'boo' doesn't exist.
>
>Hi, it happens even if boo does exist.

Not for me.

% mkdir /boo
norton[~]
$ ls /boo/..
bin           cygwin               dev   localhome     proc   usr
boo           cygwin.bat           etc   netrel        sbin   var
cygdrive      cygwin.ico           home  netrel.build  share
cygmount.bat  Cygwin-Terminal.ico  lib   netrel.inst   tmp
norton[~]
% cygpath -m /boo/..
D:/cygwin

It doesn't work if boo is not a directory but that is as expected.

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

nonexistent or non-directory.  We've fixed a bug in later versions of Cygwin
which this script relied on.

It could be rewritten as:

CURRENT_DIR=$(cygpath -ma "$(dirname $0)")

(assuming that CURRENT_DIR isn't really trying to find the cwd, in which
case the script is just wrong to begin with)

cgf

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