Skip to content

Explain the extra chmod

There is confusion about what passing 0600 to File.open does.

$ touch /tmp/foobar
$ ls -l /tmp/foobar
-rw-r--r--  1 jacobvosmaer  wheel  0 Sep 26 14:20 /tmp/foobar
$ ruby -e 'File.open("/tmp/foobar", "w", 0600)'
$ ls -l /tmp/foobar
-rw-r--r--  1 jacobvosmaer  wheel  0 Sep 26 14:20 /tmp/foobar
$ 
$ 
$ rm /tmp/foobar
$ ruby -e 'File.open("/tmp/foobar", "w", 0600)'
$ ls -l /tmp/foobar
-rw-------  1 jacobvosmaer  wheel  0 Sep 26 14:21 /tmp/foobar

Merge request reports