This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pathlib group unittests can fail
Type: Stage: resolved
Components: Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pitrou Nosy List: gvanrossum, ned.deily, pitrou, python-dev
Priority: normal Keywords:

Created on 2013-11-24 00:45 by gvanrossum, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg204141 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2013-11-24 00:45
When running test_pathlib on my OSX (10.8) laptop I get these errors:

======================================================================
ERROR: test_group (test.test_pathlib.PathTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/guido/cpython/Lib/test/test_pathlib.py", line 1332, in test_group
    name = grp.getgrgid(gid).gr_name
KeyError: 'getgrgid(): gid not found: 849048494'

======================================================================
ERROR: test_group (test.test_pathlib.PosixPathTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/guido/cpython/Lib/test/test_pathlib.py", line 1332, in test_group
    name = grp.getgrgid(gid).gr_name
KeyError: 'getgrgid(): gid not found: 849048494'

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

This is probably some kind of OSX quirk where st_gid is set to a group that's not in /etc/groups, because (except briefly during the reboot process) on OS X the /etc configuration files for users/groups do not provide the whole truth.

Sadly I don't know what API to use to get the group name.   "ls -l" doesn't seem to know either.  My home dir has that gid too, so it's not an isolated anomaly. It may well be some kind of corporate thing (it's not really "my" laptop. :-)
msg204142 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-11-24 00:46
Well, the KeyError is legitimate then (it's even in the docs :-)).
The test will probably have to be skipped in this case.
msg204173 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-11-24 03:37
You should be able to find the group and group name using the "Directory Utility" app.  The easiest way to launch it is from a shell with:

open "/System/Library/CoreServices/Directory Utility.app"

There is a command line utility, dscl, but it is much more painful.
msg204380 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-25 18:51
New changeset b58b58948c27 by Antoine Pitrou in branch 'default':
Issue #19742: fix a test_pathlib failure when a file owner or group isn't in the system database
http://hg.python.org/cpython/rev/b58b58948c27
msg204381 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-11-25 18:52
It should be fixed now (i.e. the test is skipped).
History
Date User Action Args
2022-04-11 14:57:54adminsetgithub: 63941
2013-11-25 18:57:35pitrousetstatus: open -> closed
resolution: fixed
stage: resolved
2013-11-25 18:52:24pitrousetmessages: + msg204381
2013-11-25 18:51:59python-devsetnosy: + python-dev
messages: + msg204380
2013-11-24 03:37:42ned.deilysetnosy: + ned.deily
messages: + msg204173
2013-11-24 00:46:45pitrousetmessages: + msg204142
2013-11-24 00:45:29gvanrossumcreate