Skip to content

False positive error when try to download crate and .cargo-ok for it already exists #11762

@Mingun

Description

@Mingun

Problem

During some operations, for example, running cargo minimal-versions cargo tried to create(?) a .cargo-ok file which is already exist (which I think means that the corresponding crate is already downloaded). That attempt failed with an error but after removing the file and repeating command everything work as expected.

Steps

I tried to reproduce tafia/quick-xml#562 report. During that I did the following:

  1. install necessary tools
    cargo install cargo-minimal-versions
    cargo install cargo-hack
  2. prepare working copy on tafia/quick-xml@779de32
  3. apply patch:
     Cargo.toml | 8 ++++----
     1 file changed, 4 insertions(+), 4 deletions(-)
    
    diff --git a/Cargo.toml b/Cargo.toml
    index 212fc6a7..be89cd95 100644
    --- a/Cargo.toml
    +++ b/Cargo.toml
    @@ -17,7 +17,7 @@ include = ["src/*", "LICENSE-MIT.md", "README.md"]
     document-features = { version = "0.2", optional = true }
     encoding_rs = { version = "0.8", optional = true }
     serde = { version = "1.0.100", optional = true }
    -tokio = { version = "1.0", optional = true, default-features = false, features = ["io-util"] }
    +# tokio = { version = "1.0", optional = true, default-features = false, features = ["io-util"] }
     memchr = "2.0"
     arbitrary = { version = "1.2.3", features = ["derive"], optional = true }
    
    @@ -27,8 +27,8 @@ pretty_assertions = "1.3"
     regex = "1"
     serde = { version = "1.0", features = ["derive"] }
     serde-value = "0.7"
    -tokio = { version = "1.21", default-features = false, features = ["macros", "rt"] }
    -tokio-test = "0.4"
    +# tokio = { version = "1.21", default-features = false, features = ["macros", "rt"] }
    +# tokio-test = "0.4"
    
     [lib]
     bench = false
    @@ -50,7 +50,7 @@ default = []
     ## [reading events] from types implementing [`tokio::io::AsyncBufRead`].
     ##
     ## [reading events]: crate::reader::Reader::read_event_into_async
    -async-tokio = ["tokio"]
    +# async-tokio = ["tokio"]
    
     ## Enables support of non-UTF-8 encoded documents. Encoding will be inferred from
     ## the XML declaration if it will be found, otherwise UTF-8 is assumed.
  4. run cargo minimal-versions check
    PS D:\Projects\quick-xml> cargo minimal-versions check
    info: running `cargo update -Z minimal-versions`
        Updating crates.io index
        Removing aho-corasick v0.7.20
        Removing anes v0.1.6
        Removing atty v0.2.14
        Removing autocfg v1.1.0
        Removing bitflags v1.3.2
        Removing bumpalo v3.11.1
        Removing cast v0.3.0
        Updating cfg-if v1.0.0 -> v0.1.0
        Removing ciborium v0.2.0
        Removing ciborium-io v0.2.0
        Removing ciborium-ll v0.2.0
        Removing clap v3.2.23
        Removing clap_lex v0.2.4
        Removing criterion v0.4.0
        Removing criterion-plot v0.5.0
        Removing crossbeam-channel v0.5.6
        Removing crossbeam-deque v0.8.2
        Removing crossbeam-epoch v0.9.13
        Removing crossbeam-utils v0.8.14
        Removing ctor v0.1.26
        Removing diff v0.1.13
        Updating document-features v0.2.7 -> v0.2.0
        Removing either v1.8.0
        Updating encoding_rs v0.8.31 -> v0.8.0
        Removing half v1.8.2
        Removing hashbrown v0.12.3
        Removing hermit-abi v0.1.19
        Removing hermit-abi v0.2.6
        Removing indexmap v1.9.2
        Removing itertools v0.10.5
        Removing itoa v1.0.5
        Removing js-sys v0.3.60
        Removing lazy_static v1.4.0
        Updating libc v0.2.138 -> v0.2.18
        Removing litrs v0.2.3
        Removing log v0.4.17
        Updating memchr v2.5.0 -> v2.0.0
        Removing memoffset v0.7.1
        Removing num-traits v0.2.15
        Removing num_cpus v1.15.0
        Removing once_cell v1.16.0
        Removing oorandom v11.1.3
        Removing ordered-float v2.10.0
        Removing os_str_bytes v6.4.1
        Removing output_vt100 v0.1.3
        Removing plotters v0.3.4
        Removing plotters-backend v0.3.4
        Removing plotters-svg v0.3.3
        Removing pretty_assertions v1.3.0
        Updating proc-macro2 v1.0.49 -> v1.0.0
        Removing quote v1.0.23
          Adding quote v0.3.8
          Adding quote v1.0.0
        Removing rayon v1.6.1
        Removing rayon-core v1.10.1
        Removing regex v1.7.0
        Removing regex-syntax v0.6.28
        Removing ryu v1.0.12
        Removing same-file v1.0.6
        Removing scopeguard v1.1.0
        Updating serde v1.0.151 -> v1.0.100
        Removing serde-value v0.7.0
        Updating serde_derive v1.0.151 -> v1.0.0
          Adding serde_derive_internals v0.15.0
        Removing serde_json v1.0.91
        Removing syn v1.0.107
          Adding syn v0.11.10
          Adding syn v1.0.0
          Adding synom v0.11.0
        Removing textwrap v0.16.0
        Removing tinytemplate v1.2.1
        Removing unicode-ident v1.0.6
          Adding unicode-xid v0.0.4
          Adding unicode-xid v0.2.0
        Removing walkdir v2.3.2
        Removing wasm-bindgen v0.2.83
        Removing wasm-bindgen-backend v0.2.83
        Removing wasm-bindgen-macro v0.2.83
        Removing wasm-bindgen-macro-support v0.2.83
        Removing wasm-bindgen-shared v0.2.83
        Removing web-sys v0.3.60
        Removing winapi v0.3.9
        Removing winapi-i686-pc-windows-gnu v0.4.0
        Removing winapi-util v0.1.5
        Removing winapi-x86_64-pc-windows-gnu v0.4.0
        Removing yansi v0.5.1
    info: running `cargo hack check`
    error: process didn't exit successfully: `\\?\D:\Users\mingun\.rustup\toolchains\nightly-x86_64-pc-windows-gnu\bin\cargo.exe metadata --format-version=1` (exit code: 101)
    --- stderr
    error: failed to download `libc v0.2.18`
    
    Caused by:
      unable to get packages from source
    
    Caused by:
      failed to unpack package `libc v0.2.18`
    
    Caused by:
      failed to open `D:\Users\mingun\.cargo\registry\src\github.com-1ecc6299db9ec823\libc-0.2.18\.cargo-ok`
    
    Caused by:
      Файл существует. (os error 80)
    
    error: process didn't exit successfully: `\\?\D:\Users\mingun\.rustup\toolchains\nightly-x86_64-pc-windows-gnu\bin\cargo.exe hack check` (exit code: 1)
    PS D:\Projects\quick-xml>

As you see, the process is failed due to existing file during attempt to download a crate. When I removed the mentioned file and repeat command, the check was performed successfully.

> cargo hack --version
cargo-hack 0.5.27

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.69.0-nightly (3c5af6bed 2023-01-24)
release: 1.69.0-nightly
commit-hash: 3c5af6bed9a1a243a693e8e22ee2486bd5b82a6c
commit-date: 2023-01-24
host: x86_64-pc-windows-gnu
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.86.0-DEV (sys:0.4.59+curl-7.86.0 vendored ssl:Schannel)
os: Windows 6.1.7601 (Windows 7 Professional) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions