Skip to content

Fixed bug with argument parsing that was preventing register and unregister#1707

Open
bhillowasa wants to merge 1 commit intoDevolutions:masterfrom
bhillowasa:master
Open

Fixed bug with argument parsing that was preventing register and unregister#1707
bhillowasa wants to merge 1 commit intoDevolutions:masterfrom
bhillowasa:master

Conversation

@bhillowasa
Copy link

service from working.

This prevents it from installing in Linux environments, as the SystemD service is never created.

let action = match remaining_args.first().map(String::as_str) {
Some("--service") => CliAction::Run { service_mode: true },
Some("service") => match args.next().as_deref() {
Some("service") => match remaining_args.get(1).map(String::as_str) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code looks correct. Can you provide more information?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code was calling args.next but the problem is that the args iterator was already consumed and its values pushed to remaining_args earlier on in the code.

I ran into this issue when I was installing the latest RPM on AlmaLinux; the pre and post scripts were failing. Calling /usr/bin/devolutions_gateway service register or /usr/bin/devolutions_gateway service unregister with the original code simply resulted in nothing happening except the execution falling through to CliAction::ShowHelp.

Copy link
Member

@CBenoit Benoît Cortier (CBenoit) Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I see. The bug seems to have been introduced by this commit: 3bcff86
The new code is quite convoluted, so I would rather update the whole parsing logic to something better.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m sending a patch for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants