databricks / click

The "Command Line Interactive Controller for Kubernetes"
Apache License 2.0
1.49k stars 84 forks source link

Two versions of duct crate in use #71

Closed ashb closed 5 years ago

ashb commented 6 years ago

Awesome looking project btw!

From a completely fresh install of rust (brew install rust) I have a compile error after running cargo install click:

error[E0308]: mismatched types
  --> src/output.rs:93:19
   |
93 |             expr: handle,
   |                   ^^^^^^ expected struct `duct::Handle`, found a different struct `duct::Handle`
   |
   = note: expected type `duct::Handle` (struct `duct::Handle`)
              found type `duct::Handle` (struct `duct::Handle`)
note: Perhaps two different versions of crate `duct` are being used?

And looking a bit further up the output I see:

   Compiling duct v0.11.0
   Compiling duct v0.10.0
   Compiling crossbeam-deque v0.2.0
   Compiling url v1.7.1
   Compiling duct_sh v0.1.0
...
   Compiling click v0.3.2

I don't know enough about rust to attempt a fix myself, sorry

bazhenov commented 6 years ago

I have the same issue.

xiaozhon commented 6 years ago

Same issue on my machine. Have you guys found the solution?

bazhenov commented 6 years ago

At the moment I compile click from sources.

cargo build --release

There is no such problem, at least at revision: a9aba2e2151fc996f552ba2b22b443b8400bea1d

xiaozhon commented 6 years ago

Awesome! The cargo build --release worked for me

nicklan commented 6 years ago

To anyone who can reproduce this (I only build on Linux, so can't), can you install cargo tree, run it in the click dir, and paste the output here?

That will tell me what's causing the double import and I can sort it out.

Thanks!

bazhenov commented 6 years ago

Ironically while installing cargo tree multiple versions of rand_core and sys were compiled and installed. 😄

Anyhow, here is the output on current master (c8409f93f78fd862109708e06b619e064c4c689b):

click v0.3.2 (file:///Users/bazhenov/Developer/click)
├── ansi_term v0.9.0
├── base64 v0.5.2
│   └── byteorder v1.2.2
├── chrono v0.4.1
│   ├── num-integer v0.1.36
│   │   └── num-traits v0.2.2
│   ├── num-traits v0.2.2 (*)
│   ├── serde v1.0.37
│   └── time v0.1.39
│       └── libc v0.2.40
│       [dev-dependencies]
│       └── winapi v0.3.4
├── clap v2.31.2
│   ├── ansi_term v0.11.0
│   ├── atty v0.2.8
│   │   └── libc v0.2.40 (*)
│   ├── bitflags v1.0.1
│   ├── strsim v0.7.0
│   ├── textwrap v0.9.0
│   │   └── unicode-width v0.1.4
│   ├── unicode-width v0.1.4 (*)
│   └── vec_map v0.8.0
├── ctrlc v3.1.0
│   └── nix v0.9.0
│       ├── bitflags v0.9.1
│       ├── cfg-if v0.1.2
│       ├── libc v0.2.40 (*)
│       └── void v1.0.2
├── der-parser v0.3.5
│   ├── nom v2.2.1
│   └── rusticata-macros v0.3.3
│       └── nom v3.2.1
│           └── memchr v1.0.2
│               └── libc v0.2.40 (*)
├── duct v0.10.0
│   ├── lazycell v0.6.0
│   ├── libc v0.2.40 (*)
│   ├── os_pipe v0.6.0
│   │   └── nix v0.9.0 (*)
│   └── shared_child v0.3.2
│       ├── kernel32-sys v0.2.2
│       │   └── winapi v0.2.8
│       │   [build-dependencies]
│       │   └── winapi-build v0.1.1
│       ├── libc v0.2.40 (*)
│       └── winapi v0.2.8 (*)
├── duct_sh v0.1.0
│   └── duct v0.10.0 (*)
├── humantime v1.1.1
│   └── quick-error v1.2.1
├── hyper v0.10.13
│   ├── base64 v0.6.0
│   │   ├── byteorder v1.2.2 (*)
│   │   └── safemem v0.2.0
│   ├── httparse v1.2.4
│   ├── language-tags v0.2.2
│   ├── log v0.3.9
│   │   └── log v0.4.1
│   │       └── cfg-if v0.1.2 (*)
│   ├── mime v0.2.6
│   │   └── log v0.3.9 (*)
│   ├── num_cpus v1.8.0
│   │   └── libc v0.2.40 (*)
│   ├── time v0.1.39 (*)
│   ├── traitobject v0.1.0
│   ├── typeable v0.1.2
│   ├── unicase v1.4.2
│   │   [build-dependencies]
│   │   └── version_check v0.1.3
│   └── url v1.7.0
│       ├── idna v0.1.4
│       │   ├── matches v0.1.6
│       │   ├── unicode-bidi v0.3.4
│       │   │   └── matches v0.1.6 (*)
│       │   └── unicode-normalization v0.1.5
│       ├── matches v0.1.6 (*)
│       └── percent-encoding v1.0.1
├── hyper-rustls v0.6.0
│   ├── hyper v0.10.13 (*)
│   ├── rustls v0.8.0
│   │   ├── base64 v0.5.2 (*)
│   │   ├── log v0.3.9 (*)
│   │   ├── ring v0.9.7
│   │   │   ├── libc v0.2.40 (*)
│   │   │   └── untrusted v0.5.1
│   │   │   [build-dependencies]
│   │   │   ├── gcc v0.3.54
│   │   │   └── rayon v0.7.1
│   │   │       └── rayon-core v1.4.0
│   │   │           ├── crossbeam-deque v0.2.0
│   │   │           │   ├── crossbeam-epoch v0.3.1
│   │   │           │   │   ├── arrayvec v0.4.7
│   │   │           │   │   │   └── nodrop v0.1.12
│   │   │           │   │   ├── cfg-if v0.1.2 (*)
│   │   │           │   │   ├── crossbeam-utils v0.2.2
│   │   │           │   │   │   └── cfg-if v0.1.2 (*)
│   │   │           │   │   ├── lazy_static v1.0.0
│   │   │           │   │   ├── memoffset v0.2.1
│   │   │           │   │   ├── nodrop v0.1.12 (*)
│   │   │           │   │   └── scopeguard v0.3.3
│   │   │           │   └── crossbeam-utils v0.2.2 (*)
│   │   │           ├── lazy_static v1.0.0 (*)
│   │   │           ├── libc v0.2.40 (*)
│   │   │           ├── num_cpus v1.8.0 (*)
│   │   │           └── rand v0.4.2
│   │   │               └── libc v0.2.40 (*)
│   │   ├── time v0.1.39 (*)
│   │   ├── untrusted v0.5.1 (*)
│   │   └── webpki v0.12.1
│   │       ├── ring v0.9.7 (*)
│   │       ├── time v0.1.39 (*)
│   │       └── untrusted v0.5.1 (*)
│   │   [dev-dependencies]
│   │   └── log v0.3.9 (*)
│   └── webpki-roots v0.10.0
│       ├── untrusted v0.5.1 (*)
│       └── webpki v0.12.1 (*)
├── lazy_static v0.2.11
├── os_pipe v0.5.1
│   └── nix v0.8.1
│       ├── bitflags v0.7.0
│       ├── cfg-if v0.1.2 (*)
│       ├── libc v0.2.40 (*)
│       └── void v1.0.2 (*)
├── prettytable-rs v0.6.7
│   ├── atty v0.2.8 (*)
│   ├── csv v0.15.0
│   │   ├── byteorder v1.2.2 (*)
│   │   ├── memchr v1.0.2 (*)
│   │   └── rustc-serialize v0.3.24
│   ├── encode_unicode v0.3.1
│   ├── lazy_static v0.2.11 (*)
│   ├── term v0.4.6
│   └── unicode-width v0.1.4 (*)
├── regex v0.2.10
│   ├── aho-corasick v0.6.4
│   │   └── memchr v2.0.1
│   │       └── libc v0.2.40 (*)
│   ├── memchr v2.0.1 (*)
│   ├── regex-syntax v0.5.3
│   │   └── ucd-util v0.1.1
│   ├── thread_local v0.3.5
│   │   ├── lazy_static v1.0.0 (*)
│   │   └── unreachable v1.0.0
│   │       └── void v1.0.2 (*)
│   └── utf8-ranges v1.0.0
├── ring v0.9.7 (*)
├── rustls v0.8.0 (*)
├── rustyline v1.0.0
│   ├── encode_unicode v0.1.3
│   ├── libc v0.2.40 (*)
│   ├── nix v0.5.1
│   │   ├── bitflags v0.4.0
│   │   └── libc v0.2.40 (*)
│   └── unicode-width v0.1.4 (*)
├── serde v1.0.37 (*)
├── serde_derive v1.0.37
│   ├── proc-macro2 v0.3.1
│   │   └── unicode-xid v0.1.0
│   ├── quote v0.5.1
│   │   └── proc-macro2 v0.3.1 (*)
│   ├── serde_derive_internals v0.23.0
│   │   ├── proc-macro2 v0.3.1 (*)
│   │   └── syn v0.13.1
│   │       ├── proc-macro2 v0.3.1 (*)
│   │       ├── quote v0.5.1 (*)
│   │       └── unicode-xid v0.1.0 (*)
│   └── syn v0.13.1 (*)
├── serde_json v1.0.13
│   ├── dtoa v0.4.2
│   ├── itoa v0.4.1
│   ├── num-traits v0.2.2 (*)
│   └── serde v1.0.37 (*)
├── serde_yaml v0.7.3
│   ├── linked-hash-map v0.5.1
│   ├── num-traits v0.1.43
│   │   └── num-traits v0.2.2 (*)
│   ├── serde v1.0.37 (*)
│   └── yaml-rust v0.4.0
│       └── linked-hash-map v0.5.1 (*)
├── tempdir v0.3.7
│   ├── rand v0.4.2 (*)
│   └── remove_dir_all v0.5.0
├── term v0.4.6 (*)
└── untrusted v0.5.1 (*)

For some reason there is no declaration of duct v0.11.0, only v0.10.0.

But if I build tree on crate from crates.io I get different result:

$ ll ~/.cargo/registry/cache/github.com-*/click-0.3.2.crate
-rw-r--r-- 1 bazhenov staff 49455 Aug 24 11:18 /Users/bazhenov/.cargo/registry/cache/github.com-1ecc6299db9ec823/click-0.3.2.crate

$ tar xf ~/.cargo/registry/cache/github.com-*/click-0.3.2.crate
$ cd click-0.3.2
$ cargo tree
click v0.3.2 (file:///Users/bazhenov/Desktop/click-0.3.2)
├── ansi_term v0.9.0
├── base64 v0.5.2
│   └── byteorder v1.2.6
├── chrono v0.4.6
│   ├── num-integer v0.1.39
│   │   └── num-traits v0.2.6
│   ├── num-traits v0.2.6 (*)
│   ├── serde v1.0.80
│   └── time v0.1.40
│       └── libc v0.2.43
│       [dev-dependencies]
│       └── winapi v0.3.6
├── clap v2.32.0
│   ├── ansi_term v0.11.0
│   ├── atty v0.2.11
│   │   └── libc v0.2.43 (*)
│   ├── bitflags v1.0.4
│   ├── strsim v0.7.0
│   ├── textwrap v0.10.0
│   │   └── unicode-width v0.1.5
│   ├── unicode-width v0.1.5 (*)
│   └── vec_map v0.8.1
├── ctrlc v3.1.1
│   └── nix v0.11.0
│       ├── bitflags v1.0.4 (*)
│       ├── cfg-if v0.1.5
│       ├── libc v0.2.43 (*)
│       └── void v1.0.2
├── der-parser v0.3.5
│   ├── nom v2.2.1
│   └── rusticata-macros v0.3.3
│       └── nom v3.2.1
│           └── memchr v1.0.2
│               └── libc v0.2.43 (*)
├── duct v0.10.0
│   ├── lazycell v0.6.0
│   ├── libc v0.2.43 (*)
│   ├── os_pipe v0.6.2
│   │   └── nix v0.11.0 (*)
│   └── shared_child v0.3.3
│       ├── libc v0.2.43 (*)
│       └── winapi v0.3.6 (*)
├── duct_sh v0.1.0
│   └── duct v0.11.1
│       ├── lazycell v1.2.0
│       ├── libc v0.2.43 (*)
│       ├── os_pipe v0.7.0
│       │   └── nix v0.11.0 (*)
│       └── shared_child v0.3.3 (*)
├── humantime v1.1.1
│   └── quick-error v1.2.2
├── hyper v0.10.13
│   ├── base64 v0.6.0
│   │   ├── byteorder v1.2.6 (*)
│   │   └── safemem v0.2.0
│   ├── httparse v1.3.3
│   ├── language-tags v0.2.2
│   ├── log v0.3.9
│   │   └── log v0.4.5
│   │       └── cfg-if v0.1.5 (*)
│   ├── mime v0.2.6
│   │   └── log v0.3.9 (*)
│   ├── num_cpus v1.8.0
│   │   └── libc v0.2.43 (*)
│   ├── time v0.1.40 (*)
│   ├── traitobject v0.1.0
│   ├── typeable v0.1.2
│   ├── unicase v1.4.2
│   │   [build-dependencies]
│   │   └── version_check v0.1.5
│   └── url v1.7.1
│       ├── idna v0.1.5
│       │   ├── matches v0.1.8
│       │   ├── unicode-bidi v0.3.4
│       │   │   └── matches v0.1.8 (*)
│       │   └── unicode-normalization v0.1.7
│       ├── matches v0.1.8 (*)
│       └── percent-encoding v1.0.1
├── hyper-rustls v0.6.0
│   ├── hyper v0.10.13 (*)
│   ├── rustls v0.8.0
│   │   ├── base64 v0.5.2 (*)
│   │   ├── log v0.3.9 (*)
│   │   ├── ring v0.9.7
│   │   │   ├── libc v0.2.43 (*)
│   │   │   └── untrusted v0.5.1
│   │   │   [build-dependencies]
│   │   │   ├── gcc v0.3.55
│   │   │   └── rayon v0.7.1
│   │   │       └── rayon-core v1.4.1
│   │   │           ├── crossbeam-deque v0.2.0
│   │   │           │   ├── crossbeam-epoch v0.3.1
│   │   │           │   │   ├── arrayvec v0.4.7
│   │   │           │   │   │   └── nodrop v0.1.12
│   │   │           │   │   ├── cfg-if v0.1.5 (*)
│   │   │           │   │   ├── crossbeam-utils v0.2.2
│   │   │           │   │   │   └── cfg-if v0.1.5 (*)
│   │   │           │   │   ├── lazy_static v1.1.0
│   │   │           │   │   │   [build-dependencies]
│   │   │           │   │   │   └── version_check v0.1.5 (*)
│   │   │           │   │   ├── memoffset v0.2.1
│   │   │           │   │   ├── nodrop v0.1.12 (*)
│   │   │           │   │   └── scopeguard v0.3.3
│   │   │           │   └── crossbeam-utils v0.2.2 (*)
│   │   │           ├── lazy_static v1.1.0 (*)
│   │   │           ├── libc v0.2.43 (*)
│   │   │           └── num_cpus v1.8.0 (*)
│   │   ├── time v0.1.40 (*)
│   │   ├── untrusted v0.5.1 (*)
│   │   └── webpki v0.12.1
│   │       ├── ring v0.9.7 (*)
│   │       ├── time v0.1.40 (*)
│   │       └── untrusted v0.5.1 (*)
│   │   [dev-dependencies]
│   │   └── log v0.3.9 (*)
│   └── webpki-roots v0.10.0
│       ├── untrusted v0.5.1 (*)
│       └── webpki v0.12.1 (*)
├── lazy_static v0.2.11
├── os_pipe v0.5.1
│   └── nix v0.8.1
│       ├── bitflags v0.7.0
│       ├── cfg-if v0.1.5 (*)
│       ├── libc v0.2.43 (*)
│       └── void v1.0.2 (*)
├── prettytable-rs v0.6.7
│   ├── atty v0.2.11 (*)
│   ├── csv v0.15.0
│   │   ├── byteorder v1.2.6 (*)
│   │   ├── memchr v1.0.2 (*)
│   │   └── rustc-serialize v0.3.24
│   ├── encode_unicode v0.3.3
│   ├── lazy_static v0.2.11 (*)
│   ├── term v0.4.6
│   └── unicode-width v0.1.5 (*)
├── regex v0.2.11
│   ├── aho-corasick v0.6.8
│   │   └── memchr v2.1.0
│   │       ├── cfg-if v0.1.5 (*)
│   │       └── libc v0.2.43 (*)
│   │       [build-dependencies]
│   │       └── version_check v0.1.5 (*)
│   ├── memchr v2.1.0 (*)
│   ├── regex-syntax v0.5.6
│   │   └── ucd-util v0.1.1
│   ├── thread_local v0.3.6
│   │   └── lazy_static v1.1.0 (*)
│   └── utf8-ranges v1.0.1
├── ring v0.9.7 (*)
├── rustls v0.8.0 (*)
├── rustyline v1.0.0
│   ├── encode_unicode v0.1.3
│   ├── libc v0.2.43 (*)
│   ├── nix v0.5.1
│   │   ├── bitflags v0.4.0
│   │   └── libc v0.2.43 (*)
│   └── unicode-width v0.1.5 (*)
├── serde v1.0.80 (*)
├── serde_derive v1.0.80
│   ├── proc-macro2 v0.4.20
│   │   └── unicode-xid v0.1.0
│   ├── quote v0.6.8
│   │   └── proc-macro2 v0.4.20 (*)
│   └── syn v0.15.12
│       ├── proc-macro2 v0.4.20 (*)
│       ├── quote v0.6.8 (*)
│       └── unicode-xid v0.1.0 (*)
├── serde_json v1.0.32
│   ├── itoa v0.4.3
│   ├── ryu v0.2.6
│   └── serde v1.0.80 (*)
├── serde_yaml v0.7.5
│   ├── dtoa v0.4.3
│   ├── linked-hash-map v0.5.1
│   ├── serde v1.0.80 (*)
│   └── yaml-rust v0.4.2
│       └── linked-hash-map v0.5.1 (*)
├── tempdir v0.3.7
│   ├── rand v0.4.3
│   │   └── libc v0.2.43 (*)
│   └── remove_dir_all v0.5.1
├── term v0.4.6 (*)
└── untrusted v0.5.1 (*)

Notice how duct_sh requires duct v0.11.0 here, even though version of duct_sh is the same as in master.

nicklan commented 6 years ago

That is very odd. It might be to do with the Cargo.lock file, which I don't fully understand. I'll try and investigate further. Thanks for the info!

bazhenov commented 6 years ago

Yep, seems like it's somewhat Cargo.lock related. At least when I rebuild Cargo.lock on master the problem start manifesting itself:

$ rm Cargo.lock
$ cargo update
$ cargo build
error[E0308]: mismatched types
  --> src/output.rs:93:19
   |
93 |             expr: handle,
   |                   ^^^^^^ expected struct `duct::Handle`, found a different struct `duct::Handle`
   |
   = note: expected type `duct::Handle` (struct `duct::Handle`)
              found type `duct::Handle` (struct `duct::Handle`)
note: Perhaps two different versions of crate `duct` are being used?
  --> src/output.rs:93:19
   |
93 |             expr: handle,
   |                   ^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
error: Could not compile `click`.
nicklan commented 6 years ago

Ahh. So I think what Cargo.lock does is say that it should try and use the "locked" versions of things if the dependencies say they can tolerate that. Without it, it'll just try and use the newest versions of things. And for some reason crates.io packages don't use a lock file.

Anyway, I think the fix is that I should update the version of duct we use, which I'll try and get to in the near future.

Thanks!

nicklan commented 5 years ago

I believe this is fixed by #85.

If anyone is still seeing this please lmk. I'll close in a few days if I don't hear back.

nicklan commented 5 years ago

Closing as no one seems to still be hitting this

asychev commented 5 years ago

Problem still present in 0.4.0:


error[E0308]: mismatched types
  --> /Users/asychev/.cargo/registry/src/github.com-1ecc6299db9ec823/click-0.4.0/src/output.rs:94:19
   |
94 |             expr: handle,
   |                   ^^^^^^ expected struct `duct::Handle`, found a different struct `duct::Handle`
   |
   = note: expected type `duct::Handle` (struct `duct::Handle`)
              found type `duct::Handle` (struct `duct::Handle`)
note: Perhaps two different versions of crate `duct` are being used?
  --> /Users/asychev/.cargo/registry/src/github.com-1ecc6299db9ec823/click-0.4.0/src/output.rs:94:19
   |
94 |             expr: handle,
   |                   ^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
error: failed to compile `click v0.4.0`, intermediate artifacts can be found at `/var/folders/zz/_0st98_s39s1pshjq8k_z0f80000gn/T/cargo-installPZuvow`

Caused by:
  Could not compile `click`.```
tleyden commented 5 years ago

I'm seeing the same issue.

Steps to repro:

$ curl https://sh.rustup.rs -sSf | sh
$ source $HOME/.cargo/env
$ cargo install click

Error:

   Compiling click v0.4.0
error[E0308]: mismatched types
  --> /Users/traun.leyden/.cargo/registry/src/github.com-1ecc6299db9ec823/click-0.4.0/src/output.rs:94:19
   |
94 |             expr: handle,
   |                   ^^^^^^ expected struct `duct::Handle`, found a different struct `duct::Handle`
   |
   = note: expected type `duct::Handle` (struct `duct::Handle`)
              found type `duct::Handle` (struct `duct::Handle`)
note: Perhaps two different versions of crate `duct` are being used?
  --> /Users/traun.leyden/.cargo/registry/src/github.com-1ecc6299db9ec823/click-0.4.0/src/output.rs:94:19
   |
94 |             expr: handle,
   |                   ^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
error: failed to compile `click v0.4.0`, intermediate artifacts can be found at `/var/folders/t7/5hp9xrn5179d8c89z_6rqkdm0000gp/T/cargo-installGAs80i`

Caused by:
  Could not compile `click`.

To learn more, run the command again with --verbose.

Environment:

tleyden commented 5 years ago

In the full output I do see duct mentioned a few times:

   Compiling duct v0.11.1
   Compiling atomicwrites v0.2.2
   Compiling duct v0.12.0
philipbjorge commented 5 years ago

So I ran into the same error with cargo install click. But then I cloned 2ca137e770926dec4a766af5e3ccfba3a68dc80d and ran cargo build --release and it worked...

kollender commented 5 years ago

I get:

error[E0308]: mismatched types
  --> /Users/MYUSER/.cargo/registry/src/github.com-1ecc6299db9ec823/click-0.4.0/src/output.rs:94:19
   |
94 |             expr: handle,
   |                   ^^^^^^ expected struct `duct::Handle`, found a different struct `duct::Handle`
   |
   = note: expected type `duct::Handle` (struct `duct::Handle`)
              found type `duct::Handle` (struct `duct::Handle`)
note: Perhaps two different versions of crate `duct` are being used?
  --> /Users/MYUSER/.cargo/registry/src/github.com-1ecc6299db9ec823/click-0.4.0/src/output.rs:94:19
   |
94 |             expr: handle,
   |                   ^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
error: failed to compile `click v0.4.0`, intermediate artifacts can be found at `/var/folders/dq/p0twrj896934dx83mwkszrnspyr3bl/T/cargo-installlTy0uu`

Caused by:
  Could not compile `click`.
tleyden commented 5 years ago

Workaround on osx: https://github.com/databricks/click/pull/105

nicklan commented 5 years ago

If you check out latest master things should work. Afaict, this is an issue with how duct and duct_sh interact. I'm going to investigate what I can do to prevent this happening in the future, as I anticipate it will happen every time duct updates

martin-g commented 5 years ago

I just faced this issue. OS: Ubuntu 18.10

$ curl https://sh.rustup.rs -sSf | sh
$ source $HOME/.cargo/env
$ cargo install click

Should the recent bug fix help for cargo install click or it will help once a new release is cut ?

tleyden commented 5 years ago

@martin-g only when a new release is cut. Can you git clone this repo and then run cargo build? There should be detailed instructions to build from source on the readme.

sco11morgan commented 5 years ago

@nicklan can you cut a new release with the duct fix?

https://crates.io/crates/click

nicklan commented 5 years ago

@sco11morgan Yes, done. Sorry for the delay!

martin-g commented 5 years ago

Thank you, @nicklan ! The build is fine now!