[issue27057] os.set_inheritable(): fall back to fcntl() if ioctl() fails with EACCES

2016-05-19 Thread Michał Bednarski

New submission from Michał Bednarski:

When SELinux forbids ioctl() it fails with EACCES and whole os.set_inheritable 
raises exception.

As in https://bugs.python.org/issue22258 code was added to fall back to fcntl 
when ioctl() fails with ENOTTY I'm adding EACCES value to same condition to 
fall back to fcntl().

--
files: set_inheritable-eacces.diff
keywords: patch
messages: 265853
nosy: Michał Bednarski
priority: normal
severity: normal
status: open
title: os.set_inheritable(): fall back to fcntl() if ioctl() fails with EACCES
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file42897/set_inheritable-eacces.diff

___
Python tracker 
<http://bugs.python.org/issue27057>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27057] os.set_inheritable(): fall back to fcntl() if ioctl() fails with EACCES

2016-05-19 Thread Michał Bednarski

Michał Bednarski added the comment:

> Hum, I'm surprised that SELinux blocks such safe function. Maybe the SELinux 
> policy should be completed to allow it?
The ioctl is blocked for given file type regardless of request argument. As I'm 
running Python on non-rooted Android updating policy is not really an option.

> But do you expect ioctl() to always fail with EACCESS? Or only fail 
> sometimes, or only on some file descriptors? Your patch remembers that 
> ioctl() fails once and never retries.
It will always fail for given file type (such as sockets), while it will work 
for others (such as regular files). I think that remembering that ioctl doesn't 
work may be okay, though I may be wrong. Either way if we are wrong whenever 
ioctl works we'll do one extra syscall.

> About your patch: please add a comment explaining why you fallback with a 
> reference to this issue ("Issue #27057").
Attached

--
Added file: http://bugs.python.org/file42900/set_inheritable-eacces.diff

___
Python tracker 
<http://bugs.python.org/issue27057>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27057] os.set_inheritable(): fall back to fcntl() if ioctl() fails with EACCES

2016-05-19 Thread Michał Bednarski

Michał Bednarski added the comment:

> You should now sign the PSF Contributor Agreement
Done.

> (Well, in fact it would be better to do that *before* merging your change, 
> but well, your change is short enough ;-))
Well on https://docs.python.org/devguide/patch.html was said "For non-trivial 
changes".

--

___
Python tracker 
<http://bugs.python.org/issue27057>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com