-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise Errno::ENOTDIR if the parent of an opened file is not a directory #4816
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::ENOTDIR
when attempting to open a path where the parent entry is not a directory. For example, supposing/tmp/file1
is a regular file:However, JRuby 9.1.13.0 (on platforms other than Windows) raises
Java::JavaLang::RuntimeException
instead:This pull request changes
RegularFileResource.openChannel()
andPosixShim.open()
so that they handle theENOTDIR
case, makingFile.open
raise the correct exception.The change only applies to platforms other than Windows. On Windows, both JRuby and MRI raise
Errno::ENOENT
for such paths.