⚡ Sangsakala Proxy 🏠 Home
Skip to content

Share POSIX IDs and prepare subprocess inputs - #9677

Draft
youknowdot wants to merge 4 commits into
RustPython:mainfrom
youknowdot:account-id-conversion-group-20261103
Draft

youknowdot wants to merge 4 commits into
RustPython:mainfrom
youknowdot:account-id-conversion-group-20261103

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Group the shared POSIX account converters with the subprocess preparation that consumes them.

  • Reuse UID/GID conversion for POSIX controls, pwd.getpwuid, grp.getgrgid, and _posixsubprocess, including index-enabled values, C-long overflow behavior, and the -1 sentinel.
  • Match subprocess scalar-binding and parent-preparation order: preexec restrictions, error-pipe and sorted-descriptor validation, executable/argv/environment/cwd conversion, groups, IDs, then audit.
  • Emit _posixsubprocess.fork_exec with the original executable, argv, and environment objects after native preparation and before fork. Accept args=None, distinguish bytes-only executable/environment sequences from filesystem paths, and retain live argv mutation checks and converted bytes lifetimes.
  • Keep user descriptors as raw integers rather than inventing BorrowedFd<'static> validity. Typed host APIs share the same implementation; child syscall order, credential order, and error-pipe serialization remain unchanged.

References: CPython 3.15.0 _posixsubprocess, Clinic binding, ID converters, pwd, and grp.

Validation

  • Focused stdlib build and strict all-target VM/host-env/stdlib Clippy with threading passed.
  • Four native host tests passed: invalid descriptor errors, early setup rejection, raw/borrowed keep-list agreement, and isolated owned-pipe inheritance/write/dup behavior. These tests do not fork, exec, run a VM, change credentials, or redirect standard streams.
  • Normal repository commit hooks, rustfmt, and whitespace checks passed.
  • Independent source review covered callback/error order, list mutation, bytes-subclass lifetime, audit identity, pointer lifetime, and raw-FD syscall order. CPython-only reference probes were intercepted by an audit hook before fork.

Remaining scope

This remains a draft. RustPython runtime, full workspace/C-API suites, and cross-platform execution were not run. No Lib, snippet, workflow, or expected-failure marker edits; the existing audit marker remains until guarded runtime validation.

The compile-time extra-group cap is supplied for Linux GNU, macOS, FreeBSD, and NetBSD. Other targets retain their existing uncapped preparation; runtime sysconf is not substituted for CPython's header constant. Existing preexec GC/fork callbacks and child algorithms are outside this patch. The shared iterable collector's partial-result destruction order when iteration itself fails is also unchanged.

AI assistance: OpenAI Codex performed source comparison, implementation, reference probes, validation, and independent source review; model version was not exposed.

Reuse common UID and GID converters for POSIX controls and account
lookups. Honor index-enabled arguments, C-long conversion boundaries,
and sentinel formatting while preserving lookup allocation errors.

Assisted-by: OpenAI Codex:model version not exposed
Bring AsObject into pwd for exception classification and remove the obsolete POSIX PyObject import.

Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Assisted-by: OpenAI Codex: model version not exposed
Match parent-side conversion and validation order while reusing the shared POSIX ID converters. Keep original audit objects, bytes-path lifetimes and live argv list mutation behavior; adapt child descriptors as raw integers without fabricated borrowed lifetimes. Add bounded host-only tests for descriptor errors and owned pipe operations.

Assisted-by: OpenAI Codex: model version not exposed
@youknowone youknowone changed the title Share POSIX account ID conversion Share POSIX IDs and prepare subprocess inputs Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant