-
Notifications
You must be signed in to change notification settings - Fork 30
Fix target-specific feature flags for rustix dependency #96
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
base: master
Are you sure you want to change the base?
Conversation
The "rustix::process" module is only imported for `cfg(target_os = "linux")`, but the "process" feature of rustix was only enabled if the target_os was *not* "linux".
I thought that separating Linux from the others here was actually useless (#94 (comment)), but is there a case where this is not the case? |
Yes, it makes a difference if you update to async-process 2.3.1 without also updating to async-signal 0.2.11 (for whatever reason). So either this change or bumping the async-signal dependency to 0.2.11 seems to be necessary here (but the logic in Cargo.toml is still wrong, and should reflect actual code usage IMO) :) |
Does that mean that it will not just compile with the (For example, the reason #94 was initially failing was actually a bug in dependabot that could not properly update dependencies specified in this way (as well as those specified in this PR's way, AFAIK).)
Personally I prefer to always enable the This is because even if we use |
zbus updating to 2.3.1 fails to build with: error[E0432]: unresolved import `rustix::process`
--> /home/zeenix/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-process-2.3.1/src/reaper/wait.rs:137:13
|
137 | use rustix::process;
| ^^^^^^^^^^^^^^^ no `process` in the root
|
note: found an item that was configured out
--> /home/zeenix/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-1.0.7/src/lib.rs:268:9
|
268 | pub mod process;
| ^^^^^^^
note: the item is gated behind the `process` feature
--> /home/zeenix/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-1.0.7/src/lib.rs:266:7
|
266 | #[cfg(feature = "process")]
| ^^^^^^^^^^^^^^^^^^^
help: consider importing one of these modules instead
|
137 - use rustix::process;
137 + use std::os::linux::process;
|
137 - use rustix::process;
137 + use std::os::unix::process;
|
137 - use rustix::process;
137 + use std::process;
|
For more information about this error, try `rustc --explain E0432`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM actually.
but will not merge until @taiki-e is satisfied too. :) |
Thanks for the info! I missed the fact that this was a problem that was already happening today, but this seems to be exactly the problem I mentioned in #96 (comment):
I think the robust solution here is to always enable the feature that the dependency enables ( (I don't see the need to retain the current approach that doing complex things with hard-to-detect-bug way in order to optimize compile time for the case of there are multiple dependency versions.) |
Unconditionally depending on "rustix/process" if |
True. Sorry, I was a bit distracted earlier. You're right. |
The "rustix::process" module is only imported for
cfg(target_os = "linux")
in Rust code, but the "process" feature of rustix was only enabled if the target_os was not "linux", so the logic in Cargo.toml was reversed from what is actually needed.This PR changes the target-specific dependency for rustix to only enable the "process" feature if the
target_os
is "linux", but not otherwise, which seems to have been the intended configuration all along.