File.open in write mode on read-only files raises Errno::ENOENT, should be
Errno::EACCES
----------------------------------------------------------------------------------------
Key: JRUBY-2340
URL: http://jira.codehaus.org/browse/JRUBY-2340
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.1RC2, JRuby 1.1+
Environment: OS X 10.4.11, Java 1.5.0_13, JRuby revision 6369 and Ruby
1.8.6 patchlevel 111
Windows XP SP2, Java 1.6.0_04, JRuby 1.1RC2
Reporter: David Yip
Attachments: write-to-read-only-file-spec.patch
Running the following code:
filename = '__test'
begin
File.new(filename, File::CREAT, 0444)
File.open(filename, 'w')
ensure
File.unlink(filename)
end
MRI behavior is
nevrast:~ trythil$ ruby issue.rb
issue.rb:5:in `initialize': Permission denied - __test (Errno::EACCES)
from issue.rb:5:in `open'
from issue.rb:5
JRuby behavior is
nevrast:~ trythil$ jruby issue.rb
issue.rb:5:in `initialize': No such file or directory - File not found
(Errno::ENOENT)
from issue.rb:5:in `open'
from issue.rb:5
Attached is a patch to rubyspec's spec/ruby/1.8/core/file/open_spec.rb that
adds an additional example demonstrating this issue.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email