Project

General

Profile

Actions

Bug #7789

closed

test_setsid fails for OpenBSD

Added by kernigh (George Koehler) about 11 years ago. Updated about 11 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.0.0dev (2013-02-06 trunk 39081) [x86_64-openbsd5.2]
Backport:
[ruby-core:51889]

Description

=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


Files

setsid-openbsd.diff (815 Bytes) setsid-openbsd.diff skip the Process::getsid(pid) in the test kernigh (George Koehler), 02/06/2013 08:31 AM

Updated by kosaki (Motohiro KOSAKI) about 11 years ago

  • Category set to core
  • Status changed from Open to Assigned
  • Assignee set to kosaki (Motohiro KOSAKI)
  • Target version set to 2.0.0

Updated by kosaki (Motohiro KOSAKI) about 11 years ago

The only fix is to skip the Process::getsid(pid) in the test. I wrote a patch for this.

OK. I agree with skipping test. But I would like to just skip instead of your approach.

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?

Yeah! You are right. I'll fix this.

Actions #3

Updated by kosaki (Motohiro KOSAKI) about 11 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39097.
George, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • test/ruby/test_process.rb (test_setsid): skip when platform is
    OpenBSD. Contributed from George Koehler.
    [Bug #7789] [ruby-core:51889]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0