Array#pack difference between jruby 1.7.10 and ruby 1.9.3 #1478

Closed
dmendel opened this Issue Feb 4, 2014 · 2 comments

Projects

None yet

4 participants

@dmendel
dmendel commented Feb 4, 2014
$ ruby --version
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]

$ ruby -e 'p [0xfffffffffffffffff].pack("C")' 
"\xFF"
$ ruby --version                                   
jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on OpenJDK 64-Bit Server VM 1.7.0_51-b00 [linux-amd64]

$ ruby -e 'p [0xfffffffffffffffff].pack("C")'
RangeError: bignum too big to convert into `long'
    pack at org/jruby/RubyArray.java:4129
  (root) at -e:1
@lucasallan
Member

I'll take a look on it. Thanks @dmendel

@lucasallan lucasallan added a commit to lucasallan/jruby that referenced this issue Feb 7, 2014
@lucasallan lucasallan Fixing Issue #1478 - Related to Array#pack. a26418f
@lucasallan lucasallan added a commit to lucasallan/jruby that referenced this issue Feb 7, 2014
@lucasallan lucasallan Fixing Issue #1478 - Related to Array#pack. 65176f4
@lucasallan lucasallan added a commit to lucasallan/jruby that referenced this issue Feb 7, 2014
@lucasallan lucasallan Fixing Issue #1478 - Related to Array#pack. c86709e
@DavidEGrayson
Contributor

I encountered this issue today in JRuby 1.7.11.

It is interesting compared to other JRuby bugs because it can be reproduced with so few characters:

[1<<99].pack ?C
@atambo atambo added a commit to atambo/jruby that referenced this issue Apr 12, 2014
@atambo atambo Array#pack(cC) should not raise RangeError when argument is bignum
Fixes #1478
e631976
@atambo atambo added a commit to atambo/jruby that referenced this issue Apr 12, 2014
@atambo atambo Array#pack(cC) should not raise RangeError when argument is bignum
Fixes #1478
e704402
@atambo atambo closed this in 10638d1 Apr 14, 2014
@enebo enebo added this to the JRuby 1.7.12 milestone Apr 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment