Issue #7789 has been reported by kernigh (George Koehler).

----------------------------------------
Bug #7789: test_setsid fails for OpenBSD
https://bugs.ruby-lang.org/issues/7789

Author: kernigh (George Koehler)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0dev (2013-02-06 trunk 39081) [x86_64-openbsd5.2]


=begin
TestProcess#test_setsid always fails because OpenBSD doesn't allow Process::getsid(pid) when the pid is in a different session. Quoting man getsid, "[EPERM] The current process and the process pid are not in the same session."

How to reproduce:

 $ make test-all TESTS='ruby/test_process.rb -n test_setsid'
 CC = gcc
 LD = ld
 LDSHARED = gcc -shared 
 CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration -ansi -std=iso9899:199409 
 XCFLAGS = -include ruby/config.h -include ruby/missing.h -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
 CPPFLAGS = -I/usr/local/include   -I. -I.ext/include/x86_64-openbsd5.2 -I../include -I..
 DLDFLAGS = -fstack-protector -pie  
 SOLIBS = 
 ./miniruby -I../lib -I. -I.ext/common  ../tool/runruby.rb --extout=.ext  -- --disable-gems "../test/runner.rb" --ruby="./miniruby -I../lib -I. -I.ext/common  ../tool/runruby.rb --extout=.ext  -- --disable-gems"  ruby/test_process.rb -n test_setsid
 Run options: "--ruby=./miniruby -I../lib -I. -I.ext/common  ../tool/runruby.rb --extout=.ext  -- --disable-gems" -n test_setsid
 
 # Running tests:
 
 [1/1] TestProcess#test_setsid = 3.04 s
 1) Error:
 test_setsid(TestProcess):
 Errno::EPERM: Operation not permitted
 /home/kernigh/park/ruby/test/ruby/test_process.rb:1589:in `getsid'
 /home/kernigh/park/ruby/test/ruby/test_process.rb:1589:in `block in test_setsid'
 /home/kernigh/park/ruby/test/ruby/test_process.rb:1578:in `popen'
 /home/kernigh/park/ruby/test/ruby/test_process.rb:1578:in `test_setsid'
 
 Finished tests in 3.050209s, 0.3278 tests/s, 0.3278 assertions/s.
 1 tests, 1 assertions, 0 failures, 1 errors, 0 skips
 
 ruby -v: ruby 2.0.0dev (2013-02-06 trunk 39081) [x86_64-openbsd5.2]
 *** Error code 1
 
 Stop in /home/kernigh/park/ruby/build (line 977 of Makefile).

The only fix is to skip the Process::getsid(pid) in the test. I wrote a patch for this. My patch does not call the skip method, because I was not sure how to call it. I don't want to skip the whole test.

While I am looking at this test, I see that it calls (({Process.kill(:KILL, io.pid)})) but never reaps the zombie process. Shouldn't it call (({Process.wait(io.pid)})) after that?

=end



-- 
http://bugs.ruby-lang.org/