I'm not sure if this is a bug or intended as spec.

I noticed when a file name argument is passed to the IO.copy_stream, the
newly-created destination file has 0600 perms and is not respecting my
normal umask (0022).

I can reproduce with this (where 'new_file' is non-existent beforehand):

	umask 0022
	rm -f new_file
	ruby -e "IO.copy_stream('/dev/zero', 'new_file', 1)"

I've found the mode is explicitly set to 0600 in io.c, copy_stream_body():

            args[2] = INT2FIX(0600);

If this is to prevent somebody from reading the while while it is being
written to[1], shouldn't copy_stream_finalize call fchmod() on the file
to respect umask?

Anyways, I don't understand why 0600 is specified, File.open(..., "w")
always uses mode=0666 and lets umask decide permissions.


[1] - I don't think it's worthwhile to prevent somebody from reading
      a file while it's being written, either.  At least it shouldn't
      be enforced in a utility method.