Dir.mkdir

I am quite confused by the "Dir.mkdir( aString [, anInteger ] ) -> 0"
class method. It doesn’t seem to work as expected in the UNIX way.

Say I have the following program, mkdir.rb:

#! /usr/bin/env ruby
Dir.mkdir(ARGV[0], 0777) if ARGV.size >= 1

When I type:

mkdir.rb t

instead of set the permission of the directory t to: drwxrwxrwx, it is
set to: drwxr-xr-x

Can anyone explain?

Thanks.

TOTO wrote:

I am quite confused by the “Dir.mkdir( aString [, anInteger ] ) → 0”
class method. It doesn’t seem to work as expected in the UNIX way.

Say I have the following program, mkdir.rb:

#! /usr/bin/env ruby
Dir.mkdir(ARGV[0], 0777) if ARGV.size >= 1

When I type:

mkdir.rb t

instead of set the permission of the directory t to: drwxrwxrwx, it is
set to: drwxr-xr-x

Could it be this?
http://www.rubycentral.com/book/ref_c_dir.html#Dir.mkdir
" The permissions may be modified by the value of File.umask "

[kentda@v052a tmp]$ ruby -e ‘printf “%o\n”, File.umask; Dir.mkdir “t”,
0777’
22
[kentda@v052a tmp]$ ls -al t
totalt 12
drwxr-xr-x 2 kentda kentda 4096 jan 15 08:53 ./
drwx------ 23 kentda kentda 8192 jan 15 08:53 …/

22 would mask the write bits, so it looks right.

···


([ Kent Dahl ]/)_ ~ [ http://www.stud.ntnu.no/~kentda/ ]/~
))_student
/(( _d L b_/ NTNU - graduate engineering - 5. year )
( __õ|õ// ) )Industrial economics and technological management(
_
/ö____/ (_engineering.discipline=Computer::Technology)