* [Caml-list] Unix.chmod => what codes for what mode?!
@ 2004-04-23 17:16 Oliver Bandel
2004-04-23 17:45 ` Shawn Wagner
2004-04-23 18:01 ` Richard Jones
0 siblings, 2 replies; 6+ messages in thread
From: Oliver Bandel @ 2004-04-23 17:16 UTC (permalink / raw)
To: caml-list
Hello,
The Unix.chmod function is bad documented.
Seems that I have to try out all possible values
and check the results with the command line tools?
Or is there any possibility to predict it's behaviour?!
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] Unix.chmod => what codes for what mode?!
2004-04-23 17:16 [Caml-list] Unix.chmod => what codes for what mode?! Oliver Bandel
@ 2004-04-23 17:45 ` Shawn Wagner
2004-04-23 18:01 ` Richard Jones
1 sibling, 0 replies; 6+ messages in thread
From: Shawn Wagner @ 2004-04-23 17:45 UTC (permalink / raw)
To: caml-list
On Fri, Apr 23, 2004 at 07:16:34PM +0200, Oliver Bandel wrote:
> Hello,
>
> The Unix.chmod function is bad documented.
>
> Seems that I have to try out all possible values
> and check the results with the command line tools?
>
>
> Or is there any possibility to predict it's behaviour?!
It uses the same numeric modes as the chmod command-line program.
See man 1 chmod for details.
--
Shawn Wagner
shawnw@speakeasy.org
-------------------
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] Unix.chmod => what codes for what mode?!
2004-04-23 17:16 [Caml-list] Unix.chmod => what codes for what mode?! Oliver Bandel
2004-04-23 17:45 ` Shawn Wagner
@ 2004-04-23 18:01 ` Richard Jones
2004-04-23 19:14 ` Matt Gushee
1 sibling, 1 reply; 6+ messages in thread
From: Richard Jones @ 2004-04-23 18:01 UTC (permalink / raw)
Cc: caml-list
On Fri, Apr 23, 2004 at 07:16:34PM +0200, Oliver Bandel wrote:
> Hello,
>
> The Unix.chmod function is bad documented.
>
> Seems that I have to try out all possible values
> and check the results with the command line tools?
>
>
> Or is there any possibility to predict it's behaviour?!
Almost certainly you're not using octal numbers right. The format
for octal numbers in OCaml is different from C, for example:
Unix.chmod filename 0o755
would have the same effect as:
% chmod 755 filename
Rich.
--
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
MOD_CAML lets you run type-safe Objective CAML programs inside the Apache
webserver. http://www.merjis.com/developers/mod_caml/
-------------------
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] Unix.chmod => what codes for what mode?!
2004-04-23 18:01 ` Richard Jones
@ 2004-04-23 19:14 ` Matt Gushee
2004-04-23 19:34 ` Oliver Bandel
0 siblings, 1 reply; 6+ messages in thread
From: Matt Gushee @ 2004-04-23 19:14 UTC (permalink / raw)
To: caml-list
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.
Of course, it's often very difficult to tell how thoroughly and
explicitly to document a language. And the very best programmers, and
those most familiar with the system, often produce documentation that is
both thorough and correct, but at the same time horribly obscure for
mere mortals. Actually, I think the OCaml team does pretty well,
considering the inherent difficulty of the language and the small amount
of time they can devote to documentation. Still, it could be better.
It often seems that, when people raise concerns like this about the
OCaml documentation, they get responses that, while well-intentioned and
courteous, imply that it is their fault for not having read the right
document or for lacking the necessary background (BTW, I'm not pointing
at anyone in this particular discussion), and that's a shame.
I'm reminded of the old parables of Jesus (or the Buddha) knocking on
people's doors disguised as a beggar: the "dummy" you alienate with an
unhelpful answer might turn out to have been a high school student who
could have become a brilliant OCaml programmer, or perhaps a senior
system architect who no longer programs very much--but might be in a
position to influence the CTO of a large corporation.
Not that we should try to make OCaml understandable to the entire
world--that would be absurd. But when a small effort would make it
easier for a significant number of people, why not? E.g.:
Note that [permissions] is an octal number. Example:
Unix.chmod 0o755 myfile
There. That took about 30 seconds.
--
Matt Gushee When a nation follows the Way,
Englewood, Colorado, USA Horses bear manure through
mgushee@havenrock.com its fields;
http://www.havenrock.com/ When a nation ignores the Way,
Horses bear soldiers through
its streets.
--Lao Tzu (Peter Merel, trans.)
-------------------
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] Unix.chmod => what codes for what mode?!
2004-04-23 19:14 ` Matt Gushee
@ 2004-04-23 19:34 ` Oliver Bandel
2004-04-23 20:29 ` Matt Gushee
0 siblings, 1 reply; 6+ messages in thread
From: Oliver Bandel @ 2004-04-23 19:34 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] Unix.chmod => what codes for what mode?!
2004-04-23 19:34 ` Oliver Bandel
@ 2004-04-23 20:29 ` Matt Gushee
0 siblings, 0 replies; 6+ messages in thread
From: Matt Gushee @ 2004-04-23 20:29 UTC (permalink / raw)
To: caml-list
On Fri, Apr 23, 2004 at 09:34:01PM +0200, Oliver Bandel wrote:
> > Note that [permissions] is an octal number. Example:
> >
> > Unix.chmod 0o755 myfile
Of course, octal is just a notation for integers, so the above isn't
quite right. Other than that, I stand by what I said.
--
Matt Gushee When a nation follows the Way,
Englewood, Colorado, USA Horses bear manure through
mgushee@havenrock.com its fields;
http://www.havenrock.com/ When a nation ignores the Way,
Horses bear soldiers through
its streets.
--Lao Tzu (Peter Merel, trans.)
-------------------
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-04-23 20:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-23 17:16 [Caml-list] Unix.chmod => what codes for what mode?! Oliver Bandel
2004-04-23 17:45 ` Shawn Wagner
2004-04-23 18:01 ` Richard Jones
2004-04-23 19:14 ` Matt Gushee
2004-04-23 19:34 ` Oliver Bandel
2004-04-23 20:29 ` Matt Gushee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox