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 pBRIa7jX008670 for ; Tue, 27 Dec 2011 19:36:10 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsoBAIEP+k7RVdc2kWdsb2JhbAAoFAabeJBICCIBAQEBCQsLBxQEIYFyAQEBBBICLAEUBxILAQMMBgULDQ0hIQEBEQEFAQoSBhMSAg6HYCOYIAqLZYJrhDY/iHECBQuDcoRkgy4EiDeMS4pvgw49hBg X-IronPort-AV: E=Sophos;i="4.71,416,1320620400"; d="scan'208";a="137015844" Received: from mail-lpp01m010-f54.google.com ([209.85.215.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 27 Dec 2011 19:36:10 +0100 Received: by lahl5 with SMTP id l5so8443797lah.27 for ; Tue, 27 Dec 2011 10:36:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=b/qFfuRKbFvQsq5dMqyNlsXuyTWkjw1iplu/AmNAhKc=; b=P2/eNnXdLOdHIzIonuvK69J8oBrPVm7WeFHLl0Wml47SOPZ6BVrq4Qws0GHte8NNU0 peHFtMagEHAs8JuEWjwYk+M5BwCHwvtN6maZ3At/ZMnjK1JsCkJ9jK8EcPD3igmvLqEe 67w2jj/4lbHRc3tVPAq0v/FbZZIfCKUXPGO9c= MIME-Version: 1.0 Received: by 10.152.131.131 with SMTP id om3mr22767379lab.38.1325010967677; Tue, 27 Dec 2011 10:36:07 -0800 (PST) Received: by 10.152.24.228 with HTTP; Tue, 27 Dec 2011 10:36:07 -0800 (PST) In-Reply-To: References: Date: Tue, 27 Dec 2011 13:36:07 -0500 Message-ID: From: Markus Mottl To: Damien Doligez Cc: caml users Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id pBRIa7jX008670 Subject: Re: [Caml-list] RFC: basename, dirname, PR#4549 Hi, I think the difference will mostly matter for code only that requires human input of paths, whether in a prompt or through a configuration file, and even there it would be rather unlikely to encounter such paths. Big deal, users can change their input easily. Having done my fair share of path mangling, I guess most applications that generate paths internally only, e.g. to walk through a directory hierarchy, are safe. It would seem highly unusual that anybody added an extra slash in code accessing files within a program. I personally prefer standard conformance. Regards, Markus On Tue, Dec 27, 2011 at 11:29, Damien Doligez wrote: > 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 > > > -- > Caml-list mailing list.  Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com