Skip to content

Request to support disabling path checks when using cargo install #14276

Open
@jdknight

Description

@jdknight

Problem

Been using a couple of tools which manage building multiple packages for a target. For a project, it may use a package which is Cargo-based and will eventually call cargo build/cargo install when processed. These tools will install Cargo packages into a target that is not in the path, but Cargo will generate a warning:

warning: be sure to add `<path>` to your PATH to be able to run the installed binaries

Such a warning is not applicable for these install cases, and it would be nice to have a way to ignore them. An example includes a Buildroot run that uses a cargo-based package can have logs that shows the warning:

>>> tealdeer 1.6.1 Installing to target
cd /home/autobuild/autobuild/instance-15/output-1/build/tealdeer-1.6.1/ && ...
  Installing tealdeer v1.6.1 (/home/autobuild/autobuild/instance-15/output-1/build/tealdeer-1.6.1)
    Finished release [optimized] target(s) in 2.35s
  Installing /home/autobuild/autobuild/instance-15/output-1/target/usr/bin/tldr
   Installed package `tealdeer v1.6.1 (/home/autobuild/autobuild/instance-15/output-1/build/tealdeer-1.6.1)` (executable `tldr`)
warning: be sure to add `/home/autobuild/autobuild/instance-15/output-1/target/usr/bin` to your PATH to be able to run the installed binaries

Proposed Solution

It would be nice to have an environment option or a command line flag to suppress such a warning.

A suggested reference implementation can be seen in #14274.

Notes

I made the unfortunate decision to create the pull request before submitting this issue (:bow:). To pull over an initial comment already brought up the in the pull request:

We have an unstable [lints.cargo] table under development.

I do not believe the prospect [lints.cargo] table is related to this proposed no-path-check configuration hint. The proposed option is more so tailored for users managing installs for a series Cargo packages and not specific to an individual package.

It appears to me that the focus of #12235 is for linting-specific handling. And since I believe a proposed no-path-check is not part of this scope, I have created this new issue. Feel free to correct me if I'm wrong here.

Note that the reference implementation does provide an example supporting a command line option, a configuration flag and an environment variable. Personally, I would be all for just an environment variable (e.g. CARGO_INSTALL_NO_PATH_CHECK), since these scenarios typically have means to manage the environment easily. I only provided the extended options since I did not observe any non-internal flag case where only an environment flag was used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-installS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions