#1089544 Error in auto_compact: arg issue

#1089544#5
Date:
2024-12-08 17:43:50 UTC
From:
To:
Version:1.7.2-1

Severity: serious

Justification: ftbfs patch


Hi,

Getting following error:

<internal:gc>:59:in `auto_compact=': Automatic compaction isn't
available on this platform (NotImplementedError)
         from /<<PKGBUILDDIR>>/spec/spec_helper.rb:33:in `<top (required)>'
         from
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:86:in
`require'
         from
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:86:in
`require'
         from /<<PKGBUILDDIR>>/spec/cases_spec.rb:1:in `<top (required)>'
         from
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:86:in
`require'
         from
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:86:in
`require'
         from -e:1:in `block in <main>'
         from -e:1:in `each'
         from -e:1:in `<main>'
ERROR: Test "ruby3.1" failed. Exiting, having arguement issue
dh_auto_install: error: dh_ruby --install
/<<PKGBUILDDIR>>/debian/ruby-msgpack returned exit code 1
make: *** [debian/rules:7: binary] Error 25
dpkg-buildpackage: error: fakeroot debian/rules binary subprocess
returned exit status 2

Here is my fix patch :

diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ff2fad3..c67eadf 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -19,18 +19,20 @@ require 'rspec'
  require 'msgpack'
  require "msgpack/bigint"

-
  if GC.respond_to?(:verify_compaction_references)
    # This method was added in Ruby 3.0.0. Calling it this way asks the
GC to
    # move objects around, helping to find object movement bugs.
    begin
      GC.verify_compaction_references(double_heap: true, toward: :empty)
-  rescue NotImplementedError
+  rescue NotImplementedError, ArgumentError
    end
  end

  if GC.respond_to?(:auto_compact=)
+  begin
      GC.auto_compact = true
+  rescue NotImplementedError, ArgumentError
+  end
  end



Thanks and regards,

Aditi