summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier de Gaye <xdegaye@users.sourceforge.net>2016-10-19 11:08:07 +0200
committerXavier de Gaye <xdegaye@users.sourceforge.net>2016-10-19 11:08:07 +0200
commit18207ea32becb391e8a78b680c5b7e76d56e3ebd (patch)
tree00ad6eafca3cced58f827b3e5e16144b8554098e
parentbd1b49a242f8430c4f3730ab44f044b67017838b (diff)
parent24c3b4928eb3046a02b55ab4317cee28aa1c56ba (diff)
downloadcpython-git-18207ea32becb391e8a78b680c5b7e76d56e3ebd.tar.gz
Issue #26944: Merge with 3.6.
-rw-r--r--Lib/test/test_posix.py17
-rw-r--r--Misc/NEWS3
2 files changed, 13 insertions, 7 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index d2f58baae6..63c74cd80d 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -799,7 +799,11 @@ class PosixTester(unittest.TestCase):
groups = idg.read().strip()
ret = idg.close()
- if ret is not None or not groups:
+ try:
+ idg_groups = set(int(g) for g in groups.split())
+ except ValueError:
+ idg_groups = set()
+ if ret is not None or not idg_groups:
raise unittest.SkipTest("need working 'id -G'")
# Issues 16698: OS X ABIs prior to 10.6 have limits on getgroups()
@@ -810,12 +814,11 @@ class PosixTester(unittest.TestCase):
raise unittest.SkipTest("getgroups(2) is broken prior to 10.6")
# 'id -G' and 'os.getgroups()' should return the same
- # groups, ignoring order and duplicates.
- # #10822 - it is implementation defined whether posix.getgroups()
- # includes the effective gid so we include it anyway, since id -G does
- self.assertEqual(
- set([int(x) for x in groups.split()]),
- set(posix.getgroups() + [posix.getegid()]))
+ # groups, ignoring order, duplicates, and the effective gid.
+ # #10822/#26944 - It is implementation defined whether
+ # posix.getgroups() includes the effective gid.
+ symdiff = idg_groups.symmetric_difference(posix.getgroups())
+ self.assertTrue(not symdiff or symdiff == {posix.getegid()})
# tests for the posix *at functions follow
diff --git a/Misc/NEWS b/Misc/NEWS
index a46c317d22..e525c9bbe3 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -326,6 +326,9 @@ Tools/Demos
Tests
-----
+- Issue #26944: Fix test_posix for Android where 'id -G' is entirely wrong or
+ missing the effective gid.
+
- Issue #28409: regrtest: fix the parser of command line arguments.
- Issue #28217: Adds _testconsole module to test console input.