summaryrefslogtreecommitdiff
path: root/dev-ruby/safe_yaml/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-04-01 11:14:56 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-04-01 11:14:56 +0100
commitc952bf4dc186a298c5ef1596e2c52642072db500 (patch)
tree0b0b9cc4cdda7b2f9d62548ba883329cf6c15274 /dev-ruby/safe_yaml/files
parent97c0860d9b4db72365710e1b8ed20644d6f5e926 (diff)
gentoo auto-resync : 01:04:2023 - 11:14:56
Diffstat (limited to 'dev-ruby/safe_yaml/files')
-rw-r--r--dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-arity.patch23
-rw-r--r--dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-openstruct-tests.patch69
2 files changed, 92 insertions, 0 deletions
diff --git a/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-arity.patch b/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-arity.patch
new file mode 100644
index 000000000000..e994a48bbecb
--- /dev/null
+++ b/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-arity.patch
@@ -0,0 +1,23 @@
+From: Daniel Leidert <dleidert@debian.org>
+Date: Wed, 1 Dec 2021 18:51:51 +0100
+Subject: Fix Rubx 3 compatibility
+
+Origin: https://github.com/dtao/safe_yaml/compare/master...paolobrasolin:development
+Bug: https://github.com/dtao/safe_yaml/issues/100
+---
+ lib/safe_yaml/safe_to_ruby_visitor.rb | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/safe_yaml/safe_to_ruby_visitor.rb b/lib/safe_yaml/safe_to_ruby_visitor.rb
+index b980445..5fd71f0 100644
+--- a/lib/safe_yaml/safe_to_ruby_visitor.rb
++++ b/lib/safe_yaml/safe_to_ruby_visitor.rb
+@@ -4,7 +4,7 @@ module SafeYAML
+
+ def initialize(resolver)
+ case INITIALIZE_ARITY
+- when 2
++ when 2, -3
+ # https://github.com/tenderlove/psych/blob/v2.0.0/lib/psych/visitors/to_ruby.rb#L14-L28
+ loader = Psych::ClassLoader.new
+ scanner = Psych::ScalarScanner.new(loader)
diff --git a/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-openstruct-tests.patch b/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-openstruct-tests.patch
new file mode 100644
index 000000000000..9b597276617b
--- /dev/null
+++ b/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-openstruct-tests.patch
@@ -0,0 +1,69 @@
+From: Sergio Durigan Junior <sergiodj@debian.org>
+Date: Fri, 28 Jan 2022 16:35:01 -0500
+Subject: Adjust tests to reflect OpenStruct changes on Ruby3.0
+
+Ref.: https://github.com/ruby/psych/issues/540
+
+OpenStruct on Ruby3.0 changed its marshalling/unmarshalling code,
+which is now impacting safe_yaml's testcase. The two adjustments that
+needed to be made are:
+
+- OpenStruct's instance_variable_get will now symbolize its hash keys,
+ instead of using strings.
+
+- OpenStruct's to_yaml method will not output the 'table' entity
+ anymore.
+
+Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
+
+Forwarded: yes, https://github.com/dtao/safe_yaml/pull/102
+---
+ spec/safe_yaml_spec.rb | 26 +++++++++++++++++++++++---
+ 1 file changed, 23 insertions(+), 3 deletions(-)
+
+diff --git a/spec/safe_yaml_spec.rb b/spec/safe_yaml_spec.rb
+index aa701a4..1081173 100644
+--- a/spec/safe_yaml_spec.rb
++++ b/spec/safe_yaml_spec.rb
+@@ -318,7 +318,13 @@ describe YAML do
+ it "will allow objects to be deserialized for whitelisted tags" do
+ result = YAML.safe_load("--- !ruby/object:OpenStruct\ntable:\n foo: bar\n")
+ expect(result).to be_a(OpenStruct)
+- expect(result.instance_variable_get(:@table)).to eq({ "foo" => "bar" })
++ if RUBY_VERSION < '3.0'
++ expect(result.instance_variable_get(:@table)).to eq({ "foo" => "bar" })
++ else
++ # Ruby3.0's OpenStruct will now symbolize the hash key.
++ # Ref.: https://github.com/ruby/psych/issues/540
++ expect(result.instance_variable_get(:@table)).to eq({ :foo => "bar" })
++ end
+ end
+
+ it "will not deserialize objects without whitelisted tags" do
+@@ -463,10 +469,24 @@ describe YAML do
+
+ it "allows the default option to be overridden on a per-call basis" do
+ result = safe_load_round_trip(OpenStruct.new(:foo => "bar"), :whitelisted_tags => [])
+- expect(result).to eq({ "table" => { :foo => "bar" } })
++ if RUBY_VERSION < '3.0'
++ expect(result).to eq({ "table" => { :foo => "bar" } })
++ else
++ # Ruby3.0's OpenStruct's to_yaml method doesn't output the
++ # 'table' entity anymore.
++ # Ref.: https://github.com/ruby/psych/issues/540
++ expect(result).to eq({ "foo" => "bar" })
++ end
+
+ result = safe_load_round_trip(OpenStruct.new(:foo => "bar"), :deserialize_symbols => false, :whitelisted_tags => [])
+- expect(result).to eq({ "table" => { ":foo" => "bar" } })
++ if RUBY_VERSION < '3.0'
++ expect(result).to eq({ "table" => { ":foo" => "bar" } })
++ else
++ # Ruby3.0's OpenStruct's to_yaml method doesn't output the
++ # 'table' entity anymore.
++ # Ref.: https://github.com/ruby/psych/issues/540
++ expect(result).to eq({ "foo" => "bar" })
++ end
+ end
+ end
+ end