From: "akr (Akira Tanaka)" Date: 2013-11-11T16:02:25+09:00 Subject: [ruby-core:58266] [ruby-trunk - Bug #9102][Open] ObjectSpace.dump_all creates a FD without close-on-exec flag Issue #9102 has been reported by akr (Akira Tanaka). ---------------------------------------- Bug #9102: ObjectSpace.dump_all creates a FD without close-on-exec flag https://bugs.ruby-lang.org/issues/9102 Author: akr (Akira Tanaka) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.1.0dev (2013-11-11 trunk 43646) [x86_64-linux] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN I found test/objspace/test_objspace.rb creates a file descriptor without O_CLOEXEC. Ruby should create all file descriptors with close-on-exec since Ruby 2.0.0. So, this behavior is a bug (on OS which supports O_CLOEXEC). % strace -oz -f -e open ./ruby test/objspace/test_objspace.rb Run options: # Running tests: Finished tests in 3.411053s, 4.1043 tests/s, 18316.3380 assertions/s. 14 tests, 62478 assertions, 0 failures, 0 errors, 0 skips ruby -v: ruby 2.1.0dev (2013-11-11 trunk 43646) [x86_64-linux] % grep -v O_CLOEXEC z 9832 --- SIGCHLD (Child exited) @ 0 (0) --- 9836 --- SIGCHLD (Child exited) @ 0 (0) --- 9838 open("/tmp/rubyheapAk8lt8", O_RDWR|O_CREAT|O_EXCL, 0600) = 7 9840 --- SIGCHLD (Child exited) @ 0 (0) --- 9843 --- SIGCHLD (Child exited) @ 0 (0) --- 9847 --- SIGCHLD (Child exited) @ 0 (0) --- % ./ruby -v ruby 2.1.0dev (2013-11-11 trunk 43646) [x86_64-linux] I think we cannot use mkstemp(). -- http://bugs.ruby-lang.org/