From: Craig Files Date: 2002-02-15T00:39:11+09:00 Subject: File.open weirdness Hi, I need some help figuring out why the following ruby code does not work. ruby: File.open("test.cmd",0666,File::CREAT|File::TRUNC|File::WRONLY){ |file| file.puts("Write something in the file\n") file.puts("Write something else in the file\n") } File.open("test.cmd",0666,File::CREAT|File::TRUNC|File::WRONLY){ |file| file.puts("Write something in the file\n") } This should create the file "test.cmd", write to it, save it, reopen it, write to it and then close. on my linux box (ruby versions 1.6.6, 1.7.2 (Jan 14 snapshot), both compiled with gcc) this is the error message that I get (line 8 is the first File.open): file_error.rb:8:in `initialize': No such file or directory - "test.cmd" (Errno::ENOENT) from file_error.rb:8:in `open' from file_error.rb:8 on HPUX 11.0 (ruby version 1.7.2 compiled with gcc) (line 12 is the second File.open) file_error.rb:12:in `initialize': Permission denied - "test.cmd" (Errno::EACCES) from file_error.rb:12:in `open' from file_error.rb:12 .... The first File.open created the file with permissions r-- --- --x, not rw- rw- rw-. The 64 bit version of ruby version 1.7.2 compiled with HP's 64-bit version of gcc gives the same error as my linux box. Any suggestions about what is going wrong? Craig