-
Notifications
You must be signed in to change notification settings - Fork 927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.28.0 does not accept components separated by spaces #4220
Comments
I tried changing my CI to:
But the last command still fails with:
|
I finally figured it out. The problem is that the new version of rustup expect a comma-separated list of components whereas before, a space separated list at the end of the command line worked. Here is the fix:
I guess this is just another breaking change, but I re-read multiple times https://blog.rust-lang.org/2025/03/02/Rustup-1.28.0.html and it is not announced anywhere? |
Ah yes, this is likely an artifact of our clap upgrade that might not have been as much of a conscious change. Thanks for figuring it out, we will check how to mitigate this. |
@djc problem is resolved on my side but i'll leave it up to the rustup team to decide whether to close the issue or not. |
This comment has been minimized.
This comment has been minimized.
Maybe rustup could have some pre-release tests in an action that run rustup.exe in various ways to make sure the CLI interface doesn't break. |
Should potentially file a separate issue for this -- edited the title for this issue to keep the scope narrow. |
I highly doubt whether we can fix this without regressing #4073, but if you can, using commas would be a better option for a quick fix. |
Breaking change, see rust-lang/rustup#4220.
The expected behavior on our side is, of course: <CMD> -c a,b d => args=[d] c=[a, b]
<CMD> -c a -c b d => args=[d] c=[a, b]
<CMD> d -c a b => args=[d] c=[a, b]
<CMD> -c a b d => args=[] c=[a, b, d] However it's all about figuring out the right usage of |
@epage if you have any suggestions on whether/how this is possible, would be great! |
I've tried to emulate the different behaviors to see how they stack up with each other rustup 1.25.0#!/usr/bin/env nargo
---
[dependencies]
clap = "2"
---
fn main() {
let app = clap::App::new("foo")
.arg(
clap::Arg::with_name("toolchain")
.required(true)
.multiple(true),
)
.arg(
clap::Arg::with_name("profile")
.long("profile")
.takes_value(true)
.required(false),
)
.arg(
clap::Arg::with_name("components")
.help("Add specific components on installation")
.long("component")
.short("c")
.takes_value(true)
.multiple(true)
.use_delimiter(true),
);
let m = app.get_matches();
dbg!(&m);
} rustup 1.26.0#!/usr/bin/env nargo
---
[dependencies]
clap = "3"
---
fn main() {
let app = clap::App::new("foo")
.arg(
clap::Arg::new("toolchain")
.required(true)
.takes_value(true)
.multiple_values(true),
)
.arg(
clap::Arg::new("profile")
.long("profile")
.takes_value(true),
)
.arg(
clap::Arg::new("components")
.help("Add specific components on installation")
.long("component")
.short('c')
.takes_value(true)
.multiple_values(true)
.use_value_delimiter(true)
.action(clap::ArgAction::Append),
);
let m = app.get_matches();
dbg!(&m);
} rustup 1.27.1#!/usr/bin/env nargo
---
[dependencies]
clap = "4"
---
fn main() {
let app = clap::Command::new("foo")
.arg(
clap::Arg::new("toolchain")
.required(true)
.num_args(1..)
)
.arg(
clap::Arg::new("profile")
.long("profile")
.num_args(1),
)
.arg(
clap::Arg::new("components")
.help("Add specific components on installation")
.long("component")
.short('c')
.num_args(1..)
.use_value_delimiter(true)
.action(clap::ArgAction::Append),
);
let m = app.get_matches();
dbg!(&m);
} rustup 1.28.0#!/usr/bin/env nargo
---
[dependencies]
clap = { version = "4", features = ["derive"] }
---
use clap::Parser;
#[derive(Debug, Default, Parser)]
struct UpdateOpts {
#[arg(
num_args = 1..,
)]
toolchain: Vec<String>,
#[arg(long)]
profile: Option<String>,
/// Comma-separated list of components to be added on installation
#[arg(short, long, value_delimiter = ',')]
component: Vec<String>,
}
fn main() {
let m = UpdateOpts::parse();
dbg!(&m);
} Note:
btw if you make From my comment at #4073 (comment)
Actually accepting multiple values per flag is a problematic case, see the warning in the docs. To support cases like The only way to address this with clap is to regress #4073. For me, a question is whether |
@epage Thanks for your detailed analysis. Immediately after writing that comment I have realized there are a lot of ambiguities in my examples.
If we cannot make everyone happy and, if, as you said, we have already broken stuff when @djc migrated our project away from clap v2, I think it'd probably be reasonable to get back to the "old" behavior as in v1.26.0. I probably would need more info on how this could be done because, as I migrated to |
To be clear, that would regress #4073. Maybe my bias from seeing problems with
I believe you would just add btw iirc |
The usage was never clearly defined. But as the reporter of #4073, I have only ever used tooling that accepts |
@epage Thanks a lot! I think that's all the information I'll need for now.
@crawfxrd You are right... That's why I've changed the description to the following: rustup/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml Line 14 in 7588311
|
If space separated components are convenient, you can still issue a toolchain install first, and then run |
Verification
Problem
Hello,
At work, we use
to install a specific version of rust in our CI environment but since latest version (ie: v1.28.0), it fails with:
After reading https://blog.rust-lang.org/2025/03/02/Rustup-1.28.0.html I understand that some amount of backward incompatible changes have been released (with very short notice) but I don't understand:
Thank you in advance for your help 👍
Steps
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path -y --default-toolchain nightly-2025-02-11 -c cargo rustc rust-src
Possible Solution(s)
No response
Notes
No response
Rustup version
1.28.0
Installed toolchains
nightly-2025-02-11
OS version
Linux
The text was updated successfully, but these errors were encountered: