There was another issue recently where requiring "mathn/rational" by =
itself caused problems that did not occur when requiring "mathn" in its =
entirety.

Does the problem still occur if you "require 'mathn'" instead of =
"require 'mathn/rational'"?

Dave

On Sep 18, 2013, at 9:45 PM, bf4 (Benjamin Fleischer) wrote:

>=20
> Issue #8924 has been reported by bf4 (Benjamin Fleischer).
>=20
> ----------------------------------------
> Bug #8924: mathn/rational causes segmentation fault when calling =
:round on a Rational
> https://bugs.ruby-lang.org/issues/8924
>=20
> Author: bf4 (Benjamin Fleischer)
> Status: Open
> Priority: Normal
> Assignee:=20
> Category:=20
> Target version:=20
> ruby -v: ruby 2.0.0p195 (2013-05-14 revision 40734) =
[x86_64-darwin10.8.0]
> Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN
>=20
>=20
> Summary: Confirmed for MRI 1.9/2.0 various patchlevels, on OS X Snow =
Leopard.
>=20
> To reproduce:
>=20
> covered_percent =3D =
Marshal.load("\x04\bU:\rRational[\ai\x01\xC8i\x0F")
> # or require 'yaml'; covered_percent =3D YAML.load("--- =
!ruby/object:Rational\ndenominator: 10\nnumerator: 200\n")
> covered_percent.round(2) # =3D> (20/1)
> require 'mathn/rational'
> covered_percent.round(2) # =3D> segfault
>=20
> Partial output:
>=20
> =
/var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/co=
declimate-test-reporter-0.0.7/lib/code_climate/test_reporter/formatter.rb:=
50: [BUG] Segmentation fault
> ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]
>=20
> -- Control frame information =
-----------------------------------------------
> c:0013 p:---- s:0055 b:0055 l:000054 d:000054 CFUNC  :round
> c:0012 p:0198 s:0051 b:0042 l:000033 d:000041 BLOCK  =
/var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/co=
declimate-test-reporter-0.0.7/lib/code_climate/test
> c:0011 p:---- s:0039 b:0039 l:000038 d:000038 FINISH
> c:0010 p:---- s:0037 b:0037 l:000036 d:000036 CFUNC  :map
> c:0009 p:0037 s:0034 b:0034 l:000033 d:000033 METHOD =
/var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/co=
declimate-test-reporter-0.0.7/lib/code_climate/test
> c:0008 p:0046 s:0028 b:0028 l:000027 d:000027 METHOD =
/var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/co=
declimate-test-reporter-0.0.7/lib/code_climate/test
> c:0007 p:0030 s:0020 b:0020 l:000019 d:000019 METHOD =
/var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/si=
mplecov-0.7.1/lib/simplecov/result.rb:91
> c:0006 p:0021 s:0017 b:0017 l:001d00 d:000016 BLOCK  =
/var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/si=
mplecov-0.7.1/lib/simplecov/configuration.rb:133
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 FINISH
> c:0004 p:---- s:0013 b:0013 l:000012 d:000012 CFUNC  :call
> c:0003 p:0070 s:0010 b:0010 l:0025e0 d:000009 BLOCK  =
/var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/si=
mplecov-0.7.1/lib/simplecov/defaults.rb:52
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001618 d:001618 TOP
>=20
> - Related reports:=20
>  - =
https://github.com/codeclimate/ruby-test-reporter/pull/15#issuecomment-247=
15035
> - Crash output: attached and at url: =
https://gist.github.com/bf4/c2f663c9023bb4eaa83c)
>=20
>=20
> --=20
> http://bugs.ruby-lang.org/