[前][次][番号順一覧][スレッド一覧]

ruby-changes:41936

From: odaira <ko1@a...>
Date: Mon, 7 Mar 2016 01:43:55 +0900 (JST)
Subject: [ruby-changes:41936] odaira:r54010 (trunk): * test/ruby/test_process.rb (test_execopts_gid): Skip a test

odaira	2016-03-07 01:43:50 +0900 (Mon, 07 Mar 2016)

  New Revision: 54010

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54010

  Log:
    * test/ruby/test_process.rb (test_execopts_gid): Skip a test
      that is known to fail on AIX. AIX allows setgid to
      a supplementary group, but Ruby does not allow the "-e"
      option when setgid'ed, so the test does not work as intended.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_process.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54009)
+++ ChangeLog	(revision 54010)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Mar  7 01:38:41 2016  Rei Odaira  <Rei.Odaira@g...>
+
+	* test/ruby/test_process.rb (test_execopts_gid): Skip a test
+	  that is known to fail on AIX. AIX allows setgid to
+	  a supplementary group, but Ruby does not allow the "-e"
+	  option when setgid'ed, so the test does not work as intended.
+
 Sun Mar  6 22:43:41 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* io.c (rb_obj_display): [DOC] fix output of Array, as Array#to_s
Index: test/ruby/test_process.rb
===================================================================
--- test/ruby/test_process.rb	(revision 54009)
+++ test/ruby/test_process.rb	(revision 54010)
@@ -1,3 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1
+# coding: utf-8
 # frozen_string_literal: false
 require 'test/unit'
 require 'tempfile'
@@ -1812,7 +1813,15 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1813
       assert_nothing_raised(feature6975) do
         begin
           g = IO.popen([RUBY, "-e", "print Process.gid", gid: group], &:read)
-          assert_equal(gid, g, feature6975)
+          # AIX allows a non-root process to setgid to its supplementary group,
+          # while other UNIXes do not. (This might be AIX's violation of the POSIX standard.)
+          # However, Ruby does not allow a setgid'ed Ruby process to use the -e option.
+          # As a result, the Ruby process invoked by "IO.popen([RUBY, "-e", ..." above fails
+          # with a message like "no -e allowed while running setgid (SecurityError)" to stderr,
+          # the exis status is set to 1, and the variable "g" is set to an empty string.
+          # To conclude, on AIX, if the "gid" variable is a supplementary group,
+          # the assert_equal next can fail, so skip it.
+          assert_equal(gid, g, feature6975) unless $?.exitstatus == 1 && /aix/ =~ RUBY_PLATFORM && gid != Process.gid
         rescue Errno::EPERM, NotImplementedError
         end
       end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]