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 WAA04914; Fri, 23 Apr 2004 22:00:12 +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 WAA04611 for ; Fri, 23 Apr 2004 22:00:11 +0200 (MET DST) Received: from hirsch.in-berlin.de (hirsch.in-berlin.de [192.109.42.6]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3NK0AYM000381 for ; Fri, 23 Apr 2004 22:00:10 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from hirsch.in-berlin.de (localhost [127.0.0.1]) by hirsch.in-berlin.de (8.12.11/8.12.11/Debian-3) with ESMTP id i3NK02Ou010087 for ; Fri, 23 Apr 2004 22:00:09 +0200 Received: from first.UUCP (uucp@localhost) by hirsch.in-berlin.de (8.12.11/8.12.11/Debian-3) with UUCP id i3NJe3V1007806 for inria.fr!caml-list; Fri, 23 Apr 2004 21:40:03 +0200 Received: by first.in-berlin.de via sendmail from stdin id (Debian Smail3.2.0.114) Fri, 23 Apr 2004 21:34:01 +0200 (CEST) From: oliver@first.in-berlin.de (Oliver Bandel) Date: Fri, 23 Apr 2004 21:34:01 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] Unix.chmod => what codes for what mode?! Message-ID: <20040423193401.GA1761@first.in-berlin.de> References: <20040423171634.GA887@first.in-berlin.de> <20040423180102.GA24360@redhat.com> <20040423191449.GA9194@swordfish> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20040423191449.GA9194@swordfish> User-Agent: Mutt/1.3.28i X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; oliver:01 in-berlin:01 oliver:01 bandel:01 caml-list:01 chmod:01 2004:99 0600,:01 gushee:01 2004:99 bandel:01 chmod:01 permissions:01 permissions:01 755:99 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Fri, Apr 23, 2004 at 01:14:49PM -0600, Matt Gushee wrote: > On Fri, Apr 23, 2004 at 07:01:02PM +0100, Richard Jones wrote: > > On Fri, Apr 23, 2004 at 07:16:34PM +0200, Oliver Bandel wrote: > > > > > > The Unix.chmod function is bad documented. > > I agree. See below. > > > Almost certainly you're not using octal numbers right. The format > > for octal numbers in OCaml is different from C, for example: > > My guess would be that he simply wasn't conscious of the fact that they > *were* octal numbers--which is the same mistake I made at first and have > seen several others make. The fact that permissions are octal is easy to > understand, but--if you have worked with file permissions in the Unix > shell and never either worked with them in a medium level language like > C or thought deeply about what the numbers represent, it's not at all > obvious. After all, in the following: > > > % chmod 755 filename > > 755 just looks like an integer, doesn't it? > > Hence the documentation issue. I also suggested, when I ran into this > problem, that the fact these are octal numbers should be documented. I > was told that it is documented, in ... I forget where, but someplace > rather distant from the Unix API doc. I submit that that is inadequate > documentation for many people. Well, when doing chmod on the shel, I have in mind this is octal numbers or the ascii ugo+/-wr. But when looking in the Ocaml-Unix-Lib-documentation I only saw the type "int", and when nothing else is mentioned, int for me is decimal int. Should be mentioned in the manual! Information does not make sense when it is not evaluated in the right context (environment). [...] > > Note that [permissions] is an octal number. Example: > > Unix.chmod 0o755 myfile > > There. That took about 30 seconds. Yes. Until today I didn't use Ocaml's octal numbers, because I didn't needed them. But to mention this seemingly obvious thing in the reference manual would be nice. very nice! Ciao, Oliver ------------------- 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