From c309cda9037be78e835bd07cf1f2dba0c22f3653 Mon Sep 17 00:00:00 2001 From: mame Date: Wed, 3 Sep 2008 15:02:22 +0000 Subject: [PATCH] * test/etc/test_etc.rb (test_getpwuid, test_getgrgid): use Process.euid and egid instead of Etc.getlogin to identify current user which may be different from a login one (e.g., su command). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ test/etc/test_etc.rb | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f57b9d0367..2f420e1f24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Sep 4 00:01:45 2008 Yusuke Endoh + + * test/etc/test_etc.rb (test_getpwuid, test_getgrgid): use + Process.euid and egid instead of Etc.getlogin to identify current + user which may be different from a login one (e.g., su command). + Wed Sep 3 23:52:47 2008 Yusuke Endoh * test/etc/test_etc.rb: check only typical use of diff --git a/test/etc/test_etc.rb b/test/etc/test_etc.rb index 712961939c..add7d63652 100644 --- a/test/etc/test_etc.rb +++ b/test/etc/test_etc.rb @@ -32,7 +32,7 @@ class TestEtc < Test::Unit::TestCase Etc.passwd {|s| passwd[s.uid] = s unless passwd[s.uid] } passwd.values.each do |s| assert_equal(s, Etc.getpwuid(s.uid)) - assert_equal(s, Etc.getpwuid) if Etc.getlogin == s.name + assert_equal(s, Etc.getpwuid) if Process.euid == s.uid end end @@ -73,7 +73,7 @@ class TestEtc < Test::Unit::TestCase end groups.each do |s| assert_equal(s, Etc.getgrgid(s.gid)) - assert_equal(s, Etc.getgrgid) if Etc.getlogin == s.name + assert_equal(s, Etc.getgrgid) if Process.egid == s.gid end end