Skip to content

Conversation

@vstinner
Copy link
Contributor

GreenFileIO.readall() calls _trampoline(self, read=True). Problem: on
regular file, epoll_ctl() fails with EPERM on Linux, because regular
files are not supported.

This change skips the call to _trampoline() on regular files. Add
also various unit tests on the various ways to read the whole content
of a file.

@vstinner
Copy link
Contributor Author

vstinner commented Jan 4, 2016

ping?

@jstasiak
Copy link
Contributor

jstasiak commented Jan 7, 2016

Hey @Haypo, do you mind moving the code in regular_file_readall.py into a section guarded by if __name__ == '__main__' so that it's import-safe?

GreenFileIO.readall() calls _trampoline(self, read=True). Problem: on
regular file, epoll_ctl() fails with EPERM on Linux, because regular
files are not supported.

This change skips the call to _trampoline() on regular files. Add
also various unit tests on the various ways to read the whole content
of a file.
@vstinner
Copy link
Contributor Author

vstinner commented Jan 7, 2016

Hey @Haypo, do you mind moving the code in regular_file_readall.py into a section guarded by if name == 'main' so that it's import-safe?

Sure, it's done.

if get_errno(e) not in SOCKET_BLOCKING:
raise IOError(*e.args)
self._trampoline(self, read=True)
if not self._is_regular:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to stat() documentation, file descriptor may be a regular file, directory, symlink, block or char device, socket and fifo. What are supported types? Is it possible to use white list instead? Check that fd is of supported type.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm. looking at this again actually makes me wonder if #314 is a better fix. the problem is triggered when we call epoll.register on a regular file, but we should only be doing that when we catch something in SOCKET_BLOCKING. if i understand things correctly, this should never be raised from regular files.

@davidszotten
Copy link
Contributor

this should be fixed by #314

@vstinner
Copy link
Contributor Author

vstinner commented Dec 5, 2016

Sorry, I'm not interested to update this old pull request anymore, so I just close it.

@vstinner vstinner closed this Dec 5, 2016
@davidszotten
Copy link
Contributor

problem is already fixed by #314 i think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants