-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Specifying jobs = 0 in .cargo/config hangs cargo forever without output #9219
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Does the issue still persist? If so I would like to give it a try |
I believe it is still an issue. And nobody's working on it that I know of.
Have at it.
…On Wed, Jun 9, 2021, 10:22 PM Henri E. Francois ***@***.***> wrote:
Does the issue still persist? If so I would like to give it a try
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#9219 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4JUQD35TQDXWT27HMTFITTSAOXHANCNFSM4YMX2ZQQ>
.
|
@rustbot claim |
Hey, @Eh2406 could you help me out with this? I have something I think should work, but I am not sure why it isn't making a difference at all. In impl BuildConfig {
/// Parses all config files to learn about build configuration. Currently
/// configured options are:
///
/// * `build.jobs`
/// * `build.target`
/// * `target.$target.ar`
/// * `target.$target.linker`
/// * `target.$target.libfoo.metadata`
pub fn new(
config: &Config,
jobs: Option<u32>,
requested_targets: &[String],
mode: CompileMode,
) -> CargoResult<BuildConfig> {
let cfg = config.build_config()?;
let requested_kinds = CompileKind::from_requested_targets(config, requested_targets)?;
if jobs == Some(0) {
anyhow::bail!("jobs must be at least 1")
}
if jobs.is_some() && config.jobserver_from_env().is_some() {
config.shell().warn(
"a `-j` argument was passed to Cargo but Cargo is \
also configured with an external jobserver in \
its environment, ignoring the `-j` parameter",
)?;
}
let jobs = match jobs.or(cfg.jobs) {
None => ::num_cpus::get() as u32,
Some(j) if j != 0 => (::num_cpus::get() as u32).max(j),
Some(_) => anyhow::bail!("jobs may not be 0"),
}; //.unwrap_or(::num_cpus::get() as u32); which I assumed would be enough to handle the case where the jobs argument has a value of 0. Any pointers? |
That is what I would have expected to work. And when I am careful to run the Cargo I just build and not the cargo from rustup, it worked for me! |
Oop, nevermind. I think I got it working. |
Handle "jobs = 0" case in cargo config files Cargo hangs without output if the jobs argument under build in a cargo/config file is set to 0. This PR handles this case by providing an appropriate error. Closes #9219
If you specify
jobs = 0
in.cargo/config
, yourcargo build
invocations will hang forever without output. Note that if you try to invokecargo build -j 0
it will warn you:Steps
Place a
.cargo/config
in any valid location with the following content:Run
cargo build
.You will never reach step 3.
Possible Solution(s)
Check for
jobs
being 0 when reading the config file.Notes
Output of
cargo version
: latestmaster
commit, 0b2059e.The text was updated successfully, but these errors were encountered: