Skip to content

cargo install should read $HOME/.cargo/config only #6025

@traviscross

Description

@traviscross

The cargo install command should read configuration from $HOME/.cargo/config but not from other configuration files.

Normally cargo looks for configuration in $PWD/.cargo/config, $PWD/../.cargo/config, etc., and in $HOME/.cargo/config. For cargo install, however, the tree walking behavior is surprising. cargo install foo should work the same regardless of the directory from which we run it.

This surprising behavior resulted in #5850 and PR #5874. That PR causes cargo install to ignore any configured build.target value from a configuration file.

However, that change does both too little and too much. It does too much because we don't want to ignore configured values in $HOME/.cargo/config. Values set there make sense for cargo install. E.g., we might use that to set musl as our default build target. On the other hand, the change does too little because we want to ignore all configuration values from $PWD/(../)*/.cargo/config, not just build.target.

The correct behavior is that cargo install should load only $HOME/.cargo/config and should apply all values found there.

cc @alexcrichton @japaric

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions