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,HTML_MESSAGE autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id AD38CBC6B for ; Wed, 5 Sep 2007 14:37:46 +0200 (CEST) Received: from smtp.janestcapital.com (www.janestcapital.com [66.155.124.107]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l85Cbjrh000591 for ; Wed, 5 Sep 2007 14:37:46 +0200 Received: from [172.25.129.161] [38.96.172.125] by janestcapital.com with ESMTP (SMTPD-9.10) id A3330420; Wed, 05 Sep 2007 08:38:11 -0400 Message-ID: <46DEA316.3010806@janestcapital.com> Date: Wed, 05 Sep 2007 08:37:42 -0400 From: Brian Hurt User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Erik de Castro Lopo Cc: caml-list@inria.fr Subject: Re: [Caml-list] Bug in Filename.basename? References: <20070905184538.88ada4e8.mle+ocaml@mega-nerd.com> <20070905104127.GB24323@furbychan.cocan.org> <20070905211013.b53cf46b.mle+ocaml@mega-nerd.com> In-Reply-To: <20070905211013.b53cf46b.mle+ocaml@mega-nerd.com> Content-Type: multipart/alternative; boundary="------------010100030808060107040108" X-Miltered: at concorde with ID 46DEA319.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bug:01 basename:01 ocaml:01 basename:01 ocaml's:01 dirname:01 ocaml:01 ocaml's:01 dirname:01 W8:98 W8:98 W6:98 W6:98 wrote:01 wrote:01 This is a multi-part message in MIME format. --------------010100030808060107040108 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Erik de Castro Lopo wrote: >Richard Jones wrote: > > > >>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. >> >> > >The word "leading" in the above is at best, ambiguous. > >Regardless of what the documentation says, the behaviour of Ocaml's >basename function is different from the basename program (from the >GNU coreutils package) on my Linux system. > > Interesting point from the Linux basename man page: > There are two different versions of basename() - the POSIX > version > described above, and the GNU version one gets after > #define _GNU_SOURCE > #include > The GNU version never modifies its argument, and returns > the empty > string when path has a trailing slash, and in particular also > when it > is "/". There is no GNU version of dirname(). So there seems to be some confusion, even at Gnu, as to what the proper behavior of this function should be. Brian --------------010100030808060107040108 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Erik de Castro Lopo wrote:
Richard Jones wrote:

  
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.
    

The word "leading" in the above is at best, ambiguous.

Regardless of what the documentation says, the behaviour of Ocaml's
basename function is different from the basename program (from the
GNU coreutils package) on my Linux system.
  
Interesting point from the Linux basename man page:

       There  are  two  different  versions  of basename() - the POSIX version
       described above, and the GNU version one gets after
         #define _GNU_SOURCE
         #include <string.h>
       The GNU version never modifies its  argument,  and  returns  the  empty
       string  when  path has a trailing slash, and in particular also when it
       is "/".  There is no GNU version of dirname().

So there seems to be some confusion, even at Gnu, as to what the proper behavior of this function should be.

Brian

--------------010100030808060107040108--