From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id B1D16BC6B for ; Wed, 5 Sep 2007 12:41:29 +0200 (CEST) Received: from furbychan.cocan.org (furbychan.cocan.org [80.68.91.176]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l85AfTD8010109 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Wed, 5 Sep 2007 12:41:29 +0200 Received: from rich by furbychan.cocan.org with local (Exim 3.35 #1 (Debian)) id 1ISsK8-0007ON-00 for ; Wed, 05 Sep 2007 11:41:28 +0100 Date: Wed, 5 Sep 2007 11:41:28 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] Bug in Filename.basename? Message-ID: <20070905104127.GB24323@furbychan.cocan.org> References: <20070905184538.88ada4e8.mle+ocaml@mega-nerd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070905184538.88ada4e8.mle+ocaml@mega-nerd.com> User-Agent: Mutt/1.5.9i From: Richard Jones X-Miltered: at discorde with ID 46DE87D9.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bug:01 basename:01 bug:01 basename:01 val:01 val:01 ocaml:01 wrote:01 caml-list:01 caml:02 objective:02 string:02 string:02 gnu:03 let:03 On Wed, Sep 05, 2007 at 06:45:38PM +1000, Erik de Castro Lopo wrote: > Hi all, > > I think I have found a bug in the above function. > Objective Caml version 3.10.0 > > # let x = Filename.basename "a/b/c" ;; > val x : string = "c" > # let x = Filename.basename "a/b/c/" ;; > val x : string = "." > > The first result is fine, but second result is definitely not what > one would reasonably expect. > > For instance, the basename program in Linux gives: > > > basename a/b/c/ > c I think the OCaml one is what I'd reasonably expect actually. The GNU documentation for basename says: `basename' removes any leading directory components from NAME. and a/b/c/ are leading directory components. Rich. -- Richard Jones Red Hat