Skip to content

cargo cmd preferefs cargo-cmd bin from it's home directory which makes sandboxing difficult #11020

@dpc

Description

@dpc

Problem

We are using Nix (nix develop) to prepare a reproducible build environment for the Rust codebase. Some users report that cargo clippy fails due to incompatible version of Rust compiler(?), while it works for other users as the cargo-clippy is reproducibly available in the $PATH.

After some debugging it turns out that users that have cargo-clippy installed in $HOME/.cargo/bin are affected because cargo prefers such binaries over those in $PATH, breaking out of the "sandbox".

Steps

N/A

Possible Solution(s)

  • Change the order of variables in
    let mut dirs = vec![config.home().clone().into_path_unlocked().join("bin")];
    so that Rust home binaries are tried last.

Notes

No response

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-custom-subcommandsArea: custom 3rd party subcommand pluginsC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions