ruby-changes:25158
From: usa <ko1@a...>
Date: Tue, 16 Oct 2012 11:13:55 +0900 (JST)
Subject: [ruby-changes:25158] usa:r37210 (ruby_1_9_3): merge revision(s) 36625: [Backport #6831]
usa 2012-10-16 11:13:44 +0900 (Tue, 16 Oct 2012) New Revision: 37210 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37210 Log: merge revision(s) 36625: [Backport #6831] test_etc.rb: remove implicit assumption * test/etc/test_etc.rb (TestEtc#test_getpwuid): remove implicit assumption, that getpwuid() would return the first entry in the order of getpw(), for shared UID. apparently it is not true on MacOS X 10.8. [ruby-core:46975][Bug #6831] Modified files: branches/ruby_1_9_3/test/etc/test_etc.rb branches/ruby_1_9_3/version.h Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 37209) +++ ruby_1_9_3/version.h (revision 37210) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 294 +#define RUBY_PATCHLEVEL 295 #define RUBY_RELEASE_DATE "2012-10-16" #define RUBY_RELEASE_YEAR 2012 Index: ruby_1_9_3/test/etc/test_etc.rb =================================================================== --- ruby_1_9_3/test/etc/test_etc.rb (revision 37209) +++ ruby_1_9_3/test/etc/test_etc.rb (revision 37210) @@ -28,12 +28,19 @@ end def test_getpwuid - passwd = {} - Etc.passwd {|s| passwd[s.uid] ||= s } - passwd.each_value do |s| - assert_equal(s, Etc.getpwuid(s.uid)) - assert_equal(s, Etc.getpwuid) if Process.euid == s.uid + # password database is not unique on UID, and which entry will be + # returned by getpwuid() is not specified. + passwd = Hash.new {[]} + # on MacOSX, same entries are returned from /etc/passwd and Open + # Directory. + Etc.passwd {|s| passwd[s.uid] |= [s]} + passwd.each_pair do |uid, s| + assert_include(s, Etc.getpwuid(uid)) end + s = passwd[Process.euid] + if s + assert_include(s, Etc.getpwuid) + end end def test_getpwnam -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/