Project

General

Profile

Actions

Bug #12909

closed

TestProcess#test_execopts_pgroup might fail

Added by vo.x (Vit Ondruch) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0dev (2016-11-07 trunk 56664) [x86_64-linux]
[ruby-core:78051]

Description

I am trying to build Ruby in container, using systemd-nspawn. In this environment, the TestProcess#test_execopts_pgroup test fails:

  1) Failure:
TestProcess#test_execopts_pgroup [/builddir/build/BUILD/ruby-2.4.0-r56664/test/ruby/test_process.rb:184]:
Errno::EPERM expected but nothing was raised.

Initially, I thought it must be something wrong, with mock (Fedora build env tool) or something with systemd-nspawn, but as it turns out, the test suite is probably rather naive. It assumes that 2 cannot be used as a pgid, but apparently it can. I'd say that this line 1 should be more dynamic, but I'm not really sure what it should be (actually it used to be 1, which works for my case, but it probably breaks for other scenarios).

Please see 2 for the original report, analysis and explanation.

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Status changed from Open to Feedback
  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: REQUIRED to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED

Does this patch work?

index 3921395..8ad53ac 100644
--- i/test/ruby/test_process.rb
+++ w/test/ruby/test_process.rb
@@ -183,3 +183,7 @@
     assert_raise(ArgumentError) { system(*TRUECOMMAND, :pgroup=>-1) }
-    assert_raise(Errno::EPERM) { Process.wait spawn(*TRUECOMMAND, :pgroup=>2) }
+    IO.popen([RUBY, '-egets'], 'w') do |f|
+      assert_raise(Errno::EPERM) {
+        Process.wait spawn(*TRUECOMMAND, :pgroup=>f.pid)
+      }
+    end
 

Updated by vo.x (Vit Ondruch) over 7 years ago

Nobuyoshi Nakada wrote:

Does this patch work?

Yep, it works.

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Status changed from Feedback to Closed

Applied in changeset r56684.


test_process.rb: fix pgroup test

  • test/ruby/test_process.rb (TestProcess#test_execopts_pgroup):
    use dynamically assigned pid for the process group, instead of a
    magic number 2. [ruby-core:78051] [Bug #12909]

Updated by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE

ruby_2_3 r56714 merged revision(s) 56684.

Updated by usa (Usaku NAKAMURA) over 7 years ago

  • Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE to 2.1: REQUIRED, 2.2: DONE, 2.3: DONE

ruby_2_2 r56729 merged revision(s) 56684.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0