Description
Problem
When merging multiple config.toml
files, Cargo concatenates arrays. For the registries.….credential-provider
setting this merging is counter-productive, because it constructs an invalid command.
Steps
When there's more than one applicable cargo.toml
file that contains:
[registries.custom]
credential-provider = ["cargo:token-from-stdout", "command", "arguments"]
after merging, it becomes:
[registries.custom]
credential-provider = ["cargo:token-from-stdout", "command", "arguments", "cargo:token-from-stdout", "command", "arguments"]
and results in Cargo running command arguments cargo:token-from-stdout command arguments
, which contains wrong arguments, and can fail in very confusing ways.
It's particularly easy to end up with exact duplicates of a custom registry configuration when configs are injected by build tools or projects have their own copy in addition to per-user or per-host configs.
Possible Solution(s)
The credential-provider
field should be replaced, not concatenated, when merging config files.
Notes
No response
Version
cargo 1.83.0 (5ffbef321 2024-10-29)
Activity