]> granicus.if.org Git - python/commitdiff
Merged revisions 87238 via svnmerge from
authorR. David Murray <rdmurray@bitdance.com>
Tue, 14 Dec 2010 16:26:30 +0000 (16:26 +0000)
committerR. David Murray <rdmurray@bitdance.com>
Tue, 14 Dec 2010 16:26:30 +0000 (16:26 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87238 | r.david.murray | 2010-12-14 11:20:53 -0500 (Tue, 14 Dec 2010) | 7 lines

  #775964: skip YP/NIS entries instead of failing the test

  Also includes doc updates mentioning that these entries may not
  be retrievable via getgrnam and getgrgid.

  Patch by Bobby Impollonia.
........

Doc/library/grp.rst
Lib/test/test_grp.py
Misc/ACKS
Misc/NEWS
Modules/grpmodule.c

index a71c308d5d3358eb8aa701138fd7e53a8a7d12d7..f20a2127387483b30d2d45ba56234c60e5d28a2c 100644 (file)
@@ -31,7 +31,9 @@ correspond to the members of the ``group`` structure (Attribute field below, see
 The gid is an integer, name and password are strings, and the member list is a
 list of strings. (Note that most users are not explicitly listed as members of
 the group they are in according to the password database.  Check both databases
-to get complete membership information.)
+to get complete membership information.  Also note that a ``gr_name`` that
+starts with a ``+`` or ``-`` is likely to be a YP/NIS reference and may not be
+accessible via :func:`getgrnam` or :func:`getgrgid`.)
 
 It defines the following items:
 
index b4701d5fac5d24600ca5fa7e48ae7334c0ca4aea..e9e175826360c0ac21b6944b6507a99e0edaf150 100644 (file)
@@ -33,12 +33,16 @@ class GroupDatabaseTestCase(unittest.TestCase):
             e2 = grp.getgrgid(e.gr_gid)
             self.check_value(e2)
             self.assertEqual(e2.gr_gid, e.gr_gid)
-            e2 = grp.getgrnam(e.gr_name)
+            name = e.gr_name
+            if name.startswith('+') or name.startswith('-'):
+                # NIS-related entry
+                continue
+            e2 = grp.getgrnam(name)
             self.check_value(e2)
             # There are instances where getgrall() returns group names in
             # lowercase while getgrgid() returns proper casing.
             # Discovered on Ubuntu 5.04 (custom).
-            self.assertEqual(e2.gr_name.lower(), e.gr_name.lower())
+            self.assertEqual(e2.gr_name.lower(), name.lower())
 
     def test_errors(self):
         self.assertRaises(TypeError, grp.getgrgid)
index 24c072c368796c31260f8c7bb443da7b4edc1931..83a59a07f1627d2ac7b6a41dfb0ba030cf56014e 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -375,6 +375,7 @@ Gerhard Häring
 Fredrik Håård
 Mihai Ibanescu
 Lars Immisch
+Bobby Impollonia
 Meador Inge
 Tony Ingraldi
 John Interrante
index b49539b735982adde0871be2d656f9fb6a67d35f..faef735e203bdd7ef60f1b761294193b5dcc60a8 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -46,6 +46,9 @@ Extension Modules
 Tests
 -----
 
+- Issue #775964: test_grp now skips YP/NIS entries instead of failing when
+  encountering them.
+
 - Issue #7110: regrtest now sends test failure reports and single-failure
   tracebacks to stderr rather than stdout.
 
index ffb451e1744388bd7f82fb88f304617c7d4499c1..07de8807c73599e795d2dae33492db445169fd75 100644 (file)
@@ -158,7 +158,9 @@ Return the group database entry for the given group name.  If\n\
 name is not valid, raise KeyError."},
     {"getgrall",       grp_getgrall,   METH_NOARGS,
      "getgrall() -> list of tuples\n\
-Return a list of all available group entries, in arbitrary order."},
+Return a list of all available group entries, in arbitrary order.\n\
+An entry whose name starts with '+' or '-' represents an instruction\n\
+to use YP/NIS and may not be accessible via getgrnam or getgrgid."},
     {NULL,             NULL}           /* sentinel */
 };