Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Unix file permissions bug?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Matt Gushee <mgushee@h...>
Subject: Re: [Caml-list] Unix file permissions bug?
On Sun, Jun 08, 2003 at 05:10:27PM -0400, john.chu@sun.com wrote:

> >   # Unix.chmod "test1" 755;;
> 
> This is 755 *decimal*.
> 
> It looks like you meant 
> 
> Unix.chmod "test1" 0o755;;

Ah ... quite so.

On Sun, Jun 08, 2003 at 11:15:32PM +0200, Nicolas George wrote:
> Le decadi 20 prairial, an CCXI, Matt Gushee a écrit?:
> >   # Unix.chmod "test1" 755;;
> 
> Unix file permissions are bit fields.

I knew that, of course, but hadn't given it much thought.

> If you want to yuse the easy
> habitual notation, you need to use octal, not decimal: try 0o755.

Hmm ... would it be unreasonable to request that this be noted in the
Unix module docs? Maybe I shouldn't take for granted that a Unix API
spells things the same as a shell, but that seems most intuitive for
people like me who have never done systems programming.

There's nothing difficult about using the octal notation, of course.
It's just unexpected, and surely I'm not the only one who wouldn't have
expected it.

-- 
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