#63 Fix FTBFS due to libyaml 0.2.5.
Merged 3 years ago by vondruch. Opened 4 years ago by jaruga.
Unknown source wip/ftbfs-psych-tests  into  master

@@ -0,0 +1,162 @@

+ From 3c55d93cf68b1a969b90b306de4dd8b88d74a2f2 Mon Sep 17 00:00:00 2001

+ From: nagachika <nagachika@ruby-lang.org>

+ Date: Sat, 13 Jun 2020 11:29:51 +0900

+ Subject: [PATCH] merge revision(s) 7e289cdf3fed588b2d5a6973e29f9ff95cb8d76c:

+  [Backport #16949]

+ 

+ 	[ruby/psych] Fixing compatibility with libyaml 0.2.5

+ 

+ 	The main issue is that commas aren't allowed in local tags.  libyaml

+ 	was updated to follow the spec, and our tests were out of date.

+ 

+ 	See: https://github.com/yaml/libyaml/issues/196

+ 

+ 	https://github.com/ruby/psych/commit/3f5e520fd3

+ ---

+  test/psych/test_nil.rb   |  4 ++--

+  test/psych/test_psych.rb | 17 +++++++----------

+  test/psych/test_yaml.rb  | 24 ++++++++++++------------

+  version.h                |  4 ++--

+  4 files changed, 23 insertions(+), 26 deletions(-)

+ 

+ diff --git a/test/psych/test_nil.rb b/test/psych/test_nil.rb

+ index 910a2e697def..bcbbcb9c9397 100644

+ --- a/test/psych/test_nil.rb

+ +++ b/test/psych/test_nil.rb

+ @@ -5,13 +5,13 @@ module Psych

+    class TestNil < TestCase

+      def test_nil

+        yml = Psych.dump nil

+ -      assert_match(/--- \n(?:\.\.\.\n)?/, yml)

+ +      assert_match(/---[ ]?\n(?:\.\.\.\n)?/, yml)

+        assert_nil Psych.load(yml)

+      end

+  

+      def test_array_nil

+        yml = Psych.dump [nil]

+ -      assert_equal "---\n- \n", yml

+ +      assert_match(/---\n-[ ]?\n/, yml)

+        assert_equal [nil], Psych.load(yml)

+      end

+  

+ diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb

+ index eeadc864ef4e..e557feffb76a 100644

+ --- a/test/psych/test_psych.rb

+ +++ b/test/psych/test_psych.rb

+ @@ -178,17 +178,17 @@ def test_add_builtin_type

+  

+    def test_domain_types

+      got = nil

+ -    Psych.add_domain_type 'foo.bar,2002', 'foo' do |type, val|

+ +    Psych.add_domain_type 'foo.bar/2002', 'foo' do |type, val|

+        got = val

+      end

+  

+ -    Psych.load('--- !foo.bar,2002/foo hello')

+ +    Psych.load('--- !foo.bar/2002:foo hello')

+      assert_equal 'hello', got

+  

+ -    Psych.load("--- !foo.bar,2002/foo\n- hello\n- world")

+ +    Psych.load("--- !foo.bar/2002:foo\n- hello\n- world")

+      assert_equal %w{ hello world }, got

+  

+ -    Psych.load("--- !foo.bar,2002/foo\nhello: world")

+ +    Psych.load("--- !foo.bar/2002:foo\nhello: world")

+      assert_equal({ 'hello' => 'world' }, got)

+    end

+  

+ @@ -295,16 +295,13 @@ def test_callbacks

+      types = []

+      appender = lambda { |*args| types << args }

+  

+ -    Psych.add_builtin_type('foo', &appender)

+ -    Psych.add_domain_type('example.com,2002', 'foo', &appender)

+ +    Psych.add_domain_type('example.com:2002', 'foo', &appender)

+      Psych.load <<-eoyml

+ -- !tag:yaml.org,2002:foo bar

+ -- !tag:example.com,2002:foo bar

+ +- !tag:example.com:2002:foo bar

+      eoyml

+  

+      assert_equal [

+ -      ["tag:yaml.org,2002:foo", "bar"],

+ -      ["tag:example.com,2002:foo", "bar"]

+ +      ["tag:example.com:2002:foo", "bar"]

+      ], types

+    end

+  

+ diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb

+ index 5fa759c981b2..0dfd60f89434 100644

+ --- a/test/psych/test_yaml.rb

+ +++ b/test/psych/test_yaml.rb

+ @@ -617,11 +617,11 @@ def test_spec_domain_prefix

+                  raise ArgumentError, "Not a Hash in domain.tld,2002/invoice: " + val.inspect

+              end

+          }

+ -        Psych.add_domain_type( "domain.tld,2002", 'invoice', &customer_proc )

+ -        Psych.add_domain_type( "domain.tld,2002", 'customer', &customer_proc )

+ +        Psych.add_domain_type( "domain.tld/2002", 'invoice', &customer_proc )

+ +        Psych.add_domain_type( "domain.tld/2002", 'customer', &customer_proc )

+  		assert_parse_only( { "invoice"=> { "customers"=> [ { "given"=>"Chris", "type"=>"domain customer", "family"=>"Dumars" } ], "type"=>"domain invoice" } }, <<EOY

+  # 'http://domain.tld,2002/invoice' is some type family.

+ -invoice: !domain.tld,2002/invoice

+ +invoice: !domain.tld/2002:invoice

+    # 'seq' is shorthand for 'http://yaml.org/seq'.

+    # This does not effect '^customer' below

+    # because it is does not specify a prefix.

+ @@ -705,7 +705,7 @@ def test_spec_override_anchor

+  	end

+  

+  	def test_spec_explicit_families

+ -        Psych.add_domain_type( "somewhere.com,2002", 'type' ) { |type, val|

+ +        Psych.add_domain_type( "somewhere.com/2002", 'type' ) { |type, val|

+              "SOMEWHERE: #{val}"

+          }

+  		assert_parse_only(

+ @@ -717,7 +717,7 @@ def test_spec_explicit_families

+   Pz7Y6OjuDg4J+fn5OTk6enp

+   56enmleECcgggoBADs=

+  

+ -hmm: !somewhere.com,2002/type |

+ +hmm: !somewhere.com/2002:type |

+   family above is short for

+   http://somewhere.com/type

+  EOY

+ @@ -726,7 +726,7 @@ def test_spec_explicit_families

+  

+  	def test_spec_application_family

+  		# Testing the clarkevans.com graphs

+ -		Psych.add_domain_type( "clarkevans.com,2002", 'graph/shape' ) { |type, val|

+ +		Psych.add_domain_type( "clarkevans.com/2002", 'graph/shape' ) { |type, val|

+  			if Array === val

+  				val << "Shape Container"

+  				val

+ @@ -743,13 +743,13 @@ def test_spec_application_family

+  				raise ArgumentError, "Invalid graph of type #{val.class}: " + val.inspect

+  			end

+  		}

+ -		Psych.add_domain_type( "clarkevans.com,2002", 'graph/circle', &one_shape_proc )

+ -		Psych.add_domain_type( "clarkevans.com,2002", 'graph/line', &one_shape_proc )

+ -		Psych.add_domain_type( "clarkevans.com,2002", 'graph/text', &one_shape_proc )

+ +		Psych.add_domain_type( "clarkevans.com/2002", 'graph/circle', &one_shape_proc )

+ +		Psych.add_domain_type( "clarkevans.com/2002", 'graph/line', &one_shape_proc )

+ +		Psych.add_domain_type( "clarkevans.com/2002", 'graph/text', &one_shape_proc )

+          # MODIFIED to remove invalid Psych

+  		assert_parse_only(

+  			[[{"radius"=>7, "center"=>{"x"=>73, "y"=>129}, "TYPE"=>"Shape: graph/circle"}, {"finish"=>{"x"=>89, "y"=>102}, "TYPE"=>"Shape: graph/line", "start"=>{"x"=>73, "y"=>129}}, {"TYPE"=>"Shape: graph/text", "value"=>"Pretty vector drawing.", "start"=>{"x"=>73, "y"=>129}, "color"=>16772795}, "Shape Container"]], <<EOY

+ -- !clarkevans.com,2002/graph/shape

+ +- !clarkevans.com/2002:graph/shape

+    - !/graph/circle

+      center: &ORIGIN {x: 73, y: 129}

+      radius: 7

+ @@ -771,8 +771,8 @@ def test_spec_float_explicit

+  # have the same type and value.

+  - 10.0

+  - !float 10

+ -- !yaml.org,2002/float '10'

+ -- !yaml.org,2002/float "\\

+ +- !yaml.org/2002/float '10'

+ +- !yaml.org/2002/float "\\

+    1\\

+    0"

+  EOY

file modified
+4
@@ -154,6 +154,9 @@

  # Prevent issues with openssl loading when RubyGems are disabled.

  # https://github.com/ruby/openssl/pull/242

  Patch13: ruby-2.8.0-remove-unneeded-gem-require-for-ipaddr.patch

+ # Fix compatibility with libyaml 0.2.5

+ # https://bugs.ruby-lang.org/issues/16949

+ Patch14: ruby-2.7.2-psych-fix-yaml-tests.patch

  

  # Add support for .include directive used by OpenSSL config files.

  # https://github.com/ruby/openssl/pull/216
@@ -567,6 +570,7 @@

  %patch11 -p1

  %patch12 -p1

  %patch13 -p1

+ %patch14 -p1

  %patch22 -p1

  

  # Provide an example of usage of the tapset:

Resolves: rhbz#1845530

This PR is to fix the test failures due to libyaml 0.2.5.

root.log

libyaml-devel             x86_64    0.2.5-1.fc33

rpmlint

Okay. the following one is the false positive.
Because http://ruby-lang.org/ redirects to https://www.ruby-lang.org/en/.

ruby.src: W: invalid-url URL: http://ruby-lang.org/ <urlopen error [Errno -2] Name or service not known>
The value should be a valid, public HTTP, HTTPS, or FTP URL.

Right, so what about fixing the website URL to https://www.ruby-lang.org/ ?

$ curl -I https://www.ruby-lang.org/ 
HTTP/2 200 
server: Cowboy
strict-transport-security: max-age=31536000
content-type: text/html
etag: W/"127ad6ec36e7d932ac2d49a47572b4d9"
x-frame-options: SAMEORIGIN
via: 1.1 vegur
accept-ranges: bytes
date: Wed, 10 Jun 2020 10:34:23 GMT
via: 1.1 varnish
age: 30
x-served-by: cache-hhn4025-HHN
x-cache: HIT
x-cache-hits: 1
x-timer: S1591785263.325105,VS0,VE1
vary: Accept-Encoding
content-length: 864

Also, there's no release bump, so there's no intention to build it?

Also, there's no release bump, so there's no intention to build it?

Yes, there is no intention for me.

My purpose was to for this PR.
https://src.fedoraproject.org/rpms/ruby/pull-request/62

But if you like the bump for the PR, I will do it.

Right, so what about fixing the website URL to https://www.ruby-lang.org/ ?

Agree on it.

I noticed the patch has already been applied to the Ruby master branch as I saw the backport request ticket [1].
https://github.com/ruby/ruby/commit/7e289cdf3fed588b2d5a6973e29f9ff95cb8d76c
Maybe it's better to change the comment URL to this one.

[1] https://bugs.ruby-lang.org/issues/16949

rebased onto 0963ae5

3 years ago

Pull-Request has been merged by vondruch

3 years ago