ruby-changes:44712
From: nagachika <ko1@a...>
Date: Tue, 15 Nov 2016 03:15:27 +0900 (JST)
Subject: [ruby-changes:44712] nagachika:r56785 (ruby_2_3): merge revision(s) 56559, 56582, 56584, 56585: [Backport #12903]
nagachika 2016-11-15 03:15:22 +0900 (Tue, 15 Nov 2016) New Revision: 56785 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56785 Log: merge revision(s) 56559,56582,56584,56585: [Backport #12903] * test/ruby/test_file.rb (TestFile#test_stat): fix noatime case. [ruby-core:77943] [Bug #12903] * ext/-test/file/fs.c (get_atime_p): Updating of file access times is enabled or not. Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/ext/-test-/file/extconf.rb branches/ruby_2_3/ext/-test-/file/fs.c branches/ruby_2_3/test/ruby/test_file.rb branches/ruby_2_3/version.h Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 56784) +++ ruby_2_3/version.h (revision 56785) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.2" #define RUBY_RELEASE_DATE "2016-11-15" -#define RUBY_PATCHLEVEL 216 +#define RUBY_PATCHLEVEL 217 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 11 Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 56784) +++ ruby_2_3/ChangeLog (revision 56785) @@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Tue Nov 15 03:14:02 2016 NARUSE, Yui <naruse@r...> + + * ext/-test/file/fs.c (get_atime_p): Updating of file access times + is enabled or not. + +Tue Nov 15 03:14:02 2016 Nobuyoshi Nakada <nobu@r...> + + * test/ruby/test_file.rb (TestFile#test_stat): fix noatime case. + [ruby-core:77943] [Bug #12903] + Tue Nov 15 03:09:39 2016 Shugo Maeda <shugo@r...> * test/rinda/test_rinda.rb (test_make_socket_ipv6_multicast, Index: ruby_2_3/test/ruby/test_file.rb =================================================================== --- ruby_2_3/test/ruby/test_file.rb (revision 56784) +++ ruby_2_3/test/ruby/test_file.rb (revision 56785) @@ -2,6 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_file.rb#L2 require 'test/unit' require 'tempfile' require "thread" +require "-test-/file" require_relative 'ut_eof' class TestFile < Test::Unit::TestCase @@ -358,6 +359,7 @@ class TestFile < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_file.rb#L359 sleep 2 File.write(path, "bar") sleep 2 + File.read(path) File.chmod(0644, path) sleep 2 File.read(path) @@ -369,7 +371,7 @@ class TestFile < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_file.rb#L371 if stat.birthtime != stat.ctime assert_in_delta t0+4, stat.ctime.to_f, delta end - unless /mswin|mingw/ =~ RUBY_PLATFORM + if /mswin|mingw/ !~ RUBY_PLATFORM && !Bug::File::Fs.noatime?(path) # Windows delays updating atime assert_in_delta t0+6, stat.atime.to_f, delta end Index: ruby_2_3/ext/-test-/file/extconf.rb =================================================================== --- ruby_2_3/ext/-test-/file/extconf.rb (revision 56784) +++ ruby_2_3/ext/-test-/file/extconf.rb (revision 56785) @@ -5,6 +5,7 @@ headers = %w[sys/param.h sys/mount.h sys https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/-test-/file/extconf.rb#L5 if have_type("struct statfs", headers) have_struct_member("struct statfs", "f_fstypename", headers) have_struct_member("struct statfs", "f_type", headers) + have_struct_member("struct statfs", "f_flags", headers) end headers = %w[sys/statvfs.h].select {|h| have_header(h)} Index: ruby_2_3/ext/-test-/file/fs.c =================================================================== --- ruby_2_3/ext/-test-/file/fs.c (revision 56784) +++ ruby_2_3/ext/-test-/file/fs.c (revision 56785) @@ -36,6 +36,12 @@ typedef struct statvfs statfs_t; https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/-test-/file/fs.c#L36 # if defined HAVE_STRUCT_STATVFS_F_TYPE # define HAVE_STRUCT_STATFS_T_F_TYPE 1 # endif +#elif defined(HAVE_STRUCT_STATFS_F_TYPE) /* Linux */ +typedef struct statfs statfs_t; +# define STATFS(f, s) statfs((f), (s)) +# if defined HAVE_STRUCT_STATFS_F_TYPE +# define HAVE_STRUCT_STATFS_T_F_TYPE 1 +# endif #endif VALUE @@ -72,9 +78,31 @@ get_fsname(VALUE self, VALUE str) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/-test-/file/fs.c#L78 return Qnil; } +VALUE +get_noatime_p(VALUE self, VALUE str) +{ +#ifdef STATFS + statfs_t st; + FilePathValue(str); + str = rb_str_encode_ospath(str); + if (STATFS(StringValueCStr(str), &st) == -1) { + rb_sys_fail_str(str); + } +# ifdef HAVE_STRUCT_STATFS_F_FLAGS +# ifdef MNT_NOATIME + return st.f_flags & MNT_NOATIME ? Qtrue : Qfalse; +# elif defined(ST_NOATIME) + return st.f_flags & ST_NOATIME ? Qtrue : Qfalse; +# endif +# endif +#endif + return Qnil; +} + void Init_fs(VALUE module) { VALUE fs = rb_define_module_under(module, "Fs"); rb_define_module_function(fs, "fsname", get_fsname, 1); + rb_define_module_function(fs, "noatime?", get_noatime_p, 1); } Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r56559,56582,56584-56585 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/