Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Unix.chmod => what codes for what mode?!
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: oliver@f...
Subject: Re: [Caml-list] Unix.chmod => what codes for what mode?!

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.


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!


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: