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

`cargo install` ignores local source replacement #6397

cuviper opened this issue Dec 7, 2018 · 2 comments


Copy link

commented Dec 7, 2018

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 again (which fails in Fedora offline builds).

(in a crate dir that uses some dependencies)

  1. mkdir .cargo
  2. cargo vendor > .cargo/config
  3. cargo install --path . --verbose
    • See that it is building deps from, 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.


Output of cargo version:

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

This comment has been minimized.

Copy link
Member Author

commented Dec 7, 2018

On discord #cargo, @joshtriplett suggested that cargo should never look at $PWD for configs, but instead look at the crate root only. This makes a lot sense to me. However, it would break any workflows that try to do "remote" builds (--manifest-path) with different local configs.


This comment has been minimized.

Copy link

commented Dec 7, 2018

@cuviper Those workflows should explicitly set $CARGO_HOME.

(That said, we should absolutely detect a cargo configuration in $PWD that we would have read and warn about it, and have a nice long transition.)

bors added a commit that referenced this issue Apr 1, 2019
Allow `cargo install --path P` to load config from P.

`cargo install` was changed to ignore configs except for the home directory (#6026). However, it seems like there are legitimate needs when using `--path`, so allow loading from that path, too.

Closes #6498.
Closes #6397.
@bors bors closed this in #6804 Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.