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

cargo-outdated panics if an git url with ssh is specified #195

Closed
Marwes opened this issue Jan 30, 2020 · 5 comments
Closed

cargo-outdated panics if an git url with ssh is specified #195

Marwes opened this issue Jan 30, 2020 · 5 comments

Comments

@Marwes
Copy link

Marwes commented Jan 30, 2020

Running cargo outdated on a crate with the following Cargo.toml results in a panic.

[package]
name = "test_ssh"
version = "0.1.0"
authors = ["Markus Westerlind <markus.westerlind@distilnetworks.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
test = { git = "ssh://git@github.com/Marwes/combine" }
markus@:~/C/test_ssh$ env RUST_BACKTRACE=1 cargo outdated
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', src/libcore/result.rs:1165:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1028
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1412
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:188
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:205
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:464
  11: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:373
  12: rust_begin_unwind
             at src/libstd/panicking.rs:302
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:139
  14: core::result::unwrap_failed
             at src/libcore/result.rs:1165
  15: cargo::util::canonical_url::CanonicalUrl::new
  16: cargo::core::source::source_id::SourceId::new
  17: cargo::util::toml::DetailedTomlDependency::to_dependency
  18: cargo::util::toml::TomlManifest::to_real_manifest::process_dependencies
  19: cargo::util::toml::TomlManifest::to_real_manifest
  20: cargo::util::toml::read_manifest
  21: cargo::core::workspace::Packages::load
  22: cargo::core::workspace::Workspace::find_root
  23: cargo::core::workspace::Workspace::new
  24: cargo_outdated::execute
  25: cargo_outdated::main
  26: std::rt::lang_start::{{closure}}
  27: main
  28: __libc_start_main
  29: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@deg4uss3r
Copy link
Collaborator

deg4uss3r commented Jan 30, 2020

Hello @Marwes thanks for reporting this issue! This was resolved in #182 and is the current master branch but was not tagged/released via Crates.io yet (which would be v0.9.3). We are working to get the newest version tagged and released as soon as possible, sorry for the delay on this!

One thing I noticed in the example you provide is the dependency section should be like so:

[dependencies]
combine = { git = "ssh://git@github.com/Marwes/combine" }

If you have test as the dependency name it will not resolve since the crate test won't be found.

Here's an example of the output using the Cargo.toml above:

rthosfelt on mac in ~/code/rust_experiments/foo
[:master]> cargo outdated --version
cargo-outdated v0.9.3

rthosfelt on mac in ~/code/rust_experiments/foo
[:master]> cargo outdated --verbose
  Parsing... current workspace
Resolving... current workspace
    Updating git repository `ssh://git@github.com/Marwes/combine`
    Updating crates.io index
  Parsing... compat workspace
 Updating... compat workspace
    Updating git repository `ssh://git@github.com/Marwes/combine`
    Updating crates.io index
Resolving... compat workspace
  Parsing... latest workspace
    Updating git repository `ssh://git@github.com/Marwes/combine`
 Updating... latest workspace
    Updating git repository `ssh://git@github.com/Marwes/combine`
    Updating crates.io index
Resolving... latest workspace
Resolving... package status
 Printing... list format
All dependencies are up to date, yay!

@Marwes
Copy link
Author

Marwes commented Jan 30, 2020

One thing I noticed in the example you provide is the dependency section should be like so:

It was just a minimal reproduction from a larger file, I just wrote the first repo I could think of in there and it was enough to reproduce :).

It does not appear to be fixed on master. Did cargo install --git https://github.com/kbknapp/cargo-outdated and the same panic still occurs.

@deg4uss3r
Copy link
Collaborator

deg4uss3r commented Jan 30, 2020

Oh, that's really strange this happens if you install it to ~/.cargo/bin versus having it in your $PATH, or linking it in ~/.cargo/bin. I'll look into why this is happening ASAP.

@deg4uss3r
Copy link
Collaborator

FYI, I put in the above work in progress PR to rust-lang/cargo after finding the root cause. Hopefully, this could get rolled out shortly.

kornelski pushed a commit that referenced this issue Feb 5, 2020
\#195  that does not correctly parse ssh urls within the Cargo.toml this
is a fix that can be updated once Cargo v0.43.0 is release via @ehuss
@deg4uss3r
Copy link
Collaborator

We pushed a new lock file to master today (v0.9.5) that will solve this issue.

To resolve while we wait for the workaround in cargo (v0.43) install cargo-outdated with:

cargo install --git https://github.com/kbknapp/cargo-outdated --locked (you might also need the --force switch if it is already installed).

deg4uss3r pushed a commit to deg4uss3r/cargo-outdated that referenced this issue Feb 11, 2020
deg4uss3r added a commit that referenced this issue Feb 11, 2020
Updated install instructions to lock the dependency tree (and make sure users are installing the fix for #195)
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

No branches or pull requests

2 participants