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

Closed
cuviper opened this issue Dec 7, 2018 · 2 comments · Fixed by #6804
Closed

cargo install ignores local source replacement #6397

cuviper opened this issue Dec 7, 2018 · 2 comments · Fixed by #6804
Labels
A-configuration Area: cargo config files and env vars

Comments

@cuviper
Copy link
Member

cuviper commented Dec 7, 2018

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
@cuviper
Copy link
Member Author

cuviper 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.

@joshtriplett
Copy link
Member

@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.)

@ehuss ehuss added the A-configuration Area: cargo config files and env vars label Mar 31, 2019
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 as completed in #6804 Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-configuration Area: cargo config files and env vars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants