From 898374126e2c2632bc9bf0308407898af1f4ff82 Mon Sep 17 00:00:00 2001 From: kosaki Date: Thu, 19 May 2011 12:18:41 +0000 Subject: revert O_CLOEXEC patch series completely. because boron chkbuild test result says, An old linux kernel ignore O_CLOEXEC silently instead of return an error. It may lead to bring new security risk. So, we have to be pending it until finish to implement proper fallback logic. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 15 --------------- io.c | 4 ---- test/ruby/test_io.rb | 51 --------------------------------------------------- 3 files changed, 70 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2476f2460a..48efd6855f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -111,10 +111,6 @@ Wed May 18 03:03:07 2011 Eric Hodel * lib/singleton.rb: Improve documentation. Patch by Pete Higgins. [Ruby 1.9 - Bug #4709] -Wed May 18 01:02:53 2011 KOSAKI Motohiro - - * test/ruby/test_io.rb (TestIO#test_O_CLOEXEC): add null check. - Tue May 17 21:24:04 2011 KOSAKI Motohiro * thread.c (rb_mutex_lock): remove remove_signal_thread_list() call. @@ -794,11 +790,6 @@ Fri May 6 14:25:53 2011 Tinco Andringa * ext/syck/rubyext.c (mktime_do): YAML.load time correctly parse usecs smaller than 1 fixes #4571 -Thu May 5 23:08:32 2011 KOSAKI Motohiro - - * test/ruby/test_io.rb (TestIO#test_O_CLOEXEC): fix false positive - detection. - Thu May 5 22:23:34 2011 KOSAKI Motohiro * thread_pthread.c (native_mutex_reinitialize_atfork): removed @@ -839,12 +830,6 @@ Wed May 4 21:11:28 2011 KOSAKI Motohiro * benchmark/bm_io_select2.rb: reduce number of using file descriptors. because gdb need some fds. -Wed May 4 20:22:12 2011 KOSAKI Motohiro - - * io.c (Init_IO): Added File::CLOEXEC constant. - [ruby-core:22893] [Feature #1291] - * test/ruby/test_io.rb (TestIO#test_o_cloexec): test for File::CLOEXEC. - Wed May 4 19:00:59 2011 KOSAKI Motohiro * thread.c (rb_wait_for_single_fd): Fix wrong return value. diff --git a/io.c b/io.c index 925bfd4ea0..154a01943b 100644 --- a/io.c +++ b/io.c @@ -10573,10 +10573,6 @@ Init_IO(void) /* Try to minimize cache effects of the I/O to and from this file. */ rb_file_const("DIRECT", INT2FIX(O_DIRECT)); #endif -#ifdef O_CLOEXEC - /* enable close-on-exec flag */ - rb_file_const("CLOEXEC", INT2FIX(O_CLOEXEC)); /* Linux, POSIX-2008. */ -#endif sym_mode = ID2SYM(rb_intern("mode")); sym_perm = ID2SYM(rb_intern("perm")); diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index f5f49f3efa..de55abbd41 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1238,57 +1238,6 @@ class TestIO < Test::Unit::TestCase end end - def test_O_CLOEXEC - if !defined? File::CLOEXEC - return - end - - mkcdtmpdir do - ary = [] - begin - 10.times { - ary.concat IO.pipe - } - - normal_file = Tempfile.new("normal_file"); - assert_equal(false, normal_file.close_on_exec?) - cloexec_file = Tempfile.new("cloexec_file", :mode => File::CLOEXEC); - assert_equal(true, cloexec_file.close_on_exec?) - arg, argw = IO.pipe - argw.puts normal_file.fileno - argw.puts cloexec_file.fileno - argw.flush - ret, retw = IO.pipe - - while (e = ary.shift) != nil - e.close - end - - spawn("ruby", "-e", <<-'End', :close_others=>false, :in=>arg, :out=>retw) - begin - puts IO.for_fd(gets.to_i).fileno - puts IO.for_fd(gets.to_i).fileno - rescue - puts "nofile" - ensure - exit - end - End - retw.close - Process.wait - assert_equal("#{normal_file.fileno}\nnofile\n", ret.read) - ensure - while (e = ary.shift) != nil - e.close - end - arg.close unless !arg || arg.closed? - argw.close unless !argw || argw.closed? - ret.close unless !ret || ret.closed? - retw.close unless !retw || retw.closed? - end - end - end - def test_close_security_error with_pipe do |r, w| assert_raise(SecurityError) do -- cgit v1.2.3