From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA20991; Sat, 29 May 2004 18:03:02 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA20659 for ; Sat, 29 May 2004 18:03:01 +0200 (MET DST) Received: from mail.davidb.org (adsl-64-172-240-129.dsl.sndg02.pacbell.net [64.172.240.129]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i4TG2xSH008335; Sat, 29 May 2004 18:03:00 +0200 Received: from davidb by mail.davidb.org with local (Exim 3.36 #1 (Debian)) id 1BU6Hy-0002iQ-00; Sat, 29 May 2004 09:02:26 -0700 Date: Sat, 29 May 2004 09:02:26 -0700 From: David Brown To: skaller Cc: Damien Doligez , caml-list Subject: Re: [Caml-list] unix.chop_extension Message-ID: <20040529160226.GA10368@davidb.org> References: <20040526110508.A17806@pauillac.inria.fr> <1085567689.25587.202.camel@pelican.wigram> <8026DB99-AF18-11D8-99ED-00039310CAE8@inria.fr> <1085586637.32106.45.camel@pelican.wigram> <607E17A0-AF2E-11D8-9582-00039310CAE8@inria.fr> <1085632433.32106.93.camel@pelican.wigram> <5A5E8594-B0C6-11D8-962F-00039310CAE8@inria.fr> <1085772889.3036.70.camel@pelican.wigram> <7A9822AA-B14B-11D8-962F-00039310CAE8@inria.fr> <1085824870.3036.249.camel@pelican.wigram> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1085824870.3036.249.camel@pelican.wigram> User-Agent: Mutt/1.5.4i X-Miltered: at concorde with ID 40B8B433.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 caml-list:01 chop:01 2004:99 permissions:01 distinctions:01 foo:01 'foo':01 symlink:01 pathnames:01 equivalence:01 manpage:01 buffer:01 ocaml:01 unix:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, May 29, 2004 at 08:01:10PM +1000, skaller wrote: > It also isn't entirely clear how you would actually > *measure* 'same result' in all cases -- normally > this is obvious, but there will be nasty cases: > the problem is that it is the nasty cases that > are at issue here. opening x and ./x isn't > the same thing on Unix due to permissions distinctions? What nasty case are you thinking of? Opening both "x" and "./x" will require search (x) permission on the current directory, and will either both work, or both fail in the same situations. However, that is about the only "equivalent" path that is really equivalent. "foo/../x" and "x" may not be equivalent from a permission perspective (or not at all, say if 'foo' is a symlink). A good description might be: there are many paths that can possibly refer to the same file. A string manipulation library routine can certainly come up with pathnames that are potentially equivalent. To determine real equivalence, something like 'realpath' should be used. Of course, according to the Linux manpage for realpath: "Never use this function. It is broken by design since it is impossible to determine a suitable size for the output buffer." It wouldn't be very hard to implement realpath in ocaml, just using the Unix module. It could even be done safely :-) Dave ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners