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

Marshal dump produces wrong output for Range objects #5805

Closed
Confusion opened this issue Jul 30, 2019 · 0 comments

Comments

@Confusion
Copy link

commented Jul 30, 2019

Environment

jruby 9.2.7.0 (2.5.3) 2019-04-09 8a269e3 OpenJDK 64-Bit Server VM 11.0.3+7-Ubuntu-1ubuntu218.04.1 on 11.0.3+7-Ubuntu-1ubuntu218.04.1 +jit [linux-x86_64]

No gems, no framework, no relevant ENV.

Expected Behavior

2.5.3 :001 > Marshal.dump(1..2)
 => "\x04\bo:\nRange\b:\texclF:\nbegini\x06:\bendi\a"

Actual Behavior

jruby-9.2.7.0 :001 > Marshal.dump((1..2))
 => "\x04\bo:\nRange\b:\vbeginii\x06:\tendii\a:\texclF"

This is problematic, because

2.5.3 :001 > Marshal.load("\x04\bo:\nRange\b:\vbeginii\x06:\tendii\a:\texclF")
 => nil..nil 
2.6.3 :001 > Marshal.load("\x04\bo:\nRange\b:\vbeginii\x06:\tendii\a:\texclF")
 => nil.. 

Notes

Discovered because we are using DRb to communicate between a Ruby 2.5.3 and JRuby 9.2.7.0 process, where it turns out Range objects get mangled.

JRuby does deserialize the result of MRI Marshal.dump correctly:

jruby-9.2.7.0 :001 > Marshal.load("\x04\bo:\nRange\b:\texclF:\nbegini\x06:\bendi\a")
 => 1..2 

@enebo enebo added this to the JRuby 9.2.8.0 milestone Jul 30, 2019

@kares kares self-assigned this Jul 31, 2019

kares added a commit that referenced this issue Jul 31, 2019

kares added a commit that referenced this issue Jul 31, 2019

@kares kares closed this in #5807 Jul 31, 2019

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