Forum: Ruby-core [ruby-trunk - Bug #7789][Open] test_setsid fails for OpenBSD

Posted by kernigh (George Koehler) (Guest)
on 2013-02-06 00:36
(Received via mailing list)
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
Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2013-02-06 01:32
(Received via mailing list)
Issue #7789 has been updated by kosaki (Motohiro KOSAKI).

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


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

Author: kernigh (George Koehler)
Status: Assigned
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category: core
Target version: 2.0.0
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
Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2013-02-06 07:37
(Received via mailing list)
Issue #7789 has been updated by kosaki (Motohiro KOSAKI).


> 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.
----------------------------------------
Bug #7789: test_setsid fails for OpenBSD
https://bugs.ruby-lang.org/issues/7789#change-35885

Author: kernigh (George Koehler)
Status: Assigned
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category: core
Target version: 2.0.0
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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.