Skip to content

Invalid binary already exists error from cargo install in case of binary disabled by feature #14384

Open
@senia-psm

Description

@senia-psm

Problem

In case of 2 crates contain the same binary in case of some feature enabled there is a conflict detected even in case of disabled feature.
This behaviour depends on the order of cargo install commands, i.e. if you are installing crate with the conflicting binary disabled by feature first you are getting no errors.

Steps

  1. Install invalid-bin-conflict-a first and then invalid-bin-conflict-b:
cargo install invalid-bin-conflict-a
cargo install invalid-bin-conflict-b
  1. There is an error:
$ cargo install invalid-bin-conflict-b
    Updating crates.io index
error: binary `invalid-bin-conflict-a` already exists in destination as part of `invalid-bin-conflict-a v0.1.0`
Add --force to overwrite

Possible Solution(s)

Exclude binaries disabled by features for binary conflict check.

Notes

If you try to install invalid-bin-conflict-b first and then invalid-bin-conflict-a - there would be no error.

Version

$ cargo version --verbose
cargo 1.80.0 (376290515 2024-07-16)
release: 1.80.0
commit-hash: 37629051518c3df9ac2c1744589362a02ecafa99
commit-date: 2024-07-16
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Gentoo Linux 2.15.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargo-targetsArea: selection and definition of targets (lib, bins, examples, tests, benches)C-bugCategory: bugCommand-installS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions