You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem cargo install exits with success code when installing a list of crates, even if some of them failed.
As a result, anybody running cargo install crate1 crate2 will get a false sense of success if one of the crates failed to install. For example Dockerfiles running such commands will not fail to build, which means the resulting container image does not contain all the crates one hopes to find installed, since cargo install still exited with success code.
Steps
cargo install a list of crates where at least 1 fails and at least 1 succeeds. Right now I used cargo install --force cargo-sweep cargo-deny for example (as cargo-deny has issues installing without --locked; see Build failure due to bitvec dependency EmbarkStudios/cargo-deny#331 for details although the reason for failure is irrelevant to the issue reported here)
Check the last command exit code. it should be non-zero but it is zero.
Possible Solution(s)
Perhaps it's better to succeed only if all requested crates were successfully installed.
As a side note, documentation for cargo install should be updated to reflect the behaviour, either current or future.
Notes
Output of cargo version:
cargo 1.49.0 (d00d64d 2020-12-05)
OSX using stable channel
Problem
cargo installexits with success code when installing a list of crates, even if some of them failed.As a result, anybody running
cargo install crate1 crate2will get a false sense of success if one of the crates failed to install. For example Dockerfiles running such commands will not fail to build, which means the resulting container image does not contain all the crates one hopes to find installed, sincecargo installstill exited with success code.Steps
cargo installa list of crates where at least 1 fails and at least 1 succeeds. Right now I usedcargo install --force cargo-sweep cargo-denyfor example (as cargo-deny has issues installing without --locked; see Build failure due to bitvec dependency EmbarkStudios/cargo-deny#331 for details although the reason for failure is irrelevant to the issue reported here)Possible Solution(s)
Perhaps it's better to succeed only if all requested crates were successfully installed.
As a side note, documentation for
cargo installshould be updated to reflect the behaviour, either current or future.Notes
Output of
cargo version:cargo 1.49.0 (d00d64d 2020-12-05)
OSX using stable channel