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

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

Closed
Mingun opened this issue Feb 24, 2023 · 6 comments
Labels
C-bug Category: bug

Comments

@Mingun
Copy link

Mingun commented Feb 24, 2023

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]
@Mingun Mingun added the C-bug Category: bug label Feb 24, 2023
@ehuss
Copy link
Contributor

ehuss commented Feb 24, 2023

Can you try the latest nightly? This should be fixed via #11665.

@Mingun
Copy link
Author

Mingun commented Feb 24, 2023

Yes, this is fixed in

> cargo version --verbose
cargo 1.69.0-nightly (9d5b32f50 2023-02-22)
release: 1.69.0-nightly
commit-hash: 9d5b32f503fc099c4064298465add14d4bce11e6
commit-date: 2023-02-22
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]

Now the .cargo-ok is filled with ok string as it should.

@Mingun
Copy link
Author

Mingun commented Feb 26, 2023

I ran into the same problem in another machine. Fresh nightly suffers from this error too:

> C:\Users\Mingun\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\cargo.exe version --verbose
cargo 1.69.0-nightly (9d5b32f50 2023-02-22)
release: 1.69.0-nightly
commit-hash: 9d5b32f503fc099c4064298465add14d4bce11e6
commit-date: 2023-02-22
host: x86_64-pc-windows-msvc
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 10.0.22621 (Windows 10 Home Single Language) [64-bit]
PS D:\Projects\quick-xml> cargo +nightly minimal-versions test --features serialize
info: running `cargo update -Z minimal-versions`
    Updating crates.io index
    Updating aho-corasick v0.7.20 -> v0.7.18
    Updating anes v0.1.6 -> v0.1.4
    Updating async-stream v0.3.3 -> v0.3.0
    Updating async-stream-impl v0.3.3 -> v0.3.0
    Updating atty v0.2.14 -> v0.2.6
      Adding autocfg v0.1.6
    Updating bitflags v1.3.2 -> v1.2.0
    Updating bumpalo v3.11.1 -> v3.2.1
    Updating bytes v1.3.0 -> v1.0.0
      Adding cfg-if v0.1.2
    Updating clap v3.2.23 -> v3.1.0
    Removing clap_lex v0.2.4
    Removing crossbeam-channel v0.5.6
    Updating crossbeam-deque v0.8.2 -> v0.7.4
    Updating crossbeam-epoch v0.9.13 -> v0.8.0
      Adding crossbeam-queue v0.2.0
    Updating crossbeam-utils v0.8.14 -> v0.7.0
    Updating ctor v0.1.26 -> v0.1.9
    Updating diff v0.1.13 -> v0.1.12
    Updating document-features v0.2.7 -> v0.2.0
      Adding dtoa v0.4.0
    Updating either v1.8.0 -> v1.0.0
    Updating encoding_rs v0.8.31 -> v0.8.0
    Updating futures-core v0.3.25 -> v0.3.0
    Updating half v1.8.2 -> v1.6.0
    Updating hashbrown v0.12.3 -> v0.8.1
    Removing hermit-abi v0.1.19
    Removing hermit-abi v0.2.6
    Updating indexmap v1.9.2 -> v1.5.2
    Updating itertools v0.10.5 -> v0.10.0
    Updating itoa v1.0.5 -> v0.3.0
    Updating js-sys v0.3.60 -> v0.3.51
    Updating libc v0.2.139 -> v0.2.8
    Removing litrs v0.2.3
    Updating log v0.4.17 -> v0.4.0
      Adding maybe-uninit v2.0.0
    Updating memchr v2.5.0 -> v2.4.0
    Updating memoffset v0.7.1 -> v0.5.0
    Removing num-traits v0.2.15
      Adding num-traits v0.1.32
      Adding num-traits v0.2.14
    Updating num_cpus v1.15.0 -> v1.2.0
    Updating once_cell v1.16.0 -> v1.5.2
    Updating oorandom v11.1.3 -> v11.1.0
    Updating ordered-float v2.10.0 -> v2.0.0
    Updating os_str_bytes v6.4.1 -> v6.0.0
    Updating output_vt100 v0.1.3 -> v0.1.2
    Updating pin-project-lite v0.2.9 -> v0.2.5
    Updating plotters v0.3.4 -> v0.3.1
    Updating plotters-backend v0.3.4 -> v0.3.0
    Updating plotters-svg v0.3.3 -> v0.3.0
    Removing proc-macro2 v1.0.49
      Adding proc-macro2 v0.4.21
      Adding proc-macro2 v1.0.32
    Removing quote v1.0.23
      Adding quote v0.6.10
      Adding quote v1.0.0
    Updating rayon v1.6.1 -> v1.3.0
    Updating rayon-core v1.10.1 -> v1.7.0
      Adding redox_syscall v0.1.0
      Adding redox_termios v0.1.0
    Updating regex v1.7.0 -> v1.5.0
    Updating regex-syntax v0.6.28 -> v0.6.24
      Adding rustc_version v0.2.3
    Removing ryu v1.0.12
    Updating same-file v1.0.6 -> v1.0.1
    Updating scopeguard v1.1.0 -> v1.0.0
      Adding semver v0.9.0
      Adding semver-parser v0.7.0
    Updating serde v1.0.151 -> v1.0.137
    Updating serde_derive v1.0.151 -> v1.0.137
    Updating serde_json v1.0.91 -> v1.0.0
    Removing syn v1.0.107
      Adding syn v0.15.22
      Adding syn v1.0.90
      Adding termion v1.5.0
    Updating textwrap v0.16.0 -> v0.14.0
    Updating tinytemplate v1.2.1 -> v1.1.0
    Updating tokio v1.23.0 -> v1.21.1
    Updating tokio-macros v1.8.2 -> v1.7.0
    Updating tokio-stream v0.1.11 -> v0.1.0
    Updating tokio-test v0.4.2 -> v0.4.0
    Removing unicode-ident v1.0.6
      Adding unicode-xid v0.1.0
      Adding unicode-xid v0.2.0
    Updating walkdir v2.3.2 -> v2.3.0
    Updating wasm-bindgen v0.2.83 -> v0.2.74
    Updating wasm-bindgen-backend v0.2.83 -> v0.2.74
    Updating wasm-bindgen-macro v0.2.83 -> v0.2.74
    Updating wasm-bindgen-macro-support v0.2.83 -> v0.2.74
    Updating wasm-bindgen-shared v0.2.83 -> v0.2.74
    Updating web-sys v0.3.60 -> v0.3.51
    Updating winapi v0.3.9 -> v0.3.6
    Updating winapi-util v0.1.5 -> v0.1.1
    Removing windows-sys v0.42.0
    Removing windows_aarch64_gnullvm v0.42.0
    Removing windows_aarch64_msvc v0.42.0
    Removing windows_i686_gnu v0.42.0
    Removing windows_i686_msvc v0.42.0
    Removing windows_x86_64_gnu v0.42.0
    Removing windows_x86_64_gnullvm v0.42.0
    Removing windows_x86_64_msvc v0.42.0
    Updating yansi v0.5.1 -> v0.5.0
info: running `cargo hack test --features serialize`
error: process didn't exit successfully: `\\?\C:\Users\Mingun\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\cargo.exe metadata --format-version=1` (exit code: 101)
--- stderr
 Downloading crates ...
error: failed to download `winapi v0.3.6`

Caused by:
  unable to get packages from source

Caused by:
  failed to unpack package `winapi v0.3.6`

Caused by:
  failed to remove directory `C:\Users\Mingun\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.3.6`

Caused by:
  Процесс не может получить доступ к файлу, так как этот файл занят другим процессом. (os error 32)

error: process didn't exit successfully: `\\?\C:\Users\Mingun\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\cargo.exe hack test --features serialize` (exit code: 1)
PS D:\Projects\quick-xml>

@Mingun Mingun reopened this Feb 26, 2023
@ehuss
Copy link
Contributor

ehuss commented Feb 26, 2023

Can you provide a reproduction that doesn't involve using a third-party command? A quick skim of cargo-hack looks like it runs cargo +stable metadata which will force it to use the stable toolchain.

@Mingun
Copy link
Author

Mingun commented Feb 26, 2023

Probably not. So if problem in cargo-hack I'll create an issue there

@ehuss
Copy link
Contributor

ehuss commented Apr 3, 2023

Closing as this is likely an issue with an external tool.

@ehuss ehuss closed this as completed Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants