From 17d1b767cb78ce2dec3b056ba00035abe21d2c26 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Wed, 24 Aug 2022 13:44:41 +0200 Subject: [PATCH] Fix tests with Europe/Amsterdam pre-1970 time on tzdata version 2022b. This commit was cherry-picked from Fedora rawhide . This fixes the test failures related to the Amsterdam time zone like below. ``` 1) Time.local timezone changes correctly adjusts the timezone change to 'CEST' on 'Europe/Amsterdam' FAILED Expected [0, 0, 0, 16, 5, 1940, 4, 137, true, "WEST"] == [0, 40, 1, 16, 5, 1940, 4, 137, true, "CEST"] to be truthy but was false /builddir/build/BUILD/ruby-3.0.4/spec/ruby/core/time/shared/local.rb:13:in `block (5 levels) in ' /builddir/build/BUILD/ruby-3.0.4/spec/ruby/core/time/shared/local.rb:12:in `block (4 levels) in ' /builddir/build/BUILD/ruby-3.0.4/spec/ruby/core/time/local_spec.rb:5:in `' ``` Related: rhbz#2173531 --- ruby-spec-Fix-tests-on-tzdata-2022b.patch | 40 +++++++++++++++++++++++ ruby.spec | 5 +++ 2 files changed, 45 insertions(+) create mode 100644 ruby-spec-Fix-tests-on-tzdata-2022b.patch diff --git a/ruby-spec-Fix-tests-on-tzdata-2022b.patch b/ruby-spec-Fix-tests-on-tzdata-2022b.patch new file mode 100644 index 0000000..19386d9 --- /dev/null +++ b/ruby-spec-Fix-tests-on-tzdata-2022b.patch @@ -0,0 +1,40 @@ +From 7e9ec8a20b0f7469b415283d2ec0c22087f8eb2b Mon Sep 17 00:00:00 2001 +From: Jun Aruga +Date: Wed, 24 Aug 2022 12:02:56 +0200 +Subject: [PATCH] Fix tests with Europe/Amsterdam pre-1970 time on tzdata + version 2022b. + +The Time Zone Database (tzdata) changed the pre-1970 timestamps in some zones +including Europe/Amsterdam on tzdata version 2022b or later. +See . + +The tzdata RPM package maintainer on Fedora project suggested changing the Ruby +test, because the change is intentional. +See . + +We use post-1970 time test data to simplify the test. +--- + core/time/shared/local.rb | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/spec/ruby/core/time/shared/local.rb b/spec/ruby/core/time/shared/local.rb +index 43f331c4c..c4aa7a7ea 100644 +--- a/spec/ruby/core/time/shared/local.rb ++++ b/spec/ruby/core/time/shared/local.rb +@@ -8,10 +8,10 @@ describe :time_local, shared: true do + + platform_is_not :windows do + describe "timezone changes" do +- it "correctly adjusts the timezone change to 'CEST' on 'Europe/Amsterdam'" do ++ it "correctly adjusts the timezone change to 'CET' on 'Europe/Amsterdam'" do + with_timezone("Europe/Amsterdam") do +- Time.send(@method, 1940, 5, 16).to_a.should == +- [0, 40, 1, 16, 5, 1940, 4, 137, true, "CEST"] ++ Time.send(@method, 1970, 5, 16).to_a.should == ++ [0, 0, 0, 16, 5, 1970, 6, 136, false, "CET"] + end + end + end +-- +2.36.1 + diff --git a/ruby.spec b/ruby.spec index 97b3a62..01c548b 100644 --- a/ruby.spec +++ b/ruby.spec @@ -264,6 +264,9 @@ Patch60: ruby-3.1.2-ossl-tests-replace-sha1.patch # Bypass git submodule test failure on Git >= 2.38.1. # https://github.com/ruby/ruby/pull/6587 Patch61: ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch +# Fix tests with Europe/Amsterdam pre-1970 time on tzdata version 2022b. +# https://github.com/ruby/spec/pull/939 +Patch62: ruby-spec-Fix-tests-on-tzdata-2022b.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} Suggests: rubypick @@ -730,6 +733,7 @@ rm -rf ext/fiddle/libffi* %patch59 %patch60 -p1 %patch61 -p1 +%patch62 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -1495,6 +1499,7 @@ OPENSSL_ENABLE_SHA1_SIGNATURES=1 \ %changelog * Wed Jun 28 2023 Jun Aruga - 3.0.4-160 - Bypass git submodule test failure on Git >= 2.38.1. +- Fix tests with Europe/Amsterdam pre-1970 time on tzdata version 2022b. * Fri Jul 08 2022 Jarek Prokop - 3.0.4-160 - Upgrade to Ruby 3.0.4.