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

Stat of an empty resource does not generate proper Exception. #2048

Closed
enebo opened this Issue Oct 15, 2014 · 2 comments

Comments

Projects
None yet
1 participant
@enebo
Copy link
Member

enebo commented Oct 15, 2014

jruby -Xnative.enabled=false -e 'File.atime("file:")'
SystemCallError: Unknown error - Unknown Error (0) - __UNKNOWN_CONSTANT__

The reason for this is we assume the FileResource generated will hit jnr-posix and when the stat fails it then asks jnr-posix for the errno(). EmptyFileResource will be generated in this case and it does not hit jnr-posix at all. One possible solution is to manually set errno from EmptyFileResource so that this pattern of depending on jnr-posix for error is valid?

Extra note that it is amazing this case works for me with enabled=true since it is still using EmptyFilerResource. The last errno set must just happen to be an enoent.

@enebo enebo added this to the JRuby 1.7.17 milestone Oct 15, 2014

@enebo enebo changed the title Stat of an empty resource does not generate proper Exception with native disabled. Stat of an empty resource does not generate proper Exception. Oct 15, 2014

enebo added a commit that referenced this issue Oct 15, 2014

@enebo enebo modified the milestones: JRuby 1.7.18, JRuby 1.7.17 Dec 4, 2014

@enebo

This comment has been minimized.

Copy link
Member Author

enebo commented Dec 4, 2014

Punting on this. It is largely a corner-case and not likely to be hit be real code. It also requires a reasonably-sized refactoring.

enebo added a commit that referenced this issue Dec 10, 2014

@enebo

This comment has been minimized.

Copy link
Member Author

enebo commented Dec 10, 2014

I cannot say this is the best fix but it is consistent with how we work 'do thing; check error value'

@enebo enebo closed this Dec 10, 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.