-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Rollup of 8 pull requests #83537
Rollup of 8 pull requests #83537
Commits on Mar 15, 2021
-
Add Linux-specific pidfd process extensions
Background: Over the last year, pidfd support was added to the Linux kernel. This allows interacting with other processes. In particular, this allows waiting on a child process with a timeout in a race-free way, bypassing all of the awful signal-handler tricks that are usually required. Pidfds can be obtained for a child process (as well as any other process) via the `pidfd_open` syscall. Unfortunately, this requires several conditions to hold in order to be race-free (i.e. the pid is not reused). Per `man pidfd_open`: ``` · the disposition of SIGCHLD has not been explicitly set to SIG_IGN (see sigaction(2)); · the SA_NOCLDWAIT flag was not specified while establishing a han‐ dler for SIGCHLD or while setting the disposition of that signal to SIG_DFL (see sigaction(2)); and · the zombie process was not reaped elsewhere in the program (e.g., either by an asynchronously executed signal handler or by wait(2) or similar in another thread). If any of these conditions does not hold, then the child process (along with a PID file descriptor that refers to it) should instead be created using clone(2) with the CLONE_PIDFD flag. ``` Sadly, these conditions are impossible to guarantee once any libraries are used. For example, C code runnng in a different thread could call `wait()`, which is impossible to detect from Rust code trying to open a pidfd. While pid reuse issues should (hopefully) be rare in practice, we can do better. By passing the `CLONE_PIDFD` flag to `clone()` or `clone3()`, we can obtain a pidfd for the child process in a guaranteed race-free manner. This PR: This PR adds Linux-specific process extension methods to allow obtaining pidfds for processes spawned via the standard `Command` API. Other than being made available to user code, the standard library does not make use of these pidfds in any way. In particular, the implementation of `Child::wait` is completely unchanged. Two Linux-specific helper methods are added: `CommandExt::create_pidfd` and `ChildExt::pidfd`. These methods are intended to serve as a building block for libraries to build higher-level abstractions - in particular, waiting on a process with a timeout. I've included a basic test, which verifies that pidfds are created iff the `create_pidfd` method is used. This test is somewhat special - it should always succeed on systems with the `clone3` system call available, and always fail on systems without `clone3` available. I'm not sure how to best ensure this programatically. This PR relies on the newer `clone3` system call to pass the `CLONE_FD`, rather than the older `clone` system call. `clone3` was added to Linux in the same release as pidfds, so this shouldn't unnecessarily limit the kernel versions that this code supports. Unresolved questions: * What should the name of the feature gate be for these newly added methods? * Should the `pidfd` method distinguish between an error occurring and `create_pidfd` not being called?
Configuration menu - View commit details
-
Copy full SHA for 5e788f2 - Browse repository at this point
Copy the full SHA 5e788f2View commit details -
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 3426bf7 - Browse repository at this point
Copy the full SHA 3426bf7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 704d6c5 - Browse repository at this point
Copy the full SHA 704d6c5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 766cc25 - Browse repository at this point
Copy the full SHA 766cc25View commit details -
Configuration menu - View commit details
-
Copy full SHA for d850f6b - Browse repository at this point
Copy the full SHA d850f6bView commit details
Commits on Mar 16, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 5ac8a31 - Browse repository at this point
Copy the full SHA 5ac8a31View commit details -
Configuration menu - View commit details
-
Copy full SHA for a266bd8 - Browse repository at this point
Copy the full SHA a266bd8View commit details -
Configuration menu - View commit details
-
Copy full SHA for cfb2d72 - Browse repository at this point
Copy the full SHA cfb2d72View commit details
Commits on Mar 17, 2021
-
cargo update -p parking_lot -p parking_lot_core
Changelog: https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md#parking_lot_core-083-2021-02-12 The full log: ``` Removing cloudabi v0.1.0 Updating parking_lot v0.11.0 -> v0.11.1 Updating parking_lot_core v0.8.0 -> v0.8.3 ```
Configuration menu - View commit details
-
Copy full SHA for 79348f4 - Browse repository at this point
Copy the full SHA 79348f4View commit details -
Commit range: llogiq/bytecount@b0f5fba...8dcd437 The full log: ``` Updating bytecount v0.6.0 -> v0.6.2 Adding libm v0.1.4 Removing packed_simd v0.3.3 Adding packed_simd_2 v0.3.4 ```
Configuration menu - View commit details
-
Copy full SHA for 2b0e27e - Browse repository at this point
Copy the full SHA 2b0e27eView commit details
Commits on Mar 19, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 4238a8f - Browse repository at this point
Copy the full SHA 4238a8fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 58c1352 - Browse repository at this point
Copy the full SHA 58c1352View commit details
Commits on Mar 20, 2021
-
Use a single codegen unit to reduce non-determinism in srcloc.rs test
When building with multiple codegen units the test case can fail with only a subset of all errors. Use a single codegen unit as a workaround.
Configuration menu - View commit details
-
Copy full SHA for addf680 - Browse repository at this point
Copy the full SHA addf680View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3d64f8d - Browse repository at this point
Copy the full SHA 3d64f8dView commit details
Commits on Mar 21, 2021
-
Simplify and fix byte skipping in format! string parser
Fixes '\\' handling in format strings. Fixes rust-lang#83340
Configuration menu - View commit details
-
Copy full SHA for ae8ef70 - Browse repository at this point
Copy the full SHA ae8ef70View commit details -
format macro argument parsing fix
When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes rust-lang#83344
Configuration menu - View commit details
-
Copy full SHA for 6c45ebe - Browse repository at this point
Copy the full SHA 6c45ebeView commit details
Commits on Mar 22, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 18748c9 - Browse repository at this point
Copy the full SHA 18748c9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 93737dc - Browse repository at this point
Copy the full SHA 93737dcView commit details
Commits on Mar 24, 2021
-
Tell GitHub to highlight
config.toml.example
as TOMLThis should be a nice small quality of life improvement when looking at `config.toml.example` on GitHub or looking at diffs of it in PRs.
Configuration menu - View commit details
-
Copy full SHA for b3ae90b - Browse repository at this point
Copy the full SHA b3ae90bView commit details -
rustdoc: Use diagnostics for error when including sources
This error probably almost never happens, but we should still use the diagnostic infrastructure. My guess is that the error was added back before rustdoc used the rustc diagnostic infrastructure (it was all `println!` and `eprintln!` back then!) and since it likely rarely occurs and this code doesn't change that much, no one thought to transition it to using diagnostics. Note that the old error was actually a warning (it didn't stop the rest of doc building). It seems very unlikely that this would fail without the rest of the doc build failing, so it makes more sense for it to be a hard error. The error looks like this: error: failed to render source code for `src/test/rustdoc/smart-punct.rs`: "bar": foo --> src/test/rustdoc/smart-punct.rs:3:1 | 3 | / #![crate_name = "foo"] 4 | | 5 | | //! This is the "start" of the 'document'! How'd you know that "it's" ... 6 | | //! ... | 22 | | //! I say "don't smart-punct me -- please!" 23 | | //! ``` | |_______^ I wasn't sure how to trigger the error, so to create that message I temporarily made rustdoc always emit it. That's also why it says "bar" and "foo" instead of a real error message. Note that the span of the diagnostic starts at line 3 because line 1 of that file is a (non-doc) comment and line 2 is a blank line.
Configuration menu - View commit details
-
Copy full SHA for 3d8ce0a - Browse repository at this point
Copy the full SHA 3d8ce0aView commit details
Commits on Mar 25, 2021
-
The test calls libc::getpid() in the pre_exec hook and asserts that the returned value is different from the PID of the parent. However, libc::getpid() returns the wrong value. Before version 2.25, glibc caches the PID of the current process with the goal of avoiding additional syscalls. The cached value is only updated when the wrapper functions for fork or clone are called. In PR rust-lang#81825 we switch to directly using the clone3 syscall. Thus, the cache is not updated and getpid returns the PID of the parent. source: https://man7.org/linux/man-pages/man2/getpid.2.html#NOTES
Configuration menu - View commit details
-
Copy full SHA for 8bc4de7 - Browse repository at this point
Copy the full SHA 8bc4de7View commit details
Commits on Mar 26, 2021
-
Rollup merge of rust-lang#81825 - voidc:pidfd, r=joshtriplett
Add Linux-specific pidfd process extensions (take 2) Continuation of rust-lang#77168. I addressed the following concerns from the original PR: - make `CommandExt` and `ChildExt` sealed traits - wrap file descriptors in `PidFd` struct representing ownership over the fd - add `take_pidfd` to take the fd out of `Child` - close fd when dropped Tracking Issue: rust-lang#82971
Configuration menu - View commit details
-
Copy full SHA for 42542cc - Browse repository at this point
Copy the full SHA 42542ccView commit details -
Rollup merge of rust-lang#82993 - camelid:source-use-diag, r=jyn514
rustdoc: Use diagnostics for error when including sources This error probably almost never happens, but we should still use the diagnostic infrastructure. My guess is that the error was added back before rustdoc used the rustc diagnostic infrastructure (it was all `println!` and `eprintln!` back then!) and since it likely rarely occurs and this code doesn't change that much, no one thought to transition it to using diagnostics. Note that the old error was actually a warning (it didn't stop the rest of doc building). It seems very unlikely that this would fail without the rest of the doc build failing, so it makes more sense for it to be a hard error. The error looks like this: error: failed to render source code for `src/test/rustdoc/smart-punct.rs`: "bar": foo --> src/test/rustdoc/smart-punct.rs:3:1 | 3 | / #![crate_name = "foo"] 4 | | 5 | | //! This is the "start" of the 'document'! How'd you know that "it's" ... 6 | | //! ... | 22 | | //! I say "don't smart-punct me -- please!" 23 | | //! ``` | |_______^ I wasn't sure how to trigger the error, so to create that message I temporarily made rustdoc always emit it. That's also why it says "bar" and "foo" instead of a real error message. Note that the span of the diagnostic starts at line 3 because line 1 of that file is a (non-doc) comment and line 2 is a blank line.
Configuration menu - View commit details
-
Copy full SHA for bfd56fa - Browse repository at this point
Copy the full SHA bfd56faView commit details -
Rollup merge of rust-lang#83239 - JohnTitor:reduce-deps, r=Mark-Simul…
…acrum Remove/replace some outdated crates from the dependency tree - Remove `cloudabi` by updating `parking_lot` to 0.11.1. - Replace `packed_simd` with `packed_simd2` by updating `bytecount` to 0.6.2.
Configuration menu - View commit details
-
Copy full SHA for 91c019e - Browse repository at this point
Copy the full SHA 91c019eView commit details -
Rollup merge of rust-lang#83328 - tmiasko:asm-test, r=joshtriplett
Fixes to inline assmebly tests * Join test thread to make assertion effective in sym.rs test case * Use a single codegen unit to reduce non-determinism in srcloc.rs test rust-lang#82886
Configuration menu - View commit details
-
Copy full SHA for 65bda37 - Browse repository at this point
Copy the full SHA 65bda37View commit details -
Rollup merge of rust-lang#83343 - osa1:issue83340, r=jackh726
Simplify and fix byte skipping in format! string parser Fixes '\\' handling in format strings. Fixes rust-lang#83340
Configuration menu - View commit details
-
Copy full SHA for 82fac65 - Browse repository at this point
Copy the full SHA 82fac65View commit details -
Rollup merge of rust-lang#83348 - osa1:issue83344, r=jackh726
format macro argument parsing fix When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes rust-lang#83344 --- r? `@estebank`
Configuration menu - View commit details
-
Copy full SHA for e7e9dd6 - Browse repository at this point
Copy the full SHA e7e9dd6View commit details -
Rollup merge of rust-lang#83388 - alamb:alamb/fmt-dcs, r=Mark-Simulacrum
Make # pretty print format easier to discover # Rationale: I use (cargo cult?) three formats in rust: `{}`, debug `{:?}`, and pretty-print debug `{:#?}`. I discovered `{:#?}` in some blog post or guide when I started working in Rust. While `#` is documented I think it is hard to discover. So taking the good advice of `@carols10cents` I am trying to improve the docs with a PR As a reminder "pretty print" means that where `{:?}` will print something like ``` foo: { b1: 1, b2: 2} ``` `{:#?}` will prints something like ``` foo { b1: 1 b2: 3 } ``` # Changes Add an example to `fmt` to try and make it easier to discover `#`
Configuration menu - View commit details
-
Copy full SHA for 1f1bfb9 - Browse repository at this point
Copy the full SHA 1f1bfb9View commit details -
Rollup merge of rust-lang#83431 - camelid:config-example-gitattribute…
…s, r=Mark-Simulacrum Tell GitHub to highlight `config.toml.example` as TOML This should be a nice small quality of life improvement when looking at `config.toml.example` on GitHub or looking at diffs of it in PRs.
Configuration menu - View commit details
-
Copy full SHA for 296f148 - Browse repository at this point
Copy the full SHA 296f148View commit details