Skip to content

Wrong PATH override on Windows #7475

Closed
@sinkuu

Description

@sinkuu

EDIT: See #7475 (comment) for better description. Thank you @ehuss!

Problem

This is a regression introduced in the recent cargo update in rust repo.

On windows, within test processes run by cargo test, PATH variable now looks like:

C:\projects\rust-clippy\clippy_dev\target\debug\deps;C:\projects\rust-clippy\clippy_dev\target\debug;C:\Users\appveyor\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin;C:\Users\appveyor\.cargo\bin;C:\Users\appveyor\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin;.....

The first three paths are added by cargo. Note that nightly-x86_64-pc-windows-msvc\bin is now preferred than .cargo\bin.

In clippy CI, cargo +nightly fmt is invoked during integration test. This have been worked until the recent update. Today, the plain cargo binary from nightly-x86_64-pc-windows-msvc\bin is run instead of the rustup's one in .cargo\bin that supports +toolchain_name argument.

Steps

See recent failed builds in https://ci.appveyor.com/project/rust-lang-libs/rust-clippy

Clippy's CI involves two versions of toolchains: nightly and master.

  1. cargo test (master) runs tests/fmt.rs integration test.
  2. tests/fmt.rs invokes cargo +nightly run on clippy_dev. This succeeds because master does not have cargo. Now we are in nightly environment.
  3. clippy_dev invokes cargo +nightly fmt. This fails because nightly has cargo.

Possible Solution(s)

.cargo\bin should always be preferred (come first in PATH variable).

Notes

Output of cargo version:

cargo 1.40.0-nightly (8b0561d68 2019-09-30)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions