Skip to content

gh-112800: Ignore PermissionError on SubprocessTransport.close() #112803

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
Dec 24, 2023

Conversation

allisonkarlitskaya
Copy link
Contributor

@allisonkarlitskaya allisonkarlitskaya commented Dec 6, 2023

In case the spawned process is setuid, we may not be able to send signals to it, in which case our .kill() call will raise PermissionError.

Ignore that in order to avoid .close() raising an exception. Hopefully the process will exit as a result of receiving EOF on its stdin.

Closes #112800

@ghost
Copy link

ghost commented Dec 6, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Dec 6, 2023

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

In case the spawned process is setuid, we may not be able to send
signals to it, in which case our .kill() call will raise
PermissionError.

Ignore that in order to avoid .close() raising an exception.  Hopefully
the process will exit as a result of receiving EOF on its stdin.
Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

Hey! Sorry for the delay. This makes sense. I was going to ask for a test, but of course that's pointless since we're not going to be writing tests that depend on setuid programs. The fix is really minimal, so I'm going to merge this.

Do you have an opinion on whether this is important enough to backport the fix to 3.12 or 3.11?

@gvanrossum gvanrossum merged commit 0187a7e into python:main Dec 24, 2023
@gvanrossum gvanrossum added the 3.12 only security fixes label Dec 24, 2023
ryan-duve pushed a commit to ryan-duve/cpython that referenced this pull request Dec 26, 2023
…) in asyncio (python#112803)

In case the spawned process is setuid, we may not be able to send
signals to it, in which case our .kill() call will raise
PermissionError.

Ignore that in order to avoid .close() raising an exception.  Hopefully
the process will exit as a result of receiving EOF on its stdin.
kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
…) in asyncio (python#112803)

In case the spawned process is setuid, we may not be able to send
signals to it, in which case our .kill() call will raise
PermissionError.

Ignore that in order to avoid .close() raising an exception.  Hopefully
the process will exit as a result of receiving EOF on its stdin.
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…) in asyncio (python#112803)

In case the spawned process is setuid, we may not be able to send
signals to it, in which case our .kill() call will raise
PermissionError.

Ignore that in order to avoid .close() raising an exception.  Hopefully
the process will exit as a result of receiving EOF on its stdin.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…) in asyncio (python#112803)

In case the spawned process is setuid, we may not be able to send
signals to it, in which case our .kill() call will raise
PermissionError.

Ignore that in order to avoid .close() raising an exception.  Hopefully
the process will exit as a result of receiving EOF on its stdin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 only security fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SubprocessTransport .close() can fail with PermissionError with setuid programs
2 participants