Summary:
My recent diff: D49742979 which upgraded `bitflags` to 2.4 seems to have broken the Open Source CI for a few crates under `hermetic_infra`.
That is because among other changes, `bitflags` 2.x requires the `serde` Cargo feature to `#[derive(Serialize, Deserialize)]` on generated flag types.
See [the release notes](https://github.com/bitflags/bitflags/releases/tag/2.0.0?fbclid=IwAR0BHMz6T_jmIkXaJmkdvc9LdDTW15G5SSU_A-cZvLxof0aGS0BA7Hqnme0)
This change should fix it.
Reviewed By: mitrandir77
Differential Revision: D52801745
fbshipit-source-id: 826c70e5a111ab1a1159cceab6fb40831f355287
Summary:
## Motivation
Since the latest compiler update, we are getting `clippy::bad_bit_mask` errors at the callsites of `bitflags!` macros where one of the variant is zero.
[Upstream won't address it in the `1.x` branch](https://github.com/bitflags/bitflags/pull/373) and recommends upgrading to the `2.x` branch.
We are very close to reaching **zero clippy lints** in [Mononoke and other servers](https://fburl.com/code/pd76yn5e), which would feel nice.
## Specific categories of changes (in case it helps with the code review)
The change from `1.x` to `2.x` introduces a number of backward compatibility breakages which I had to workaround in our codebase.
See [the release notes for 2.0](https://github.com/bitflags/bitflags/releases/tag/2.0.0) for the explanation for the manual fixes I had to perform at each call site.
---
**Adding traits to derive:**
```
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
```
> Generated flags types now derive fewer traits. If you need to maintain backwards compatibility, you can derive the following yourself:
---
**Replacing read uses of `.bits` with `.bits()`**
> You can now use the .bits() method instead of the old .bits.
> The representation of generated flags types has changed from a struct with the single field bits to a newtype.
---
**Replacing raw setting of `.bits` with `.from_bits_retain()`**
Due to the point above, the representation of the type is not exposed anymore. From [the documentation](https://docs.rs/bitflags/latest/bitflags/example_generated/struct.Flags.html#method.from_bits_retain), `from_bits_retain` "convert from a bits value exactly", which matches the old behaviour
---
**Replacing the unsafe `from_bits_unchecked` method with `from_bits_retain`**
> The unsafe from_bits_unchecked method is now a safe from_bits_retain method.
---
**Extracting some structs outside of the `bitflags!` macro**
Apart from the derives that `bitflags` knows about, such as `serde`, `bitflags` now can't deal with custom derives in macros with the previous syntax. I followed the recommendation from [their documentation](https://docs.rs/bitflags/latest/bitflags/index.html#custom-derives) to declare the `struct` ahead of of the macro call and only declare the `impl` block inside the macro.
---
**Changes to test output**
This does not stand out in the release notes, but as of [this upstream PR](https://github.com/bitflags/bitflags/pull/297), the `Debug` output of generated bitflags has changed. This means any tests that rely on this (and of course, there are a few) needed updating.
In particular, the `vespa` tests rely on that output in a non-obvious way. You might have to trust me (and CI) on these ones...
Reviewed By: dtolnay
Differential Revision: D49742979
fbshipit-source-id: c818c37af45f0964e8fdb7ec6173ad66bb982c00
Summary: A newer version of colored adds support for true color terminal text coloring. The changelog only indicates "Alter Color interface to return Cow<'static, str>" besides the true color support as a "change" in the changelog and I'm not expecting people to really use this. If they do, I'll see it in Sandcastle?
Reviewed By: dtolnay
Differential Revision: D52391497
fbshipit-source-id: c08fffc171f7d5f9b75f96617aa673867ab45312
Summary: Adds basic info that every crate should have.
Reviewed By: dtolnay
Differential Revision: D52051107
fbshipit-source-id: 828ac6a752dbb4b419577fca08815014c8b96c42
Summary:
Release notes: https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html
This release is coupled with an update of the `anyhow` and `thiserror` crates because the unstable standard library API for backtraces has changed.
Fbcode changes:
- `feature(default_free_fn)` deleted (D50300881)
- `noop_method_call` lint becomes warn-by-default (D50486032, D50516201)
- stronger `invalid_reference_casting` detection (D50488164)
- `feature(unix_chown)` has been stabilized
- `feature(provide_any)` and `std::provider` deleted
- `clippy::unwrap_or_else_default` renamed to `clippy::unwrap_or_default`
- type inference ambiguities (D51780425)
- `nu-command` build error (D51779062)
Reviewed By: AndreasBackx, shayne-fletcher
Differential Revision: D50294321
fbshipit-source-id: 0fac87f6ba072ad029f9ce41ce94ed813e855b20
Summary:
Fixes all current clippy warnings[1] so CI is green again.
Fixing the warning `clippy::needless_pass_by_ref_mut` became a little involved. The internal version of clippy isn't recent enough to have this warning and so just doing `#[allow(clippy::needless_pass_by_ref_mut)]` leads to another error. The resulting change fixes the clippy warning and gets rid of some of the shenanigans I was doing to avoid allocating path buffers within the child process.
[1]: https://github.com/facebookexperimental/reverie/actions/runs/6164196219/job/16729396694
Pull Request resolved: https://github.com/facebookexperimental/reverie/pull/23
Reviewed By: VladimirMakaev
Differential Revision: D49209202
Pulled By: jasonwhite
fbshipit-source-id: b03ff432783910bef11fc239d146659dc2c0db30
Summary:
Update num_cpus to version 1.16.0. We need this version as it is a requirement
of libbpf-sys v1.2.1+v1.2.0, which is to be imported subsequently.
Reviewed By: zertosh
Differential Revision: D47380958
fbshipit-source-id: d1fa12a1c8a974686d70d47876e990da4a73b839
Summary:
Note: this is a re-land of D44623815, which was was reverted because of a land race with D44626072
In particular this fixes `FlattenUnordered` having a nasty deadlock, but also
some other bugs:
```
# 0.3.28 - 2023-03-30
* Update to syn 2. This raises MSRV of utility crates to 1.56. (#2730, #2733)
* Fix bug in `FlattenUnordered` (#2726, #2728)
# 0.3.27 - 2023-03-11
* Add `TryFlattenUnordered` (#2577, #2590, #2606, #2607)
* Add `AbortHandle::is_aborted` (#2710)
* Add `AbortRegistration::handle` (#2712)
* Make `BiLock` strict-provenance compatible (#2716)
# 0.3.26 - 2023-01-30
* Add `Either::as_pin_mut` and `Either::as_pin_ref` (#2691)
* Add `Shared::ptr_eq` and `Shared::ptr_hash` (#2691)
* Implement `FusedStream` for `Buffered` (#2676)
* Implement `FusedStream` for all streams in `ReadyChunks` (#2693)
* Fix bug in `FuturesOrdered::push_front` (#2664)
* Remove `Fut::Output: Clone` bounds from some `Shared` methods (#2662)
* Remove `T: Debug` bounds from `Debug` implementations of `mpsc` and `oneshot` types (#2666, #2667)
# 0.3.25 - 2022-10-20
* Fix soundness issue in `join!` and `try_join!` macros (#2649)
* Implement `Clone` for `sink::Drain` (#2650)
# 0.3.24 - 2022-08-29
* Fix incorrect termination of `select_with_strategy` streams (#2635)
# 0.3.23 - 2022-08-14
* Work around MSRV increase due to a cargo bug.
```
Reviewed By: zertosh
Differential Revision: D44632588
fbshipit-source-id: bdd87cb02b3aef63a65b1f9b852579225adfedbd
Summary:
Removes need for patch.
It had already been updated to 3.4 but this just formalizes it.
Reviewed By: jasonwhite
Differential Revision: D44274378
fbshipit-source-id: d17ecbbee06c7df30f689eb859fb31fdf07d8d44
Summary:
Everything in Reverie is super Linux-specific, so we should just skip compilation if we're not targetting Linux.
This is helpful for consumers of the library when it gets published to crates.io. With this, they don't need to have a special case for this in the `[dependencies]` section of `Cargo.toml`.
Reviewed By: VladimirMakaev
Differential Revision: D41824410
fbshipit-source-id: be1e0a887e35ed151cfad27af8107246df30c2e5
Summary: Missed these in a previous diff.
Reviewed By: rrnewton
Differential Revision: D41567346
fbshipit-source-id: eba0b738a66da1823312803ed91fdc5eeaf90c57
Summary: This size optimization relies on a nightly feature that will likely never be stabilized. All it did was make `Option<Fd>` equal to 4 bytes instead of 8 bytes.
Reviewed By: rrnewton
Differential Revision: D41506685
fbshipit-source-id: 15aa75b01200ff7f179373b07e14f542590aa24d
Summary: `std::io::set_output_capture()` is only available in nightly. In order to publish this crate, we can't use unstable features.
Reviewed By: rrnewton
Differential Revision: D41394375
fbshipit-source-id: d4b6e9310cd6d6925aa9d7b0cd5c4558d6ef7d4c
Summary: Refactors `do_exec` a little bit so that it no longer needs the `never_type` feature. This doesn't affect correctness at all.
Reviewed By: rrnewton
Differential Revision: D41394377
fbshipit-source-id: 30e8793557d12d9aef1c5641eb782b170f86512b
Summary: The usage of `rustc_attrs` is completely optional and only serves as a size optimization for the `Fd` type.
Reviewed By: rrnewton
Differential Revision: D41394376
fbshipit-source-id: 2f4898b872dc32c517df99e0b5f4a82fad5bda77
Summary:
This adds the "nightly" crate feature to `reverie-process` so that it can use nightly features if they are enabled.
This *should* let it still get uploaded to crates.io, but some fancy optional nightly features will be hidden behind this feature flag. Then, we can still use these features internally.
Reviewed By: rrnewton
Differential Revision: D41394572
fbshipit-source-id: 6f5eaccd070f85c839089d3d5e5994471948afd4
Summary: These previous launch_* functions can be simplified by using RunOpts to contain all the relevant information about a run, plus everything needed to print a reproducer command.
Reviewed By: VladimirMakaev
Differential Revision: D41329114
fbshipit-source-id: 5bab08dfbf28e1cee7fd244178e03ba2cdc1ba34
Summary: This fixes the initial syscall injection on aarch64. This also does slight simplification of the instructions that get plopped down at the current instruction pointer so that we can fit the instructions into a single word. That is, instead of injecting `INT3; SYSCALL; INT3`, we inject `SYSCALL; INT3`.
Reviewed By: VladimirMakaev
Differential Revision: D40867427
fbshipit-source-id: 2afa96f2270e16284523a17b09da00529893c20e
Summary: Gets all tests in `reverie-process` successfully working on aarch64.
Reviewed By: VladimirMakaev
Differential Revision: D40867425
fbshipit-source-id: 4aa7b0be17a40f677baf5de312a0765f8c41c2a4
Summary: Update from 0.2.135 to 0.2.137, the latest version on crates.io, in preparation for backporting a PR in the diff after this one.
Reviewed By: zertosh
Differential Revision: D40874274
fbshipit-source-id: debf9dae82ecc20201470e634f10904a2b308e51
Summary:
Followed guide here https://www.internalfb.com/intern/wiki/Linting/License_Lint/ to add fbcode/hermetic_infra/** code to license linter. As we have parts of our code shipped as Open Source it's important to get this automated
This diff is updating existing file's licenses to not get conflict after lint rule enablement
Reviewed By: jasonwhite
Differential Revision: D40674080
fbshipit-source-id: da6ecac036f8964619cf7912058f3a911558e7b1
Summary: This updates the libc crate to 0.2.135, which includes the FICLONE constant needed to the given ioctl.
Reviewed By: justintrudell
Differential Revision: D40286796
fbshipit-source-id: acfa115479cd289f478d8d73937be34ced5c4bbb
Summary:
When I was trying to use `nix::unistd::gethostname` in D39783468, the version `0.23.0` will require users to pass in a `buf` as a parameter, however, in `0.25.0`, there is no need to pass in a `buf` as a parameter. Hence, I would love to update `nix` crate from `0.23` to `0.25` in order to not pass a redundant `buf` while calling `nix::unistd::gethostname`.
I fixed conflicts reflected from the signals manually so this diff is more than a few lines of code in `Cargo.toml`.
Here are the [changes](https://github.com/nix-rust/nix/compare/v0.23.0..v0.25.0) between `0.23` and `0.25`. See `CHANGELOG.md` for the most significant changes in this version.
Reviewed By: bgw
Differential Revision: D39919100
fbshipit-source-id: 7f62585ff72230bd2608aeb5a4780dc0128795f7
Summary: D39418421 (8fef664fab) prematurely upgraded `thiserror`. Various projects in fbcode use nightly features including std::backtrace but the current fbcode Rust toolchain is 1.63.0, in which the backtrace API is different from the API of the latest nightlies.
Reviewed By: quark-zju
Differential Revision: D39562441
fbshipit-source-id: d1f8a993ec776cf82b1736b242bd4466def21230