ruby-changes:69564
From: V=C3=ADt <ko1@a...>
Date: Tue, 2 Nov 2021 19:12:49 +0900 (JST)
Subject: [ruby-changes:69564] c2dcaa7362 (master): [rubygems/rubygems] Use OpenSSL constants for error codes.
https://git.ruby-lang.org/ruby.git/commit/?id=c2dcaa7362 From c2dcaa73626ab7a44dcc357d9751d9e2285d56ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@r...> Date: Mon, 1 Nov 2021 18:40:06 +0100 Subject: [rubygems/rubygems] Use OpenSSL constants for error codes. This fixes the following test error testing against OpenSSL 3.x: ~~~ 2) Failure: TestGemRequest#test_verify_certificate_extra_message [/builddir/build/BUILD/ruby-3.0.2/test/rubygems/test_gem_request.rb:358]: <"ERROR: SSL verification error at depth 0: invalid CA certificate (24)\n" + "ERROR: Certificate is an invalid CA certificate\n"> expected but was <"ERROR: SSL verification error at depth 0: invalid CA certificate (79)\n" + "ERROR: Certificate is an invalid CA certificate\n">. ~~~ Where the root cause is this OpenSSL commit: https://github.com/openssl/openssl/commit/1e41dadfa7b9f792ed0f4714a3d3d36f070cf30e It seems that OpenSSL upstream considers the constant value just an implementation detail and therefore this changes the test case to follow the suite. https://github.com/rubygems/rubygems/commit/8acf8e95dc --- test/rubygems/test_gem_request.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/rubygems/test_gem_request.rb b/test/rubygems/test_gem_request.rb index 66477be7bc0..47654f6fa41 100644 --- a/test/rubygems/test_gem_request.rb +++ b/test/rubygems/test_gem_request.rb @@ -354,30 +354,36 @@ class TestGemRequest < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request.rb#L354 def test_verify_certificate pend if Gem.java_platform? + + error_number = OpenSSL::X509::V_ERR_OUT_OF_MEM + store = OpenSSL::X509::Store.new context = OpenSSL::X509::StoreContext.new store - context.error = OpenSSL::X509::V_ERR_OUT_OF_MEM + context.error = error_number use_ui @ui do Gem::Request.verify_certificate context end - assert_equal "ERROR: SSL verification error at depth 0: out of memory (17)\n", + assert_equal "ERROR: SSL verification error at depth 0: out of memory (#{error_number})\n", @ui.error end def test_verify_certificate_extra_message pend if Gem.java_platform? + + error_number = OpenSSL::X509::V_ERR_INVALID_CA + store = OpenSSL::X509::Store.new context = OpenSSL::X509::StoreContext.new store - context.error = OpenSSL::X509::V_ERR_INVALID_CA + context.error = error_number use_ui @ui do Gem::Request.verify_certificate context end expected = <<-ERROR -ERROR: SSL verification error at depth 0: invalid CA certificate (24) +ERROR: SSL verification error at depth 0: invalid CA certificate (#{error_number}) ERROR: Certificate is an invalid CA certificate ERROR -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/