Join GitHub today
MRI and JRuby disagree about File.exist?("/non_directory_file.name/") #4403
And both 184.108.40.206 and 1.7.19 ( the two versions we use around here) ...
referenced this issue
Dec 20, 2016
Actually two things to point out in this issue:
cp2.rb is a regular file. It is possible we can just secondarily always check isDirectory() here and then throw ENOTDIR.
The base reported problem is this should not stat but it is coupled with proper return value as well. is cp2.rb did not exist we should return ENOENT but if it does exist we should return ENOTDIR.
A consistent check would be a one-off, but perhaps it could be written into the contract of JavaSecuredFile or a similar utility. It does seem like a weird choice on the Java side, but I guess they figured no systems can have both a file and a dir of the same name, so removing the trailing element should not be meaningfully different to the FS.