New submission from STINNER Victor <vstin...@redhat.com>:

https://buildbot.python.org/all/#/builders/167/builds/1265

test_chown (test.test_os.ChownFileTests) ... ERROR

======================================================================
ERROR: test_chown (test.test_os.ChownFileTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/test_os.py",
 line 1327, in test_chown
    os.chown(support.TESTFN, uid, gid_1)
PermissionError: [Errno 1] Operation not permitted: '@test_95158_tmp'

Extract of the test:

    import grp
    groups = [g.gr_gid for g in grp.getgrall() if getpass.getuser() in g.gr_mem]
    if hasattr(os, 'getgid'):
        process_gid = os.getgid()
        if process_gid not in groups:
            groups.append(process_gid)

    @unittest.skipUnless(len(groups) > 1, "test needs more than one group")
    def test_chown(self):
        gid_1, gid_2 = groups[:2]
        uid = os.stat(support.TESTFN).st_uid
        os.chown(support.TESTFN, uid, gid_1)  # <======== FAIL HERE
        gid = os.stat(support.TESTFN).st_gid
        self.assertEqual(gid, gid_1)
        os.chown(support.TESTFN, uid, gid_2)
        gid = os.stat(support.TESTFN).st_gid
        self.assertEqual(gid, gid_2)

Extract of test.pythoninfo:

os.uid: 1002
os.umask: 077
os.gid: 1002
os.groups: 1002


I'm not sure that the code to manually get groups from grp.getgrall() is 
correct. Why not relying on the *current* groups, os.getgroups()?

Note: there is also os.getgrouplist(), I'm not sure of the difference between 
os.getgroups() and os.getgrouplist(). I know that os.getgrouplist() was 
modified recently to use:

    /*
     * NGROUPS_MAX is defined by POSIX.1 as the maximum
     * number of supplimental groups a users can belong to.
     * We have to increment it by one because
     * getgrouplist() returns both the supplemental groups
     * and the primary group, i.e. all of the groups the
     * user belongs to.
     */
    ngroups = 1 + MAX_GROUPS;

----------
components: Tests
messages: 346508
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_os: test_chown() started to fail on AMD64 FreeBSD 10-STABLE 
Non-Debug 3.* buildbots
versions: Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37400>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to