Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0cb4e8da5b8e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 73846e9e78f2
Choose a head ref
  • 3 commits
  • 2 files changed
  • 2 contributors

Commits on Oct 14, 2017

  1. Copy the full SHA
    c483cf1 View commit details

Commits on Jan 16, 2018

  1. Copy the full SHA
    74b1970 View commit details

Commits on Jan 24, 2018

  1. Merge pull request #4818 from philr/file_open_read_raise_eisdir_on_wi…

    …ndows
    
    Raise Errno::EISDIR when opening a directory for reading on Windows
    enebo authored Jan 24, 2018
    Copy the full SHA
    73846e9 View commit details
Showing with 8 additions and 1 deletion.
  1. +1 −1 core/src/main/java/org/jruby/util/RegularFileResource.java
  2. +7 −0 test/jruby/test_io.rb
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/RegularFileResource.java
Original file line number Diff line number Diff line change
@@ -234,7 +234,7 @@ public Channel openChannel(ModeFlags flags, int perm) throws ResourceException {
return channel;
}

if (file.isDirectory() && flags.isWritable()) {
if (file.isDirectory()) {
throw new ResourceException.FileIsDirectory(absolutePath());
}

7 changes: 7 additions & 0 deletions test/jruby/test_io.rb
Original file line number Diff line number Diff line change
@@ -205,6 +205,13 @@ def test_open_with_block
assert_raises(Errno::EBADF) { f.close }
end

if WINDOWS
# Opening a file should raise EISDIR on Windows, but not raise on other platforms.
def test_open_read_directory
assert_raises(Errno::EISDIR) { File.open('.', 'r') }
end
end

def test_open_child_of_file
ensure_files @file
assert_raises(WINDOWS ? Errno::ENOENT : Errno::ENOTDIR) { File.open(File.join(@file, 'child')) }