[issue39821] grp library functions grp.getgrnam() & grp.getgrgid() returning incorrect gr_mem information

Abhishek report at bugs.python.org
Sun Mar 1 23:54:37 EST 2020


New submission from Abhishek <abmsharm at in.ibm.com>:

If root user is part of a linux group, then in the response of getgrnam() & grp.getgrid(), in te gr_mem part, root user is not listed.

[root at biplab2 ~]# getent group | grep starwars
starwars:x:1011:root,abhi

[root at biplab2 ~]# python3
Python 3.6.8 (default, Dec  5 2019, 16:11:43)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
>>> import grp
>>> grp.getgrnam('starwars')
grp.struct_group(gr_name='starwars', gr_passwd='x', gr_gid=1011, gr_mem=['abhi'])
>>> grp.getgrgid(1011)
grp.struct_group(gr_name='starwars', gr_passwd='x', gr_gid=1011, gr_mem=['abhi'])

But, when grp.getgrall() is run, we the correct response (gr_mem includes root user as well)

>>> grp.getgrall()
grp.struct_group(gr_name='starwars', gr_passwd='x', gr_gid=1011, gr_mem=['root', 'abhi'])]

----------
messages: 363113
nosy: abhi.sharma
priority: normal
severity: normal
status: open
title: grp library functions grp.getgrnam() & grp.getgrgid() returning incorrect gr_mem information
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39821>
_______________________________________


More information about the Python-bugs-list mailing list