[前][次][番号順一覧][スレッド一覧]

ruby-changes:63593

From: Yusuke <ko1@a...>
Date: Thu, 12 Nov 2020 23:39:45 +0900 (JST)
Subject: [ruby-changes:63593] 6325866421 (master): spec/ruby/core/file/utime_spec.rb: XFS seems to have Year 2038 problem

https://git.ruby-lang.org/ruby.git/commit/?id=6325866421

From 6325866421d552c43ecc0f631fc9e848f9a2862f Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Thu, 12 Nov 2020 23:36:47 +0900
Subject: spec/ruby/core/file/utime_spec.rb: XFS seems to have Year 2038
 problem

https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel8/ruby-master/log/20201112T123004Z.fail.html.gz
```
1)
File.utime allows Time instances in the far future to set mtime and
atime (but some filesystems limit it up to 2446-05-10) FAILED
Expected [559444, 2446].include? 2038
to be truthy but was false
/home/chkbuild/chkbuild/tmp/build/20201112T123004Z/ruby/spec/ruby/core/file/utime_spec.rb:80:in
`block (4 levels) in <top (required)>'
/home/chkbuild/chkbuild/tmp/build/20201112T123004Z/ruby/spec/ruby/core/file/utime_spec.rb:3:in
`<top (required)>'
```

```
$ touch foo
$ ./miniruby -e 'time = Time.at(1<<44); File.utime(time, time, "foo")'
$ ls -l foo
-rw-r--r--. 1 mame wheel 0 Jan 19  2038 foo
```

diff --git a/spec/ruby/core/file/utime_spec.rb b/spec/ruby/core/file/utime_spec.rb
index 96627b1..19cb80d 100644
--- a/spec/ruby/core/file/utime_spec.rb
+++ b/spec/ruby/core/file/utime_spec.rb
@@ -72,13 +72,17 @@ describe "File.utime" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/file/utime_spec.rb#L72
 
   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)" 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
         # 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
         time = Time.at(1<<44)
         File.utime(time, time, @file1)
-        [559444, 2446].should.include? File.atime(@file1).year
-        [559444, 2446].should.include? File.mtime(@file1).year
+        [559444, 2446, 2038].should.include? File.atime(@file1).year
+        [559444, 2446, 2038].should.include? File.mtime(@file1).year
       end
     end
   end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]