From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id pBRJgRpZ009669 for ; Tue, 27 Dec 2011 20:42:27 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgEBAOge+k7U4xEJkGdsb2JhbAAoGoUPpzkiAQEBAQcLDQcUAyKBcgEBBSNWEAsaAiYCAlcGJ4doBiOjQJEdgS+JSoEWBI0ajTeMZg X-IronPort-AV: E=Sophos;i="4.71,417,1320620400"; d="scan'208";a="137020894" Received: from moutng.kundenserver.de ([212.227.17.9]) by mail1-smtp-roc.national.inria.fr with ESMTP; 27 Dec 2011 20:42:22 +0100 Received: from office1.lan.sumadev.de (dslb-094-219-209-047.pools.arcor-ip.net [94.219.209.47]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0Lm4GH-1R6q7w23If-00ZeEM; Tue, 27 Dec 2011 20:42:21 +0100 Received: from [192.168.178.30] (546BF816.cm-12-4d.dynamic.ziggo.nl [84.107.248.22]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 16E35C00C7; Tue, 27 Dec 2011 20:42:21 +0100 (CET) From: Gerd Stolpmann To: Damien Doligez Cc: caml users In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Tue, 27 Dec 2011 20:42:20 +0100 Message-ID: <1325014940.5036.8.camel@samsung> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:iIACBN8XoGPBxGmZ+bZWh/Y8mBOOXgcZ30Xbu2x71Zu 8SuACDQ0gZ6OCYaBTHRq+O+r1sZYLcc659NA6A5iKNb8+sjSwY 9UBEPla4C3V/fNf9J2MrsnXfMzO3KdbITCDsRG+iJPAcsGu2Vw E+0NBy9GRHsGqEoJTBZ+2+RLDuYM2yeArHYAPLMrYoUx3r4uoP ylYmunEJ1vWICFARTSvdPs2R2I339Zi9pH41j+Aircq5Bz8ozj wTMgdiD8/+OVNmOBqIzlM7J5awlvBcSieTeIg579DzMuL59PHQ mi1edJ6Bzavt3CI5/8liKPirqeIXND5luzUMK2d1xq0xUE0M5Q WitFqBvVTiDBob4PVcXKlnipkuVb9Aqo3fS/Lclmm Subject: Re: [Caml-list] RFC: basename, dirname, PR#4549 Hi, I've done a lot of system programming in the past years, and I cannot remember that I had to work around this small incompatibility. Semantically, the POSIX specs are better, because only directories are allowed to have trailing slashes, and if you want to get the basename of "path/" you want the name of the directory in >99% of the cases. The trailing slash has only the meaning that it is asserted that the path refers to a directory. And operations like "basename" better ignore such assertions. There could be a problematic area, though: URLs. A trailing slash means here a different resource. I don't know whether anybody is using basename in this context. Gerd Am Dienstag, den 27.12.2011, 17:29 +0100 schrieb Damien Doligez: > Hello, > > I would like to get some comments from the OCaml community at large about > the problem raised in http://caml.inria.fr/mantis/view.php?id=4549 > > In a nutshell, the problem is that our version of basename and dirname > are not exactly the same as the Open Group's definition. > > We can easily implement the standard behaviour for basename and dirname, > and it seems desirable, but there is a catch: we will have to change > the specification of the standard library slightly. > > Currently, we specify this: > > [concat (dirname name) (basename name)] returns a file name > which is equivalent to [name]. Moreover, after setting the > current directory to [dirname name] (with {!Sys.chdir}), > references to [basename name] (which is a relative file name) > designate the same file as [name] before the call to {!Sys.chdir}. > > With the Open Group basename and dirname, this becomes false for > names that include some trailing slashes, because such slashes > are removed by basename. This means that a name "foo/bar/" > becomes "foo/bar" when put through > [concat (dirname name) (basename name)] > and opening "foo/bar" may succeed if it is a file, while > opening "foo/bar/" would fail. > > I would like to know if anyone relies on the precise behaviour > documented in the standard library, and for everyone else, would > you prefer the old behaviour or the new (standard) behaviour? > > -- Damien > >