Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue37400

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:test_os: test_chown() started to fail on AMD64 FreeBSD 10-STABLE Non-Debug 3.* buildbots
Type:Stage:resolved
Components:TestsVersions:Python 3.9, Python 3.8, Python 3.7
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: koobs, miss-islington, vstinner
Priority:normalKeywords:patch

Created on2019-06-25 11:07 byvstinner, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 14373mergedvstinner,2019-06-25 11:09
PR 14374mergedvstinner,2019-06-25 14:03
PR 14377mergedmiss-islington,2019-06-25 15:06
PR 14378mergedmiss-islington,2019-06-25 15:06
Messages (10)
msg346508 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2019-06-25 11:07
https://buildbot.python.org/all/#/builders/167/builds/1265test_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: 1002os.umask: 077os.gid: 1002os.groups: 1002I'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;
msg346510 -(view)Author: Kubilay Kocak (koobs)(Python triager)Date: 2019-06-25 11:17
This looks like a reincarnation of#27838
msg346512 -(view)Author: Kubilay Kocak (koobs)(Python triager)Date: 2019-06-25 11:25
And I just remembered that I had to restart the build worker service on that host (koobs-freebsd10) this morning as I was receiving messaging that the worker had gone missing.I ran `[koobs@10-STABLE-amd64:~] sudo /usr/local/etc/rc.d/buildslave restart`which is the same as the prevailing reproduction case in#27838I could restart the worker to make the issue go away, but I think the underlying issue should be fixed instead.Should we close this as a dupe and reopen the original?
msg346515 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2019-06-25 11:37
New changeset9cb274114c844f9b1c13028f812926c987a7b4a7 by Victor Stinner in branch 'master':bpo-37400: pythoninfo logs getpwuid and getgrouplist (GH-14373)https://github.com/python/cpython/commit/9cb274114c844f9b1c13028f812926c987a7b4a7
msg346526 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2019-06-25 13:23
I merged my pythoninfo change, more complete pythoninfo from the buildbot:os.getgid: 1002os.getgrouplist: 1002os.getgroups: 1002os.getuid: 1002pwd.getpwuid(1002): pwd.struct_passwd(pw_name='buildbot', pw_passwd='*', pw_uid=1002, pw_gid=1002, pw_gecos='FreeBSD BuildBot', pw_dir='/home/buildbot', pw_shell='/bin/sh')IMHO the test is wrong: it should rely on os.getgroups() rather tan "discover" groups from pw.getpwall().
msg346528 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2019-06-25 14:20
I'm connected to the FreeBSD CURRENT buildbot as the user "haypo". I'm unable to reproduce the bug:CURRENT-amd64% iduid=1003(haypo) gid=1003(haypo) groups=1003(haypo)CURRENT-amd64% ./python -m test test_os -m test_chown(...)Tests result: SUCCESSMoreover, it seems like something changes on the buildbot, since the user "buildbot" now has 0 group!?$ ./python>>> [g.gr_gid for g in grp.getgrall() if 'buildbot' in g.gr_mem][]Or maybe as the user "haypo", I cannot see *all* groups.In case of doubt, I will blindly apply my fixPR 14374.
msg346532 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2019-06-25 15:06
New changesetd7c87d982d4ec4ba201bcee14324ae5e0e90581f by Victor Stinner in branch 'master':bpo-37400: Fix test_os.test_chown() (GH-14374)https://github.com/python/cpython/commit/d7c87d982d4ec4ba201bcee14324ae5e0e90581f
msg346535 -(view)Author: miss-islington (miss-islington)Date: 2019-06-25 15:27
New changeset12d174bed9960ded1d072035c57f82e10a89f0d6 by Miss Islington (bot) in branch '3.8':bpo-37400: Fix test_os.test_chown() (GH-14374)https://github.com/python/cpython/commit/12d174bed9960ded1d072035c57f82e10a89f0d6
msg346556 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2019-06-25 20:25
New changeset1d4b6ba19466aba0eb91c4ba01ba509acf18c723 by Victor Stinner (Miss Islington (bot)) in branch '3.7':bpo-37400: Fix test_os.test_chown() (GH-14374) (GH-14378)https://github.com/python/cpython/commit/1d4b6ba19466aba0eb91c4ba01ba509acf18c723
msg346557 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2019-06-25 20:26
I merged my fix. I close the issue and hope that the test will not fail again ;-)Python 2.7 is not affected: it doesn't have test_chown().
History
DateUserActionArgs
2022-04-11 14:59:17adminsetgithub: 81581
2019-06-25 20:26:55vstinnersetstatus: open -> closed
resolution: fixed
messages: +msg346557

stage: patch review -> resolved
2019-06-25 20:25:13vstinnersetmessages: +msg346556
2019-06-25 15:27:06miss-islingtonsetnosy: +miss-islington
messages: +msg346535
2019-06-25 15:06:46miss-islingtonsetpull_requests: +pull_request14193
2019-06-25 15:06:39miss-islingtonsetpull_requests: +pull_request14192
2019-06-25 15:06:28vstinnersetmessages: +msg346532
2019-06-25 14:20:39vstinnersetmessages: +msg346528
2019-06-25 14:03:52vstinnersetpull_requests: +pull_request14189
2019-06-25 13:23:21vstinnersetmessages: +msg346526
2019-06-25 11:37:30vstinnersetmessages: +msg346515
2019-06-25 11:25:13koobssetmessages: +msg346512
2019-06-25 11:17:39koobssetnosy: +koobs
messages: +msg346510
2019-06-25 11:09:35vstinnersetkeywords: +patch
stage: patch review
pull_requests: +pull_request14188
2019-06-25 11:07:09vstinnercreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp