Bug #9102
closedObjectSpace.dump_all creates a FD without close-on-exec flag
Description
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().