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

Panic in cargo::version #3819

Closed
dtolnay opened this issue Mar 12, 2017 · 6 comments · Fixed by rust-lang/rust#40450
Closed

Panic in cargo::version #3819

dtolnay opened this issue Mar 12, 2017 · 6 comments · Fixed by rust-lang/rust#40450

Comments

@dtolnay
Copy link
Member

dtolnay commented Mar 12, 2017

Using the newest nightly cargo. I can't get the version because --version panics. Rustup installed it along with rustc 1.17.0-nightly (e4eb964dd 2017-03-11).

$ RUST_BACKTRACE=1 cargo --version
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:323
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: cargo::version
             at /checkout/src/libcore/macros.rs:21
             at /checkout/cargo/src/cargo/lib.rs:263
   1: cargo::execute
             at /checkout/cargo/src/bin/cargo.rs:156
   2: cargo::call_main_without_stdin
             at /checkout/cargo/src/cargo/lib.rs:128
   3: cargo::main
             at /checkout/cargo/src/bin/cargo.rs:91
             at /checkout/cargo/src/bin/cargo.rs:84

It affects other commands as well:

$ RUST_BACKTRACE=1 cargo update
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:323
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: cargo::version
             at /checkout/src/libcore/macros.rs:21
             at /checkout/cargo/src/cargo/lib.rs:263
   1: cargo::ops::registry::http_handle
             at /checkout/cargo/src/cargo/ops/registry.rs:227
   2: <cargo::sources::registry::remote::RemoteRegistry<'cfg> as cargo::sources::registry::RegistryData>::update_index
             at /checkout/cargo/src/cargo/sources/registry/remote.rs:63
   3: cargo::sources::registry::RegistrySource::do_update
             at /checkout/cargo/src/cargo/sources/registry/mod.rs:309
   4: <cargo::sources::registry::RegistrySource<'cfg> as cargo::core::source::Source>::update
             at /checkout/cargo/src/cargo/sources/registry/mod.rs:353
   5: cargo::core::registry::PackageRegistry::ensure_loaded
             at /checkout/cargo/src/cargo/core/registry.rs:191
             at /checkout/cargo/src/cargo/util/errors.rs:58
             at /checkout/cargo/src/cargo/core/registry.rs:180
             at /checkout/cargo/src/cargo/core/registry.rs:141
   6: <cargo::core::registry::PackageRegistry<'cfg> as cargo::core::registry::Registry>::query
             at /checkout/cargo/src/cargo/core/registry.rs:339
   7: <&'a mut I as core::iter::iterator::Iterator>::next
             at /checkout/cargo/src/cargo/core/resolver/mod.rs:859
             at /checkout/cargo/src/cargo/core/resolver/mod.rs:832
             at /checkout/src/libcore/ops.rs:2654
             at /checkout/src/libcore/option.rs:383
             at /checkout/src/libcore/iter/mod.rs:999
             at /checkout/src/libcore/result.rs:1087
             at /checkout/src/libcore/iter/iterator.rs:2197
   8: cargo::core::resolver::activate
             at /checkout/src/libcollections/vec.rs:1649
             at /checkout/src/libcollections/vec.rs:1562
             at /checkout/src/libcore/result.rs:1104
             at /checkout/src/libcore/iter/iterator.rs:1221
             at /checkout/cargo/src/cargo/core/resolver/mod.rs:831
             at /checkout/cargo/src/cargo/core/resolver/mod.rs:340
   9: cargo::core::resolver::activate_deps_loop
             at /checkout/cargo/src/cargo/core/resolver/mod.rs:457
  10: cargo::core::resolver::resolve
             at /checkout/cargo/src/cargo/core/resolver/mod.rs:280
  11: cargo::ops::resolve::resolve_with_previous
             at /checkout/cargo/src/cargo/ops/resolve.rs:225
  12: cargo::ops::cargo_generate_lockfile::update_lockfile
             at /checkout/cargo/src/cargo/ops/cargo_generate_lockfile.rs:77
  13: cargo::try_execute_builtin_command
             at /checkout/cargo/src/bin/update.rs:77
             at /checkout/cargo/src/cargo/lib.rs:128
             at /checkout/cargo/src/bin/cargo.rs:259
  14: cargo::execute
             at /checkout/cargo/src/bin/cargo.rs:223
  15: cargo::call_main_without_stdin
             at /checkout/cargo/src/cargo/lib.rs:128
  16: cargo::main
             at /checkout/cargo/src/bin/cargo.rs:91
             at /checkout/cargo/src/bin/cargo.rs:84
japaric pushed a commit to rust-embedded/cortex-m that referenced this issue Mar 12, 2017
@alexcrichton
Copy link
Member

I've started fixing this in #3820, next step is to land the submodule update in rust-lang/rust

japaric pushed a commit to rust-embedded/svd2rust that referenced this issue Mar 12, 2017
@alexcrichton
Copy link
Member

PR against rust-lang/rust: rust-lang/rust#40450

@ruuda
Copy link
Contributor

ruuda commented Mar 12, 2017

This bug has quite some impact, because Travis CI runs cargo --version and cargo build/test --verbose by default, so all builds that use the nightly channel were broken. While #3820 fixes the cause in this case, that is no guarantee that things aren’t going to break in the future. Would it be possible to add a dry-run check to the test suite? Something as simple as the shell script below, which should exit with a 0 exit code, would have caught this, right?

set -e
cargo --version
cargo new foo
cd $_
cargo build --verbose
cargo test --verbose

@alexcrichton
Copy link
Member

@ruuda we in fact have these tests and run them in rust-lang/rust. We just don't run the test suite for the right Cargo, and that's tracked by rust-lang/rust#38531.

Just trying to point out that we're not trying to be negligent here, the interactions are all very tricky.

@alexcrichton
Copy link
Member

(oops didn't mean to close yet)

alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 12, 2017
This commit updates Cargo with rust-lang/cargo#3820 which includes a fix for
rust-lang/cargo#3819. At the same time this also slightly tweaks how rustbuild
builds cargo to ensure that all the build information (including git info and
such) makes its way into the binary.

Closes rust-lang/cargo#3820
bors added a commit to rust-lang/rust that referenced this issue Mar 12, 2017
Update Cargo to fix nightly channel

This commit updates Cargo with rust-lang/cargo#3820 which includes a fix for
rust-lang/cargo#3819. At the same time this also slightly tweaks how rustbuild
builds cargo to ensure that all the build information (including git info and
such) makes its way into the binary.

Closes rust-lang/cargo#3819
@dtolnay
Copy link
Member Author

dtolnay commented Mar 18, 2017

Looks like the same issue is happening again: #3844.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants