You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
jruby 184.108.40.206 (2.3.3) 2018-02-21 8f3f95a OpenJDK 64-Bit Server VM 25.151-b12 on 1.8.0_151-b12 +jit [linux-x86_64]
Linux nyarlathotep 4.14.11-gentoo-r2 Project suggestions #2 SMP Wed Feb 28 17:37:50 MST 2018 x86_64 Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz GenuineIntel GNU/Linux
File#mtime doesn't return the same data for File#stat#mtime when the file has been renamed or deleted since the filehandle was opened (if the file has been removed, it throws an exception; if the file has been renamed, it silently gets the wrong data). MRI gets this data from the open filehandle and therefore gets the correct mtime. There are probably other methods on File that are shortcuts for stat that have this same issue. #size appears to have the correct behavior, but #ctime and #atime do not.
Here's an example program that works on MRI (printing "true" twice) but crashes in Jruby:
Note that in MRI on Windows, this fails as well, due to Windows files being locked for deletion and renaming when they are open for reading, so it throws a permission denied error. This version works in MRI on Windows:
Errno::ENOENT: No such file or directory - /tmp/d20180301-17838-1pibcq4/foo
mtime at org/jruby/RubyFile.java:440
block in ./test.rb at ./test.rb:14
open at org/jruby/RubyIO.java:1171
block in ./test.rb at ./test.rb:11
mktmpdir at /home/taylor/.rbenv/versions/jruby-220.127.116.11/lib/ruby/stdlib/tmpdir.rb:89
<main> at ./test.rb:7
The text was updated successfully, but these errors were encountered: