Skip to content

cargo install ignores local source replacement #6397

Closed
@cuviper

Description

@cuviper

Problem
Since #6026, cargo install only loads configuration from ~/.cargo/config. However, the workflow for tools like cargo-vendor is to create .cargo/config in the current directory for source replacement. We do this for Fedora packaging too. Now that local config is ignored, so install tries to use crates.io again (which fails in Fedora offline builds).

Steps
(in a crate dir that uses some crates.io dependencies)

  1. mkdir .cargo
  2. cargo vendor > .cargo/config
  3. cargo install --path . --verbose
    • See that it is building deps from crates.io, not ./vendor/.

Possible Solution(s)

As a workaround, env CARGO_HOME=$PWD/.cargo cargo install ... seems to work.

Longer term, maybe we need to scale back #6026 to more tightly address the problems it was trying to address (#6025, #5850), but I don't know the best policy for which configs to use.

Notes

Output of cargo version:

cargo 1.31.0 (339d9f9c8 2018-11-16)
release: 1.31.0
commit-hash: 339d9f9c8f400010df3282ae5582bf3a0f739004
commit-date: 2018-11-16

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-configurationArea: cargo config files and env vars

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions