[Python-checkins] cpython (merge 3.5 -> default): Merge 3.5 (issue #27057)

victor.stinner python-checkins at python.org
Thu May 19 10:50:07 EDT 2016


https://hg.python.org/cpython/rev/783c1b8cdddb
changeset:   101436:783c1b8cdddb
parent:      101434:3811995aad73
parent:      101435:13c5135d8467
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu May 19 16:48:06 2016 +0200
summary:
  Merge 3.5 (issue #27057)

files:
  Misc/ACKS          |  1 +
  Misc/NEWS          |  4 ++++
  Python/fileutils.c |  9 +++++++--
  3 files changed, 12 insertions(+), 2 deletions(-)


diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -110,6 +110,7 @@
 Robin Becker
 Torsten Becker
 Bill Bedford
+Michał Bednarski
 Ian Beer
 Stefan Behnel
 Reimer Behrends
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -297,6 +297,10 @@
 Library
 -------
 
+- Issue #27057: Fix os.set_inheritable() on Android, ioctl() is blocked by
+  SELinux and fails with EACCESS. The function now falls back to fcntl().
+  Patch written by Michał Bednarski.
+
 - Issue #27014: Fix infinite recursion using typing.py.  Thanks to Kalle Tuure!
 
 - Issue #27031: Removed dummy methods in Tkinter widget classes: tk_menuBar()
diff --git a/Python/fileutils.c b/Python/fileutils.c
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -860,7 +860,7 @@
             return 0;
         }
 
-        if (errno != ENOTTY) {
+        if (errno != ENOTTY && errno != EACCES) {
             if (raise)
                 PyErr_SetFromErrno(PyExc_OSError);
             return -1;
@@ -869,7 +869,12 @@
             /* Issue #22258: Here, ENOTTY means "Inappropriate ioctl for
                device". The ioctl is declared but not supported by the kernel.
                Remember that ioctl() doesn't work. It is the case on
-               Illumos-based OS for example. */
+               Illumos-based OS for example.
+
+               Issue #27057: When SELinux policy disallows ioctl it will fail
+               with EACCES. While FIOCLEX is safe operation it may be
+               unavailable because ioctl was denied altogether.
+               This can be the case on Android. */
             ioctl_works = 0;
         }
         /* fallback to fcntl() if ioctl() does not work */

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list