This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.read behavior on Linux
Type: behavior Stage:
Components: IO Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, dugres, ronaldoussoren, tshepang
Priority: normal Keywords:

Created on 2013-08-05 08:47 by dugres, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg194461 - (view) Author: Louis Riviere (dugres) Date: 2013-08-05 08:47
A call to os.read that used to work on older Linux kernel, doesn't anymore with newer Linux kernel.
As a workaroud we can use libc.read (ctypes) instead of os.read.
But I feel like os.read should work, as it used to.

The code (and comments) can be seen here : http://code.activestate.com/recipes/576375-low-level-inotify-wrapper/
msg194922 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-08-12 04:32
Can you please explain what the bug is in Python; that is, what exactly was wrong with os.read?
msg194924 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-08-12 04:51
This is not a Python bug. Linux is just not accepting "0" as a valid size argument to read(). You don't see this using libc.read because you don't check errno. Just don't call os.read() if size == 0.
msg194967 - (view) Author: Louis Riviere (dugres) Date: 2013-08-12 14:43
Thanks Benjamin !
I should have known that "Python doesn't break things" :)
History
Date User Action Args
2022-04-11 14:57:49adminsetgithub: 62860
2013-08-12 14:43:22dugressetmessages: + msg194967
2013-08-12 04:51:13benjamin.petersonsetstatus: open -> closed
resolution: not a bug
messages: + msg194924
2013-08-12 04:32:57benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg194922
2013-08-10 01:57:21tshepangsetnosy: + tshepang
2013-08-05 10:47:12ronaldoussorensetnosy: + ronaldoussoren
2013-08-05 08:47:31dugrescreate