Raise Errno::ENOTDIR if the parent of an opened file is not a directory#4816
Raise Errno::ENOTDIR if the parent of an opened file is not a directory#4816philr wants to merge 1 commit intojruby:masterfrom
Conversation
Note that Errno::ENOENT is raised on Windows. This is consistent with the MRI implementation.
|
well done, thanks Phil |
|
seems that some tests from the test:jruby suite started failing, afterwards e.g. https://travis-ci.org/jruby/jruby/jobs/288206627#L1452-L1461 ... maybe just need adjusting - could you check them with MRI 2.3/2.4? |
|
@kares Those tests were already failing on master prior to this change (see https://travis-ci.org/jruby/jruby/jobs/287161724#L1414-L1424). It looks like either 404fdc9 or 471b9c9 caused the breakage. |
|
that seems right - 6 failures of the same but your added test-case passed, sorry for the confusion |
|
picked on master as 870011e keeping open as likely this makes sense to be backported for 9.1 ... |
|
This appears to be only for 2.4 and higher so no backporting. |
|
@enebo The |
|
@philr omg I did not read that file1 had to exist. You are correct and we should backport as well. I will re-open. |
|
double checked on 2.3.3 : |
|
now on jruby-.9.1 as well ... e7086e5 |
MRI 2.4.2 raises
Errno::ENOTDIRwhen attempting to open a path where the parent entry is not a directory. For example, supposing/tmp/file1is a regular file:However, JRuby 9.1.13.0 (on platforms other than Windows) raises
Java::JavaLang::RuntimeExceptioninstead:This pull request changes
RegularFileResource.openChannel()andPosixShim.open()so that they handle theENOTDIRcase, makingFile.openraise the correct exception.The change only applies to platforms other than Windows. On Windows, both JRuby and MRI raise
Errno::ENOENTfor such paths.