delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/12/29/08:59:16

X-Spam-Check-By: sourceware.org
Message-ID: <BAY17-F1388430B27DEDFA01BBEE5DC290@phx.gbl>
X-Sender: stantheman0000 AT hotmail DOT com
In-Reply-To: <31DDB7BE4BF41D4888D41709C476B6570246A827@NIHCESMLBX5.nih.gov>
From: "Stan Tsu" <stantheman0000 AT hotmail DOT com>
To: BBuchbinder AT niaid DOT nih DOT gov, cygwin AT cygwin DOT com, ericblake AT comcast DOT net
Subject: RE: basename(1) defect
Date: Thu, 29 Dec 2005 05:59:07 -0800
Mime-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

Thanks.  The echo works. I haven't verified whether the latest basename(1)
behaves in the same way because I've run across a bigger problem.

Has anyone seem severe performance degradation running Cygwin on
WinME systems?  I've seen my system just get slower and slower over
the past several months. Cygwin ops that took a few seconds to run
now are running into the minutes.  Are there tools I can run to see what's
taking so long?  I've looked at the WinME side and I don't see anything
obviously wrong (SYSMON says resources okay, no viruses, defragged etc).
Any thoughts?  Help!

Stan


>From: "Buchbinder, Barry (NIH/NIAID)" <BBuchbinder AT niaid DOT nih DOT gov>
>To: <cygwin AT cygwin DOT com>
>CC: "Stan Tsu" <stantheman0000 AT hotmail DOT com>
>Subject: RE: basename(1) defect
>Date: Fri, 25 Nov 2005 08:33:50 -0500
>
>ericblake AT comcast DOT net wrote:
> >>> This is a bug with basename 5.3.0 found in the latest Cygwin
> >>> 1.5.15.1.
> >
> > Not a bug.
> >
> >>
> >> 1.5.15 was three releases ago, it's most certainly not the latest.
> >> But that's not really relevant to your question, I don't think.
> >>
> >>> $ basename NA A
> >>> N
> >>> $ basename N/A A
> >>> A                           <====== should return 'N/'
> >
> > POSIX requires that basename return everything beyond the final slash
> > onwards, minus a partial suffix. The output you got is REQUIRED by
> > basename (beyond the final suffix is "A", and "A" is a complete match
> > rather than a partial suffix of "A", so the result must be "A"), and
> > any other behavior from an older version of basename would be the
> > bug, not the current behavior of either basename-5.3.0 or
> > basename-5.93.
> >
> >>>
> >>> Even with quoting:
> >>>
> >>> $ basename 'NA' A
> >>> N
> >>> $ basename 'N/A' A
> >>> A                           <====== should return 'N/'
> >
> > Quoting makes no difference - the shell strips quotes before passing
> > the arguments to /bin/basename.
> >
> >>
> >> If you just want to remove a trailing string I suggest you just use
> >> bash's built in parameter expansion:
> >>
> >> $ FCF="N/A"; Z=${FCF:(-1)}; echo ${FCF%$Z}
> >
> > This could also be done by /bin/expr (if you like coreutils), or even
> > with awk, sed, or perl.  But Brian is correct, shell parameter
> > expansion is the most efficient way to do string parsing, as it does
> > not spawn any external processes.
> >
> > --
> > Eric Blake
> > volunteer cygwin bash/coreutils maintainer
>
>Maybe you really want dirname.
>
>/c> dirname N/A
>N
>/c> echo $(dirname N/A)/
>N/

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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