prob with File.open and perms

U

Une Bévue

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

Nobuyoshi Nakada

Hi,

At Sat, 27 Jan 2007 15:55:08 +0900,
Une B=E9vue 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.

--=20
Nobu Nakada
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top