[Python-checkins] r87240 - in python/branches/release27-maint: Doc/library/grp.rst Lib/test/test_grp.py Misc/ACKS Misc/NEWS Modules/grpmodule.c
r.david.murray
python-checkins at python.org
Tue Dec 14 17:26:30 CET 2010
Author: r.david.murray
Date: Tue Dec 14 17:26:30 2010
New Revision: 87240
Log:
Merged revisions 87238 via svnmerge from
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.
........
Modified:
python/branches/release27-maint/ (props changed)
python/branches/release27-maint/Doc/library/grp.rst
python/branches/release27-maint/Lib/test/test_grp.py
python/branches/release27-maint/Misc/ACKS
python/branches/release27-maint/Misc/NEWS
python/branches/release27-maint/Modules/grpmodule.c
Modified: python/branches/release27-maint/Doc/library/grp.rst
==============================================================================
--- python/branches/release27-maint/Doc/library/grp.rst (original)
+++ python/branches/release27-maint/Doc/library/grp.rst Tue Dec 14 17:26:30 2010
@@ -31,7 +31,9 @@
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:
Modified: python/branches/release27-maint/Lib/test/test_grp.py
==============================================================================
--- python/branches/release27-maint/Lib/test/test_grp.py (original)
+++ python/branches/release27-maint/Lib/test/test_grp.py Tue Dec 14 17:26:30 2010
@@ -33,12 +33,16 @@
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)
Modified: python/branches/release27-maint/Misc/ACKS
==============================================================================
--- python/branches/release27-maint/Misc/ACKS (original)
+++ python/branches/release27-maint/Misc/ACKS Tue Dec 14 17:26:30 2010
@@ -375,6 +375,7 @@
Fredrik Håård
Mihai Ibanescu
Lars Immisch
+Bobby Impollonia
Meador Inge
Tony Ingraldi
John Interrante
Modified: python/branches/release27-maint/Misc/NEWS
==============================================================================
--- python/branches/release27-maint/Misc/NEWS (original)
+++ python/branches/release27-maint/Misc/NEWS Tue Dec 14 17:26:30 2010
@@ -46,6 +46,9 @@
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.
Modified: python/branches/release27-maint/Modules/grpmodule.c
==============================================================================
--- python/branches/release27-maint/Modules/grpmodule.c (original)
+++ python/branches/release27-maint/Modules/grpmodule.c Tue Dec 14 17:26:30 2010
@@ -158,7 +158,9 @@
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 */
};
More information about the Python-checkins
mailing list