Fix File.utime test.

This commit is to fix the following test failure on CentOS Stream Zuul CI
mock-build.

```
DEBUG: 1)
DEBUG: File.utime allows Time instances in the far future to set mtime and atime (but some filesystems limit it up to 2446-05-10 or 2038-01-19) FAILED
DEBUG: Expected [559444, 2446, 2038].include? 2486
DEBUG: to be truthy but was false
DEBUG: /builddir/build/BUILD/ruby-3.0.4/spec/ruby/core/file/utime_spec.rb:84:in `block (4 levels) in <top (required)>'
DEBUG: /builddir/build/BUILD/ruby-3.0.4/spec/ruby/core/file/utime_spec.rb:3:in `<top (required)>'
DEBUG: Finished in 77.102196 seconds
DEBUG: 3769 files, 30810 examples, 179414 expectations, 1 failure, 0 errors, 0 tagged
```

Related: rhbz#2173531
This commit is contained in:
Jun Aruga 2023-06-28 16:46:24 +02:00
parent 0894b8f7a4
commit b1838b763e
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,36 @@
From 8d1109c03bacc952b6218af2e4ae9b74c9855273 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@ruby-lang.org>
Date: Wed, 22 Mar 2023 16:10:06 +0900
Subject: [PATCH] Added assertion values for Amazon Linux 2023
---
spec/ruby/core/file/utime_spec.rb | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/spec/ruby/core/file/utime_spec.rb b/spec/ruby/core/file/utime_spec.rb
index a191e2924037c..0b0e4f979c935 100644
--- a/spec/ruby/core/file/utime_spec.rb
+++ b/spec/ruby/core/file/utime_spec.rb
@@ -72,17 +72,19 @@
platform_is :linux do
platform_is wordsize: 64 do
- it "allows Time instances in the far future to set mtime and atime (but some filesystems limit it up to 2446-05-10 or 2038-01-19)" do
+ it "allows Time instances in the far future to set mtime and atime (but some filesystems limit it up to 2446-05-10 or 2038-01-19 or 2486-07-02)" do
# https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Inode_Timestamps
# "Therefore, timestamps should not overflow until May 2446."
# https://lwn.net/Articles/804382/
# "On-disk timestamps hitting the y2038 limit..."
# The problem seems to be being improved, but currently it actually fails on XFS on RHEL8
# https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel8/ruby-master/log/20201112T123004Z.fail.html.gz
+ # Amazon Linux 2023 returns 2486-07-02 in this example
+ # http://rubyci.s3.amazonaws.com/amazon2023/ruby-master/log/20230322T063004Z.fail.html.gz
time = Time.at(1<<44)
File.utime(time, time, @file1)
- [559444, 2446, 2038].should.include? File.atime(@file1).year
- [559444, 2446, 2038].should.include? File.mtime(@file1).year
+ [559444, 2486, 2446, 2038].should.include? File.atime(@file1).year
+ [559444, 2486, 2446, 2038].should.include? File.mtime(@file1).year
end
end
end

View File

@ -271,6 +271,9 @@ Patch62: ruby-spec-Fix-tests-on-tzdata-2022b.patch
# https://bugs.ruby-lang.org/issues/19187
# https://github.com/ruby/ruby/commit/a1124dc162810f86cb0bff58cde24064cfc561bc
Patch63: ruby-3.1.3-Fix-for-tzdata-2022g.patch
# Fix File.utime test.
# https://github.com/ruby/ruby/commit/8d1109c03bacc952b6218af2e4ae9b74c9855273
Patch64: ruby-3.3.0-test-file-utime.patch
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Suggests: rubypick
@ -739,6 +742,7 @@ rm -rf ext/fiddle/libffi*
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
# Provide an example of usage of the tapset:
cp -a %{SOURCE3} .
@ -1506,6 +1510,7 @@ OPENSSL_ENABLE_SHA1_SIGNATURES=1 \
- Bypass git submodule test failure on Git >= 2.38.1.
- Fix tests with Europe/Amsterdam pre-1970 time on tzdata version 2022b.
- Fix for tzdata-2022g.
- Fix File.utime test.
* Fri Jul 08 2022 Jarek Prokop <jprokop@redhat.com> - 3.0.4-160
- Upgrade to Ruby 3.0.4.