bpo-36161: Use thread-safe function ttyname_r instead of unsafe one ttyname#14868
bpo-36161: Use thread-safe function ttyname_r instead of unsafe one ttyname#14868benjaminp merged 2 commits into
Conversation
|
Hi all, I'm a new contributor and I've made a PR taking into account the discussion seen in the issue page. For the For the This is how a raised error would look when passing an invalid salt: |
Sorry, something went wrong.
|
I don't understand the error in the MacOS Builder: I don't understand since they are both unicode, and password is clearly utf-8 and the second argument are two If it were some codec issue wouldn't it fail in other OSes? Likewise for the other added test. |
Sorry, something went wrong.
mangrisano
left a comment
There was a problem hiding this comment.
Hi and thank you for this PR and for providing tests.
LGTM.
Sorry, something went wrong.
|
@mangrisano Thanks for the approval. Unfortunately the CI is failing in MacOS. If you can, would you give me any pointers as to the cause of the issue? I truly don't understand it 😞 |
Sorry, something went wrong.
|
Hi @mangrisano, and any others. Just a friendly ping to mention that this is ready to be merged. |
Sorry, something went wrong.
46a137a to
21deb92
Compare
August 4, 2019 18:12
21deb92 to
94f62fb
Compare
August 14, 2019 19:08
benjaminp
left a comment
There was a problem hiding this comment.
I don't understand these raise_error changes. Those don't seem related to changing the underlying library call.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
Well according to the discussion in: https://bugs.python.org/issue36161, due to the fact that we are now returning the error code set by I have made the requested changes; please review again |
Sorry, something went wrong.
|
Thanks for making the requested changes! @benjaminp: please review the changes made to this pull request. |
Sorry, something went wrong.
While I agree it's technically a breaking change, I think not raising errors from a failed cryptographic function is severely buggy behavior. "Errors should never pass silently."
I think errors should always be propagated from |
Sorry, something went wrong.
Wise aphorism! I agree wholeheartedly.
Yeah it looks like this will be eventually deprecated and removed. I've decided to simply raise the error in accordingly, since it helps the user but also we are not over engineering future deprecated code. |
Sorry, something went wrong.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
|
Thanks for making the requested changes! @benjaminp: please review the changes made to this pull request. |
Sorry, something went wrong.
benjaminp
left a comment
There was a problem hiding this comment.
okay, but now the tests are failng
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
benjaminp
left a comment
There was a problem hiding this comment.
There are really two logical changes in this PR: checking the error of crypt and using ttyname_r. It would make sense to split them into separate PRs I think.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
* Use dynamically-allocated buffer for ttyname_r buffer * In case there is an error with the crypt/crypt_r then raise the error, instead of failing silently. * Check for EINVAL (invalid argument) in errno when adding not supported cryptographic methods, such as Blowfish in the case of glibc, but raise other errors. * Use _SC_TTY_MAX_LENGTH for TTY_NAME_MAX Signed-off-by: Antonio Gutierrez <chibby0ne@gmail.com>
c21c775 to
5799801
Compare
October 5, 2019 19:27
|
I have made the requested changes; please review again |
Sorry, something went wrong.
|
Thanks for making the requested changes! @benjaminp: please review the changes made to this pull request. |
Sorry, something went wrong.
|
@benjaminp What do you think I should name the other PR? AFAIK the PR branch should match the name of the issue. Should I name |
Sorry, something went wrong.
|
Hi @benjaminp, the error check for crypt/crypt_r was moved to: #16599 |
Sorry, something went wrong.
|
Thank you for the PR. |
Sorry, something went wrong.
…onGH-14868) Signed-off-by: Antonio Gutierrez <chibby0ne@gmail.com>
PR python#14868 replaced the ttyname() call with ttyname_r(), but the old check remained.
…ython#128503) (cherry picked from commit e08b282) PR python#14868 replaced the ttyname() call with ttyname_r(), but the old check remained.
…#128503) PR python#14868 replaced the ttyname() call with ttyname_r(), but the old check remained.

Signed-off-by: Antonio Gutierrez chibby0ne@gmail.com
https://bugs.python.org/issue36161