Skip to content

Do not trust the .crates.toml #2215

@Veetaha

Description

@Veetaha

Hi. I am seeing the error on CI that iai-callgrind-runner command is not available,

Image

even though cargo-binstall said that the binary is already installed in the CI step above.

I think the problem is that I somehow fucked up the caching on CI. The setup-rust-toolchain action caches cargo home, including the .crates.toml and the bin directory, but for some reason there is no iai-callgrind-runner binary in the bin directory.

This worked fine on the first CI run on master because cargo-binstall didn't skip downloading the binary.

I can add --force flag as a workaround, but I think, in general, cargo binstall should not trust .crates.toml and do a double integrity check that the binary is actually available in the bin directory, and that it has an executable bit set at least. If not - suggest downloading the binary as usual with maybe a warning saying that .crates.toml <-> bin integrity issue was detected. Or it could be a hard error to avoid footguns


UPD:

I think I found why my cache was fucked up. Seems like setup-rust-toolchain action cleans the bins directory:
https://github.com/elastio/bon/actions/runs/15915391654/job/44891997214#step:13:45

This is the related issue in Swatinem/rust-cache: Swatinem/rust-cache#204

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions