Repository navigation
Read process arguments and environment through Platform - #2892
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Process command-line and environment decoding belongs to Platform. ProcessIdentity delegates both facts; the four consumer modules no longer open /proc themselves.
IMPL-13: owner_launch.py, owner_lifecycle.py, active_route.py and host_services repeated the same process read mechanism outside its owner. LinuxPlatform now owns both proc reads beside _stat. IMPL-12: SystemdUserService owns its service-specific missing-command refusal once.
LinuxPlatform.arguments (child_process.py:565) reads NUL-terminated argument words through os.fsdecode. Missing files and empty cmdline bytes raise ProcessLookupError(process.pid); _stat already classifies zombies as absent. Empty argv[0] remains a distinct value, and owner_lifecycle.py:107 retains its existing interpreter refusal. LinuxPlatform.environment (:574) decodes key/value entries at their first equals sign, preserving equals signs in values. Permission and other IO errors propagate.
ProcessIdentity.arguments/environment at child_process.py:250/253 delegate in one line each. DarwinPlatform.arguments/environment at :715/718 and Win32Platform at :913/916 explicitly raise NotImplementedError, per the commander's portability correction; no native readers or fallback paths were invented.
Consumers:
Before, grep of proc command/environment reads on main:
After:
Requested correction greps:
Source checks: owner/call declarations inspected through AST before edits; all changed modules parse; git diff --check is clean. Main including #2888/#2889 is merged. No new ProcessLookupError catch outside running_arguments and the existing active_route branch. tools/agent_resource_check.py and meminfo/pressure/locks reads are untouched.
Earlier head 9ecbe3a received 68 passed, 1 skipped on the review fork, as reported by commander. That result predates the empty-command correction. No tests were run by this unit.
Assumed: Linux proc cmdline records are NUL-terminated; empty raw bytes mean no live process of ours. Nonempty records may still contain an empty argv[0]. The explicit NotImplementedError portability correction supersedes the original Darwin/Windows wording. No process decision is replaced by a default argv.