8000 gh-110673: test_pty raises on short write by vstinner · Pull Request #110677 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-110673: test_pty raises on short write #110677

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

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

vstinner
Copy link
Member
@vstinner vstinner commented Oct 11, 2023

Add write_all() helper function to test_pty to raise an exception on short write: if os.writes() does not write all bytes. It should not happen for a PTY. Let's check if this assumption is correct.

@vstinner vstinner added tests Tests in the Lib/test dir skip news needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Oct 11, 2023
@vstinner vstinner added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 11, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @vstinner for commit 9b3d056 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 11, 2023
@vstinner vstinner marked this pull request as draft October 11, 2023 10:00
@vstinner
Copy link
Member Author

I convert to a draft until I collect most (if not all) buildbot reports.

@@ -76,6 +76,17 @@ def expectedFailureIfStdinIsTTY(fun):
pass
return fun


def write_all(fd, data):
while True:
Copy link
Member

Choose a reason for hiding this comment

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

Why loop?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh. My first implementation (before I created this PR) actually implemented write_all(): retry os.write() until all bytes are written. But I was told that it must not happend, so I changed my PR to raise an exception instead.

I will remove the loop until buildbots complete, before merging this change.

At least, with this change, if the test hangs again, we will know for sure that no short write occurred.

Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
@vstinner vstinner marked this pull request as ready for review October 11, 2023 20:22
@vstinner vstinner enabled auto-merge (squash) October 11, 2023 20:23
@vstinner
Copy link
Member Author

test_pty was run on a wide range of CI, GitHub Action and buildbots and it didn't fail. There were failures, but all unrelated.

@vstinner vstinner merged commit b4e8049 into python:main Oct 11, 2023
@vstinner vstinner deleted the test_pty_writeall branch October 11, 2023 21:30
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 11, 2023
Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
(cherry picked from commit b4e8049)

Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app
Copy link
bedevere-app bot commented Oct 11, 2023

GH-110742 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Oct 11, 2023
@bedevere-app
Copy link
bedevere-app bot commented Oct 11, 2023

GH-110743 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Oct 11, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 11, 2023
Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
(cherry picked from commit b4e8049)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this pull request Oct 12, 2023
gh-110673: test_pty raises on short write (GH-110677)

Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
(cherry picked from commit b4e8049)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this pull request Oct 12, 2023
gh-110673: test_pty raises on short write (GH-110677)

Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
(cherry picked from commit b4e8049)

Co-authored-by: Victor Stinner <vstinner@python.org>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0