ruby-changes:62872
From: Yusuke <ko1@a...>
Date: Wed, 9 Sep 2020 22:48:38 +0900 (JST)
Subject: [ruby-changes:62872] 3590f08244 (ruby_2_7): spec/ruby/core/file/utime_spec.rb: far future timestamp may be trancated
https://git.ruby-lang.org/ruby.git/commit/?id=3590f08244 From 3590f082442afc4506250f5274a7877371a112de Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Sun, 9 Feb 2020 11:04:53 +0900 Subject: spec/ruby/core/file/utime_spec.rb: far future timestamp may be trancated Under some Ext4 filesystem settings, a timestamp is limited up to 0x37fffffff (2446-05-10). https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Inode_Timestamps > Therefore, timestamps should not overflow until May 2446. Actually the spec fails under one of our CI environments, like: ``` 1) File.utime allows Time instances in the far future to set mtime and atime FAILED Expected 2446 == 559444 to be truthy but was false ``` https://rubyci.org/logs/rubyci.s3.amazonaws.com/arch/ruby-master/log/20200208T180002Z.fail.html.gz diff --git a/spec/ruby/core/file/utime_spec.rb b/spec/ruby/core/file/utime_spec.rb index 03adc76..9c198af 100644 --- a/spec/ruby/core/file/utime_spec.rb +++ b/spec/ruby/core/file/utime_spec.rb @@ -72,11 +72,13 @@ 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" 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 + # https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Inode_Timestamps + # "Therefore, timestamps should not overflow until May 2446." time = Time.at(1<<44) File.utime(time, time, @file1) - File.atime(@file1).year.should == 559444 - File.mtime(@file1).year.should == 559444 + [559444, 2446].should.include? File.atime(@file1).year + [559444, 2446].should.include? File.mtime(@file1).year end end end diff --git a/version.h b/version.h index 7f37a34..70cd6ac 100644 --- a/version.h +++ b/version.h @@ -2,11 +2,11 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L2 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 123 +#define RUBY_PATCHLEVEL 124 #define RUBY_RELEASE_YEAR 2020 #define RUBY_RELEASE_MONTH 9 -#define RUBY_RELEASE_DAY 7 +#define RUBY_RELEASE_DAY 9 #include "ruby/version.h" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/