Skip to content
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

All RubyFileTest methods have a race condition #1950

enebo opened this Issue Sep 4, 2014 · 2 comments


None yet
2 participants
Copy link

enebo commented Sep 4, 2014

The logic in all these methods is 'file.exists() && file.isFoo()' . If the file is removed between these two operation an exception will be raised from methods where no exceptions should be raised.

@enebo enebo added this to the JRuby 1.7.16 milestone Sep 4, 2014


This comment has been minimized.

Copy link

chrisseaton commented Sep 5, 2014

By isFoo do you mean things like isFile and isDirectory? I think these implicitly include exists() don't they? isDirectory on something that doesn't exist returns false:

=> false

So can't you just drop the first test? And is there a race condition anyway as I don't think any of the isFoo methods throw exceptions, do they?


This comment has been minimized.

Copy link
Member Author

enebo commented Sep 5, 2014

@chrisseaton I have a local branch with all of this fixed. I just have a few failing tests. I just recorded the issue so it will be displayed in our release notes.

And removing exists() is not quite enough because the stat() was raising if the file did not exist. I converted stat() on FileResource to return null on inabiltiy to stat()

@enebo enebo closed this in f607e53 Sep 11, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.