ruby-changes:54207
From: normal <ko1@a...>
Date: Tue, 18 Dec 2018 07:49:04 +0900 (JST)
Subject: [ruby-changes:54207] normal:r66428 (trunk): Fix test failure if ENV["USER"] doesn't match Process.euid
normal 2018-12-18 07:48:57 +0900 (Tue, 18 Dec 2018) New Revision: 66428 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66428 Log: Fix test failure if ENV["USER"] doesn't match Process.euid When dropping privileges to run tests, ENV["USER"] could be set to a user that doesn't match Process.euid, which causes this test to fail with Errno::EPERM. Try to get the name for the current euid, and only fallback to ENV["USER"] if that doesn't work. Modified files: trunk/test/ruby/test_process.rb Index: test/ruby/test_process.rb =================================================================== --- test/ruby/test_process.rb (revision 66427) +++ test/ruby/test_process.rb (revision 66428) @@ -1567,7 +1567,7 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1567 end def test_seteuid_name - user = ENV["USER"] or return + user = (Etc.getpwuid(Process.euid).name rescue ENV["USER"]) or return assert_nothing_raised(TypeError) {Process.euid = user} rescue NotImplementedError end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/