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

ruby-changes:56299

From: Nobuyoshi <ko1@a...>
Date: Sun, 30 Jun 2019 21:48:52 +0900 (JST)
Subject: [ruby-changes:56299] Nobuyoshi Nakada: b89f6ac843 (trunk): Check for the privileges by the current process groups

https://git.ruby-lang.org/ruby.git/commit/?id=b89f6ac843

From b89f6ac843d9abbe8488bd329e0ff0cccf5caaa3 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 30 Jun 2019 21:12:15 +0900
Subject: Check for the privileges by the current process groups

Group membership of login user is not activated until login after
adding to the group.

diff --git a/test/dtrace/helper.rb b/test/dtrace/helper.rb
index 7b382e8..2243d15 100644
--- a/test/dtrace/helper.rb
+++ b/test/dtrace/helper.rb
@@ -19,9 +19,7 @@ if RUBY_PLATFORM =~ /linux/ https://github.com/ruby/ruby/blob/trunk/test/dtrace/helper.rb#L19
   impl = :stap
   begin
     require 'etc'
-    login = Etc.getlogin
-    ok = Etc.getgrnam('stapusr').mem.include?(login) &&
-           Etc.getgrnam('stapdev').mem.include?(login)
+    ok = (%w[stapusr stapdev].map {|g|Etc.getgrnam(g).gid} & Process.groups).size == 2
   rescue LoadError, ArgumentError
   end unless ok
 end
-- 
cgit v0.10.2


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

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