Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 835405

Summary: dev-ruby/safe_yaml-1.0.5-r1 fails tests with dev-ruby/psych:4
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Gentoo Ruby Team <ruby>
Status: RESOLVED FIXED    
Severity: normal CC: matoro_bugzilla_gentoo, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=887223
https://github.com/dtao/safe_yaml/pull/101
https://github.com/dtao/safe_yaml/pull/102
https://bugs.gentoo.org/show_bug.cgi?id=903891
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log

Description Agostino Sarubbo gentoo-dev 2022-03-16 07:44:06 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: dev-ruby/safe_yaml-1.0.5-r1 fails tests on MUSL.
Discovered on: amd64 (internal ref: tinderbox_musl)

NOTE:
This machine uses MUSL libc
Comment 1 Agostino Sarubbo gentoo-dev 2022-03-16 07:44:08 UTC
Created attachment 767141 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2022-03-16 07:44:08 UTC
Error(s) that match a know pattern:


        expected no Exception, got #<ArgumentError: wrong number of arguments (given 2, expected 1)> with backtrace:
       expected no Exception, got #<ArgumentError: wrong number of arguments (given 2, expected 1)> with backtrace:
      ArgumentError:
      Failure/Error: File.open(filename, 'r:bom|utf-8') { |f| self.unsafe_load(f, filename) }
      Failure/Error: Psych.parse(yaml, filename) :
      Failure/Error: expect { result = YAML.safe_load(instance.to_yaml) }.to_not raise_error
      Failure/Error: unsafe_load(*arguments)
     ArgumentError:
     Failure/Error: Psych.parse(yaml, filename) :
     Failure/Error: expect { result = YAML.safe_load "--- ! 'foo'" }.to_not raise_error
     Failure/Error: expect(backdoor).to be_exploited_through_init_with
     Failure/Error: expect(backdoor).to be_exploited_through_ivars
     Failure/Error: expect(backdoor).to be_exploited_through_setter
.........................FFFF................FFFWARNING: Using the `raise_error` matcher without providing a specific error or message risks false positives, since `raise_error` will match when Ruby raises a `NoMethodError`, `NameError` or `ArgumentError`, potentially allowing the expectation to pass without even executing the method you are intending to call. Actual error raised was #<ArgumentError: wrong number of arguments (given 2, expected 1)>. Instead consider providing a specific error class or message. This message can be suppressed by setting: `RSpec::Expectations.configuration.on_potential_false_positives = :nothing`. Called from /var/tmp/portage/dev-ruby/safe_yaml-1.0.5-r1/work/ruby26/safe_yaml-1.0.5/spec/safe_yaml_spec.rb:353:in `block (5 levels) in <top (required)>'.
.WARNING: Using the `raise_error` matcher without providing a specific error or message risks false positives, since `raise_error` will match when Ruby raises a `NoMethodError`, `NameError` or `ArgumentError`, potentially allowing the expectation to pass without even executing the method you are intending to call. Actual error raised was #<ArgumentError: wrong number of arguments (given 2, expected 1)>. Instead consider providing a specific error class or message. This message can be suppressed by setting: `RSpec::Expectations.configuration.on_potential_false_positives = :nothing`. Called from /var/tmp/portage/dev-ruby/safe_yaml-1.0.5-r1/work/ruby26/safe_yaml-1.0.5/spec/safe_yaml_spec.rb:362:in `block (5 levels) in <top (required)>'.
Comment 3 matoro archtester 2022-06-16 17:28:45 UTC
This has nothing to do with musl, it occurs on glibc on all arches and all Ruby versions.  I suspect this has something to do with psych instead of safe_yaml.
Comment 4 matoro archtester 2022-06-16 17:40:20 UTC
Got it.  Looks like this is an incompatibility with dev-ruby/psych:4.  Created an ebuild for the last version of psych 3, disabled the psych 4 gem specification, and it works.  However I'm not sure how to force it to use psych 3 since it seems to just pull in the latest psych version, which means it won't work if you have dev-ruby/psych:4 installed at all.

Additionally with these two Debian patches it also works on Ruby 3.x:

https://salsa.debian.org/ruby-team/ruby-safe-yaml/-/blob/master/debian/patches/fix_ruby_3_compatibility.patch
https://salsa.debian.org/ruby-team/ruby-safe-yaml/-/blob/master/debian/patches/adjust-tests-to-reflect-OpenStruct-changes-on-Ruby3.patch
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-02 03:44:03 UTC
bz was down at the time:

commit ef67bb12821ad41b8f4c6bbbd37a0b90d46904f8
Author: Hans de Graaff <graaff@gentoo.org>
Date:   Fri Mar 31 10:02:59 2023 +0200

    dev-ruby/safe_yaml: update EAPI 7 -> 8, add ruby30
    
    Fix ruby30 compatibility with debian patches. Thanks to matoro for
    finding them in the references bug.
    
    Closes: https://bugs.gentoo.org/835405
    Signed-off-by: Hans de Graaff <graaff@gentoo.org>