-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#8969] Fix for twisted.internet.sendmsg segfault on Linux Python 2 #650
Conversation
Current coverage is 90.66% (diff: 66.66%)
|
|
Does this fix: |
|
I can't reproduce the behaviour in https://twistedmatrix.com/trac/ticket/5649 here. With that code, from trunk, I get a segfault and not a SIGABRT. With this PR I get an exception with errno=ENOTSOCK, which seems to make sense, given STDIN is being used. PS: Quickly tested on an Ubuntu 16.04 virtual machine. |
|
Dear reviewers, I need guidance to find a way of ensuring 100% diff coverage. Given that the test for "does not segfault" is calling and disregarding the result or acceptable exceptions like socket.error, in this case I wrapped the call in a try/except block that travis is not fully covering. The except block is only hit on Mac OS, confirmed at least 10.9 and 10.10. Any pointers? Maybe some other strategy is needed?... |
|
Moved to #651 |
| member to see if the "message" fits in the buffer, and | ||
| returns NULL if it doesn't. Zero-filling the buffer | ||
| ensures that this doesn't happen. */ | ||
| memset(message_header.msg_control, 0, all_data_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyMem_Calloc? Or even PyMem_RawCalloc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can tell from the Python docs, those are not available on Python 2, for which _sendmsg.c is needed. Am I mistaken?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyMem_Calloc() is new in Python 3.5, and apparently not in Python 2.
Trac ticket at https://twistedmatrix.com/trac/ticket/8969