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

std: move process implementations to sys #136929

Merged
merged 1 commit into from
Mar 23, 2025
Merged

Conversation

joboet
Copy link
Member

@joboet joboet commented Feb 12, 2025

As per #117276, this moves the implementations of Process and friends out of the pal module and into the sys module, removing quite a lot of error-prone #[path] imports in the process (hah, get it ;-)). I've also made the zircon module a dedicated submodule of pal::unix, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in sys). Also, the ensure_no_nuls function on Windows now lives in sys::pal::windows – it's not specific to processes and shared by the argument implementation.

@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added O-hermit Operating System: Hermit O-SGX Target: SGX O-solid Operating System: SOLID O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-windows Operating system: Windows S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 12, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Feb 15, 2025

☔ The latest upstream changes (presumably #137046) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Feb 17, 2025

☔ The latest upstream changes (presumably #137163) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Feb 23, 2025

☔ The latest upstream changes (presumably #137446) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

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

non-blocking question

@@ -289,6 +288,14 @@ pub fn truncate_utf16_at_nul(v: &[u16]) -> &[u16] {
}
}

pub fn ensure_no_nuls<T: AsRef<OsStr>>(s: T) -> crate::io::Result<T> {
if s.as_ref().encode_wide().any(|b| b == 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Hm, are we using this for soundness anywhere? The AsRef<OsStr> conversion could e.g. return different results spuriously which would be a problem if we are.

Copy link
Member Author

Choose a reason for hiding this comment

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

Luckily that's not the case, we only use this with trusted types. But I agree that this isn't great, I'll try to find a better solution in another PR.

@Mark-Simulacrum
Copy link
Member

r=me with a rebase

@joboet joboet force-pushed the move_process_pal branch from 26fd9bf to 57462c0 Compare March 11, 2025 10:54
@bors
Copy link
Contributor

bors commented Mar 12, 2025

☔ The latest upstream changes (presumably #138366) made this pull request unmergeable. Please resolve the merge conflicts.

@Mark-Simulacrum
Copy link
Member

@rustbot author

(Feel free to self-approve, I believe you have permissions, as you rebase)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 15, 2025
@joboet joboet force-pushed the move_process_pal branch from 57462c0 to af6d150 Compare March 15, 2025 16:10
@joboet
Copy link
Member Author

joboet commented Mar 16, 2025

@rustbot author

(Feel free to self-approve, I believe you have permissions, as you rebase)

Will do! Most of the time, I just want to wait until the CI shows green, but then forget to approve the PR until it's too late again... 😄

@bors r=@Mark-Simulacrum

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 16, 2025
…lacrum

std: move process implementations to `sys`

As per rust-lang#117276, this moves the implementations of `Process` and friends out of the `pal` module and into the `sys` module, removing quite a lot of error-prone `#[path]` imports in the process (hah, get it ;-)). I've also made the `zircon` module a dedicated submodule of `pal::unix`, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in `sys`). Also, the `ensure_no_nuls` function on Windows now lives in `sys::pal::windows` – it's not specific to processes and shared by the argument implementation.
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Mar 16, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 16, 2025
@joboet
Copy link
Member Author

joboet commented Mar 17, 2025

That failure seems spurious...
@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 17, 2025
As per rust-lang#117276, this moves the implementations of `Process` and friends out of the `pal` module and into the `sys` module, removing quite a lot of error-prone `#[path]` imports in the process (hah, get it ;-)). I've also made the `zircon` module a dedicated submodule of `pal::unix`, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in `sys`). Also, the `ensure_no_nuls` function on Windows now lives in `sys::pal::windows` – it's not specific to processes and shared by the argument implementation.
@joboet joboet force-pushed the move_process_pal branch from af6d150 to 89f85cb Compare March 22, 2025 11:44
@joboet
Copy link
Member Author

joboet commented Mar 22, 2025

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 22, 2025
@joboet
Copy link
Member Author

joboet commented Mar 22, 2025

Rebased.
@bors r=@Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Mar 22, 2025

📌 Commit 89f85cb has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 22, 2025
@bors
Copy link
Contributor

bors commented Mar 23, 2025

⌛ Testing commit 89f85cb with merge aa8f0fd...

@bors
Copy link
Contributor

bors commented Mar 23, 2025

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing aa8f0fd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 23, 2025
@bors bors merged commit aa8f0fd into rust-lang:master Mar 23, 2025
7 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 23, 2025
Copy link

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 97fc1f6 (parent) -> aa8f0fd (this PR)

Test differences

Show 48 test diffs
  • sys::pal::unix::process::process_common::tests::test_process_group_no_posix_spawn (stage 0): pass -> [missing] (J0)
  • sys::pal::unix::process::process_common::tests::test_process_group_posix_spawn (stage 0): pass -> [missing] (J0)
  • sys::pal::unix::process::process_common::tests::test_process_mask (stage 0): pass -> [missing] (J0)
  • sys::pal::unix::process::process_common::tests::test_program_kind (stage 0): pass -> [missing] (J0)
  • sys::pal::unix::process::process_common::tests::unix_exit_statuses (stage 0): pass -> [missing] (J0)
  • sys::pal::unix::process::process_inner::process_unsupported_wait_status::tests::compare_with_linux (stage 0): pass -> [missing] (J0)
  • sys::pal::unix::process::process_inner::tests::exitstatus_display_tests (stage 0): pass -> [missing] (J0)
  • sys::pal::unix::process::process_inner::tests::test_command_fork_no_unwind (stage 0): pass -> [missing] (J0)
  • sys::process::unix::common::tests::test_process_group_no_posix_spawn (stage 0): [missing] -> pass (J0)
  • sys::process::unix::common::tests::test_process_group_posix_spawn (stage 0): [missing] -> pass (J0)
  • sys::process::unix::common::tests::test_process_mask (stage 0): [missing] -> pass (J0)
  • sys::process::unix::common::tests::test_program_kind (stage 0): [missing] -> pass (J0)
  • sys::process::unix::common::tests::unix_exit_statuses (stage 0): [missing] -> pass (J0)
  • sys::process::unix::unix::tests::exitstatus_display_tests (stage 0): [missing] -> pass (J0)
  • sys::process::unix::unix::tests::test_command_fork_no_unwind (stage 0): [missing] -> pass (J0)
  • sys::process::unix::unix::unsupported_wait_status::tests::compare_with_linux (stage 0): [missing] -> pass (J0)
  • sys::pal::unix::process::process_common::tests::test_program_kind (stage 1): pass -> [missing] (J1)
  • sys::pal::unix::process::process_common::tests::unix_exit_statuses (stage 1): pass -> [missing] (J1)
  • sys::pal::unix::process::process_inner::tests::exitstatus_display_tests (stage 1): pass -> [missing] (J1)
  • sys::pal::unix::process::process_inner::tests::test_command_fork_no_unwind (stage 1): pass -> [missing] (J1)
  • sys::process::unix::common::tests::test_program_kind (stage 1): [missing] -> pass (J1)
  • sys::process::unix::common::tests::unix_exit_statuses (stage 1): [missing] -> pass (J1)
  • sys::process::unix::unix::tests::exitstatus_display_tests (stage 1): [missing] -> pass (J1)
  • sys::process::unix::unix::tests::test_command_fork_no_unwind (stage 1): [missing] -> pass (J1)
  • sys::pal::unix::process::process_common::tests::test_process_group_no_posix_spawn (stage 1): ignore -> [missing] (J2)
  • sys::pal::unix::process::process_common::tests::test_process_group_posix_spawn (stage 1): ignore -> [missing] (J2)
  • sys::pal::unix::process::process_common::tests::test_process_mask (stage 1): ignore -> [missing] (J2)
  • sys::process::unix::common::tests::test_process_group_no_posix_spawn (stage 1): [missing] -> ignore (J2)
  • sys::process::unix::common::tests::test_process_group_posix_spawn (stage 1): [missing] -> ignore (J2)
  • sys::process::unix::common::tests::test_process_mask (stage 1): [missing] -> ignore (J2)
  • sys::pal::windows::process::tests::test_make_command_line (stage 1): pass -> [missing] (J3)
  • sys::pal::windows::process::tests::test_raw_args (stage 1): pass -> [missing] (J3)
  • sys::pal::windows::process::tests::test_thread_handle (stage 1): pass -> [missing] (J3)
  • sys::pal::windows::process::tests::windows_env_unicode_case (stage 1): pass -> [missing] (J3)
  • sys::pal::windows::process::tests::windows_exe_resolver (stage 1): pass -> [missing] (J3)
  • sys::process::windows::tests::test_make_command_line (stage 1): [missing] -> pass (J3)
  • sys::process::windows::tests::test_raw_args (stage 1): [missing] -> pass (J3)
  • sys::process::windows::tests::test_thread_handle (stage 1): [missing] -> pass (J3)
  • sys::process::windows::tests::windows_env_unicode_case (stage 1): [missing] -> pass (J3)
  • sys::process::windows::tests::windows_exe_resolver (stage 1): [missing] -> pass (J3)
  • sys::pal::unix::process::process_inner::process_unsupported_wait_status::tests::compare_with_linux (stage 1): pass -> [missing] (J4)
  • sys::process::unix::unix::unsupported_wait_status::tests::compare_with_linux (stage 1): [missing] -> pass (J4)
  • sys::pal::unix::process::process_common::tests::test_process_group_no_posix_spawn (stage 1): pass -> [missing] (J5)
  • sys::pal::unix::process::process_common::tests::test_process_group_posix_spawn (stage 1): pass -> [missing] (J5)
  • sys::pal::unix::process::process_common::tests::test_process_mask (stage 1): pass -> [missing] (J5)
  • sys::process::unix::common::tests::test_process_group_no_posix_spawn (stage 1): [missing] -> pass (J5)
  • sys::process::unix::common::tests::test_process_group_posix_spawn (stage 1): [missing] -> pass (J5)
  • sys::process::unix::common::tests::test_process_mask (stage 1): [missing] -> pass (J5)

Job group index

  • J0: mingw-check
  • J1: aarch64-apple, aarch64-gnu, arm-android, armhf-gnu, dist-i586-gnu-i586-i686-musl, i686-gnu-1, i686-gnu-nopt-1, test-various, x86_64-apple-1, x86_64-gnu, x86_64-gnu-llvm-18-1, x86_64-gnu-llvm-18-2, x86_64-gnu-llvm-18-3, x86_64-gnu-llvm-19-1, x86_64-gnu-llvm-19-2, x86_64-gnu-llvm-19-3, x86_64-gnu-nopt, x86_64-gnu-stable
  • J2: aarch64-apple, aarch64-gnu, arm-android, armhf-gnu, x86_64-apple-1
  • J3: i686-msvc-1, x86_64-mingw-1, x86_64-msvc-1
  • J4: aarch64-gnu, armhf-gnu, dist-i586-gnu-i586-i686-musl, i686-gnu-1, i686-gnu-nopt-1, test-various, x86_64-gnu, x86_64-gnu-llvm-18-1, x86_64-gnu-llvm-18-2, x86_64-gnu-llvm-18-3, x86_64-gnu-llvm-19-1, x86_64-gnu-llvm-19-2, x86_64-gnu-llvm-19-3, x86_64-gnu-nopt, x86_64-gnu-stable
  • J5: dist-i586-gnu-i586-i686-musl, i686-gnu-1, i686-gnu-nopt-1, test-various, x86_64-gnu, x86_64-gnu-llvm-18-1, x86_64-gnu-llvm-18-2, x86_64-gnu-llvm-18-3, x86_64-gnu-llvm-19-1, x86_64-gnu-llvm-19-2, x86_64-gnu-llvm-19-3, x86_64-gnu-nopt, x86_64-gnu-stable

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (aa8f0fd): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary 0.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.3% [1.6%, 2.7%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-2.8%, -2.3%] 2
All ❌✅ (primary) - - 0

Cycles

Results (secondary -2.8%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-3.3%, -2.2%] 2
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 775.27s -> 775.713s (0.06%)
Artifact size: 365.52 MiB -> 365.52 MiB (-0.00%)

thaliaarchi added a commit to thaliaarchi/rust that referenced this pull request Mar 24, 2025
PRs rust-lang#136842 (Add libstd support for Trusty targets), rust-lang#137793 (Stablize
anonymous pipe), and rust-lang#136929 (std: move process implementations to
`sys`) merged around the same time, so update Trusty to take them into
account.
jhpratt added a commit to jhpratt/rust that referenced this pull request Mar 26, 2025
…Poison,saethlin

Trusty: Fix build for anonymous pipes and std::sys::process

PRs rust-lang#136842 (Add libstd support for Trusty targets), rust-lang#137793 (Stablize anonymous pipe), and rust-lang#136929 (std: move process implementations to `sys`) merged around the same time, so update Trusty to take them into account.

cc `@randomPoison`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 26, 2025
Rollup merge of rust-lang#138875 - thaliaarchi:trusty-build, r=randomPoison,saethlin

Trusty: Fix build for anonymous pipes and std::sys::process

PRs rust-lang#136842 (Add libstd support for Trusty targets), rust-lang#137793 (Stablize anonymous pipe), and rust-lang#136929 (std: move process implementations to `sys`) merged around the same time, so update Trusty to take them into account.

cc `@randomPoison`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. O-hermit Operating System: Hermit O-SGX Target: SGX O-solid Operating System: SOLID O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-windows Operating system: Windows S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants