[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

prob with File.open and perms

unbewusst.sein

1/27/2007 6:53:00 AM


if i use :
File.open('a_file',File::WRONLY|File::TRUNC|File::CREAT) do |f|
f.print 'something'
end

the 'a_file' i get has the following perms :
-rw-r--r--

which correspond to 644 (right?)
generally it's OK with those perms.

however if i rewrite the three lines above specifying the perms as 644 :
File.open('a_file',File::WRONLY|File::TRUNC|File::CREAT,644) do |f|
f.print 'something'
end

i get the following perms :
--w----r--

and then i can't do even a cat upon this file )))

is it my missunderstanding of File.open or a bugg ???
--
Artaban de Médée
2 Answers

Nobuyoshi Nakada

1/27/2007 7:37:00 AM

0

Hi,

At Sat, 27 Jan 2007 15:55:08 +0900,
Une Bévue wrote in [ruby-talk:236374]:
> which correspond to 644 (right?)

That is octal.

> however if i rewrite the three lines above specifying the perms as 644 :
> File.open('a_file',File::WRONLY|File::TRUNC|File::CREAT,644) do |f|
^^^
Use 0644.

--
Nobu Nakada

unbewusst.sein

1/27/2007 7:55:00 AM

0

Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:

> That is octal.
>
> > however if i rewrite the three lines above specifying the perms as 644 :
> > File.open('a_file',File::WRONLY|File::TRUNC|File::CREAT,644) do |f|
> ^^^
> Use 0644.

Fine thanks for the trick ;-)
--
Artaban de Médée