Skip to content

Conversation

@Yashp002
Copy link
Contributor

@Yashp002 Yashp002 commented Jan 8, 2026

sys.remote_exec(pid, script_path) creates a temporary script with restrictive
permissions (typically 0o600). The target process must be able to read this
file, which fails in cross-user scenarios (e.g. sudo debugging).

Added documentation note with example showing how to os.chmod() the file to
0o644 (readable by group/other) before calling.

Addresses the PermissionError reported in #143511.

Co-authored-by: @RafaelWO


📚 Documentation preview 📚: https://cpython-previews--143575.org.readthedocs.build/

@RafaelWO
Copy link
Contributor

RafaelWO commented Jan 8, 2026

Wouldn't it make more sense to add this info to the remote debugging docs? 🤔

@Yashp002
Copy link
Contributor Author

Yashp002 commented Jan 8, 2026

@RafaelWO Well i figured sys.rst or sys.executable here is way more used or gone through by users on a daily basis? Sys.rst is more discoverable for users hitting the error.
We could go with keeping it in both too but this one's just more discoverable imo unless I'm heavily mistaken.

@StanFromIreland StanFromIreland changed the title gh-143511: Document sys.remote_exec permissions requirements [skip news] gh-143511: Document sys.remote_exec permissions requirements Jan 9, 2026
Comment on lines 2022 to 2033
Callers should adjust permissions before calling, for example::

import os
import tempfile
import sys

with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f:
f.write("print('Hello from remote!')")
f.flush()
os.chmod(f.name, 0o644) # Readable by group/other
sys.remote_exec(pid, f.name)
os.unlink(f.name) # Cleanup
Copy link
Member

Choose a reason for hiding this comment

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

This should be put before the audit event descriptions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@picnixz Have implemented that yes.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not before the audit events yet. Speaking in line numbers, your paragraph should be after line 1998 but before 2000.

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did so
accidentally named the commit the same as last one but yeah, shouldn't be a problem

Copy link
Contributor

Choose a reason for hiding this comment

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

You are almost there: Please move all your content above the audit-event directives - not just the first paragraph 😉

@StanFromIreland
Copy link
Member

You need to update your branch to fix the CI.

@Yashp002
Copy link
Contributor Author

@StanFromIreland Are there any more changes I need to apply

@picnixz
Copy link
Member

picnixz commented Jan 26, 2026

You need to resolve the conflicts first

@Yashp002
Copy link
Contributor Author

@picnixz I've resolved it

@bedevere-app
Copy link

bedevere-app bot commented Jan 27, 2026

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Yashp002 and others added 4 commits January 28, 2026 15:03
Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
@Yashp002
Copy link
Contributor Author

I have made the requested changes; please review again

@bedevere-app
Copy link

bedevere-app bot commented Jan 28, 2026

Thanks for making the requested changes!

@picnixz: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from picnixz January 28, 2026 09:34
@picnixz
Copy link
Member

picnixz commented Jan 28, 2026

When tests fail, please do not request a review.

and minor version as the local process. If either the local or remote
interpreter is pre-release (alpha, beta, or release candidate) then the
local and remote interpreters must be the same exact version.
local and remote interpreters must be the same exact version.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
local and remote interpreters must be the same exact version.
local and remote interpreters must be the same exact version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants