github / github/ssh_data

Fails to load in JRuby: RangeError (bignum too big to convert into `long')

Open
#66 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Ruby
Stars
98
Forks
54
PR merge metrics
No merged PRs in 30d

Description

This module expects in multiple locations that it can convert the special numbers 0 and 2^64-1 into a time stamp. This does not work in JRuby, where it uses a signed long to work on times.

```
irb(main):002:0> require "ssh_data"
Traceback (most recent call last):
16: from org/jruby/RubyKernel.java:1052:in `load'
15: from /usr/share/jruby/bin/irb:11:in `'
14: from org/jruby/RubyKernel.java:1237:in `catch'
13: from org/jruby/RubyKernel.java:1237:in `catch'
12: from org/jruby/RubyKernel.java:1507:in `loop'
11: from org/jruby/RubyKernel.java:1091:in `eval'
10: from (irb):2:in `evaluate'
9: from /usr/share/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:160:in `require'
8: from org/jruby/RubyKernel.java:1017:in `require'
7: from /var/lib/puppetserver/jruby-gems/gems/ssh_data-1.3.0/lib/ssh_data.rb:33:in `'
6: from /usr/share/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:85:in `require'
5: from org/jruby/RubyKernel.java:1017:in `require'
4: from /var/lib/puppetserver/jruby-gems/gems/ssh_data-1.3.0/lib/ssh_data/certificate.rb:4:in `'
3: from /var/lib/puppetserver/jruby-gems/gems/ssh_data-1.3.0/lib/ssh_data/certificate.rb:5:in `'
2: from /var/lib/puppetserver/jruby-gems/gems/ssh_data-1.3.0/lib/ssh_data/certificate.rb:8:in `'
1: from org/jruby/RubyTime.java:1336:in `at'
RangeError (bignum too big to convert into `long')
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure under JRuby with `require "ssh_data"`, then inspect `lib/ssh_data/certificate.rb`, where loading currently reaches `Time.at`, and the related load path in `lib/ssh_data.rb`. Identify the other locations that convert 0 and 2^64-1 to timestamps and verify that the library loads successfully under JRuby without the RangeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.