Skip to content
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

bpo-36013: Fix the interactive shell SIGINT test. #11902

Merged
merged 3 commits into from
Feb 17, 2019

Conversation

gpshead
Copy link
Member

@gpshead gpshead commented Feb 17, 2019

First attempt: switch shell interupt test to zsh.

if this doesn't work out, i'll just delete this test. it's a nice bonus integration test to avoid a regression of the actual interactive mode ^C'd process detection rather than the weak test that looks only at exit status (not what shells do).

https://bugs.python.org/issue36013

First attempt: switch shell interupt test to zsh.
@bedevere-bot bedevere-bot added tests Tests in the Lib/test dir awaiting merge labels Feb 17, 2019
@gpshead gpshead added type-bug An unexpected behavior, bug, or error skip news labels Feb 17, 2019
# when a command exits via ^C and stops executing further
# commands.
process = subprocess.run(
["bash", "-ic",
["zsh", "-ic",
"echo TEST START 1>&2; "
f"{sys.executable} -c 'import os,signal; os.kill(os.getpid(), signal.SIGINT)'; "
Copy link
Member

Choose a reason for hiding this comment

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

From the issue:

Could it be a race condition the signal delivery?
Technically, the process sends itself a signal and never waits for it, it just exits. The signal can arrive after the process has exited normally. Or I am missing something obvious in this reasoning?

Copy link
Member Author

Choose a reason for hiding this comment

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

it is possible (which is why i was thinking maybe flaky) but I suspect more is going on here as it only seems unreliable on CI and buildbot systems, and seems reliable from our login shells. I'm opting to not try and figure it out. testing interactive things within in automation isn't worth the effort for this issue. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

the other test above this one also uses the same self-killing code fwiw.

@gpshead
Copy link
Member Author

gpshead commented Feb 17, 2019

even zsh fails in CI runs despite passing in an interactive shell. i'll just get rid of the test.
https://dev.azure.com/Python/cpython/_build/results?buildId=38019

Unclear if this is necessary, but if there is a race condition between
delivering ourselves a SIGINT and the CPython SIGINT handler that raises
KeyboardInterrupt happening before our process could exit, this should
avoid it.  I made it easier to read and maintain regardless.
@gpshead gpshead self-assigned this Feb 17, 2019
Copy link
Contributor

@eamanu eamanu left a comment

Choose a reason for hiding this comment

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

lgtm

@gpshead gpshead merged commit 414c625 into python:master Feb 17, 2019
@gpshead gpshead deleted the issue36013 branch February 17, 2019 01:22
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 type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants