[Python-bugs-list] [ python-Bugs-732783 ] test_grp failure on Mac OS X

SourceForge.net noreply@sourceforge.net
Wed, 07 May 2003 04:12:58 -0700


Bugs item #732783, was opened at 2003-05-05 11:31
Message generated for change (Comment added) made by montanaro
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=732783&group_id=5470

Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Walter Dörwald (doerwalter)
Summary: test_grp failure on Mac OS X

Initial Comment:
I noticed that test_grp began failing for me on Mac OS X.  I
thought perhaps it was related to the changes Martin checked
in for grpmodule.c Saturday (May 3rd) for OpenVMS, but a
Python executable built on May 2nd also fails to pass the
test.  However, it passes using 2.2.2 (running against the
2.2.2 version of the test).

% ./python.exe ../Lib/test/test_grp.py
test_errors (__main__.GroupDatabaseTestCase) ... ok
test_values (__main__.GroupDatabaseTestCase) ... FAIL

===========================================
===========================
FAIL: test_values (__main__.GroupDatabaseTestCase)
-----------------------------------------------------------
-----------
Traceback (most recent call last):
  File "../Lib/test/test_grp.py", line 46, in test_values
    self.assert_(max([self.valueseq(e2, x) \
  File "/Users/skip/src/python/head/dist/src/Lib/unittest.py", line 
268, in failUnless
    if not expr: raise self.failureException, msg
AssertionError

-----------------------------------------------------------
-----------
Ran 2 tests in 0.162s

FAILED (failures=1)
Traceback (most recent call last):
  File "../Lib/test/test_grp.py", line 103, in ?
    test_main()
  File "../Lib/test/test_grp.py", line 100, in test_main
    test_support.run_unittest(GroupDatabaseTestCase)
  File "/Users/skip/src/python/head/dist/src/Lib/test/
test_support.py", line 259, in run_unittest
    run_suite(suite, testclass)
  File "/Users/skip/src/python/head/dist/src/Lib/test/
test_support.py", line 247, in run_suite
    raise TestFailed(err)
test.test_support.TestFailed: Traceback (most recent call last):
  File "../Lib/test/test_grp.py", line 46, in test_values
    self.assert_(max([self.valueseq(e2, x) \
  File "/Users/skip/src/python/head/dist/src/Lib/unittest.py", line 
268, in failUnless
    if not expr: raise self.failureException, msg
AssertionError

I wonder if it's related to Walter's changes to test_grp.py
on or about versions 1.14 or 1.15?

Here's a session transcript which shows a couple problems.
"ebygid" is a dict like entriesbygid in test_grp.py.
"entries" is the output of grp.getgrall().

    >>> pprint.pprint(ebygid)
    {-2: [('nobody', '*', -2, [])],
     -1: [('nogroup', '*', -1, [])],
     0: [('wheel', '*', 0, ['skip'])],
     1: [('daemon', '*', 1, ['root'])],
     2: [('kmem', '*', 2, ['root'])],
     3: [('sys', '*', 3, ['root'])],
     4: [('tty', '*', 4, ['root'])],
     5: [('operator', '*', 5, ['root'])],
     6: [('mail', '*', 6, [])],
     7: [('bin', '*', 7, [])],
     20: [('staff', '*', 20, ['root'])],
     25: [('smmsp', '*', 25, [])],
     31: [('guest', '*', 31, ['root'])],
     45: [('utmp', '*', 45, [])],
     66: [('uucp', '*', 66, [])],
     68: [('dialer', '*', 68, [])],
     69: [('network', '*', 69, [])],
     70: [('www', '*', 70, [])],
     75: [('sshd', '*', 75, [])],
     80: [('admin', '*', 80, ['root', 'skip'])],
     99: [('unknown', '*', 99, [])],
     250: [('news', '*', 250, [])],
     251: [('mysql', '*', 251, [])],
     252: [('pgsql', '*', 252, []), ('postgres', '*', 252, ['skip'])],
     253: [('games', '*', 253, [])],
     254: [('canna', '*', 254, [])],
     255: [('postfix', '*', 255, [])],
     256: [('maildrop', '*', 256, [])],
     257: [('tomcat', '*', 257, [])],
     258: [('jabber', '*', 258, [])],
     259: [('opennms', '*', 259, [])],
     260: [('clamav', '*', 260, [])]}
    >>> for e in entries:
    ...   e2 = grp.getgrgid (e.gr_gid)
    ...   print e2
    ...   print [veq(e2, x) for x in ebygid[e.gr_gid]] 
    ... 
    ('nobody', '', -2, [])
    [True]
    ('nogroup', '', -1, [])
    [True]
    ('wheel', '', 0, ['skip'])
    [True]
    ('daemon', '', 1, ['root'])
    [True]
    ('kmem', '', 2, ['root'])
    [True]
    ('sys', '', 3, ['root'])
    [True]
    ('tty', '', 4, ['root'])
    [True]
    ('operator', '', 5, ['root'])
    [True]
    ('mail', '', 6, [])
    [True]
    ('bin', '', 7, [])
    [True]
    ('staff', '', 20, ['root'])
    [True]
    ('guest', '', 31, ['root'])
    [True]
    ('utmp', '', 45, [])
    [True]
    ('uucp', '', 66, [])
    [True]
    ('dialer', '', 68, [])
    [True]
    ('network', '', 69, [])
    [True]
    ('www', '', 70, [])
    [True]
    ('admin', '', 80, ['root', 'skip'])
    [True]
    ('unknown', '', 99, [])
    [True]
    ('smmsp', '', 25, [])
    [True]
    ('mysql', '', 251, [])
    [True]
    ('sshd', '', 75, [])
    [True]
    ('news', '', 250, [])
    [True]
    ('pgsql', '', 252, ['skip'])
    [False, False]
    ('games', '', 253, [])
    [True]
    ('canna', '', 254, [])
    [True]
    ('postfix', '', 255, [])
    [True]
    ('maildrop', '', 256, [])
    [True]
    ('tomcat', '', 257, [])
    [True]
    ('jabber', '', 258, [])
    [True]
    ('opennms', '', 259, [])
    [True]
    ('clamav', '', 260, [])
    [True]
    ('pgsql', '', 252, ['skip'])
    [False, False]

I think it arises from the fact that on my machine I have
two group entries with the same id but different names
(pgsql and postgres).


----------------------------------------------------------------------

>Comment By: Skip Montanaro (montanaro)
Date: 2003-05-07 06:12

Message:
Logged In: YES 
user_id=44345

Yes, my apologies for not responding sooner.  Closing...


----------------------------------------------------------------------

Comment By: Walter Dörwald (doerwalter)
Date: 2003-05-07 05:40

Message:
Logged In: YES 
user_id=89016

Did version 1.17 of test_grp.py fix this bug?

----------------------------------------------------------------------

Comment By: Walter Dörwald (doerwalter)
Date: 2003-05-05 14:47

Message:
Logged In: YES 
user_id=89016

I think I have a fix for that (basically by removing the
check whether a tuple similar to the one from pwd.getgrgid()
is among  those for the same gid returned by
pwd.getgrall()). Unfortunately CVS says "Connection refused"
today. I'll try again tomorrow.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=732783&group_id=5470