-
Notifications
You must be signed in to change notification settings - Fork 149
Switch bootc_kargs to use kernel_cmdline for parsing #1724
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
Conversation
4196722 to
e28c0a1
Compare
|
Rebased on #1729, so this is pending getting that sorted out and merged first. |
e28c0a1 to
1c99086
Compare
|
Hooray for tests |
1c99086 to
3bd3694
Compare
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request is a nice refactoring to use a dedicated Cmdline type for kernel arguments instead of Vec<String>, which improves type safety and code clarity. The implementation is solid, introducing a new remove_exact method and updating various parts of the codebase to use the new type. I've found one bug in how root arguments are filtered and have a suggestion to reduce code duplication in the tests by using a helper function. Overall, great work on improving the codebase.
|
Also we should modify the upgrade integration test to include quoted kargs as in ostreedev/ostree#3544 which originally prompted all of this |
3bd3694 to
02b77cc
Compare
|
Ok good news is that cherry-picking the patch that modifies the upgrade test onto main reproduces the original problem where ostree aborts: |
02b77cc to
ed5b166
Compare
cgwalters
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I'm questioning but otherwise looks sane
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
ed5b166 to
babf2d4
Compare
crates/lib/src/install.rs
Outdated
| let user_kargs = user_kargs | ||
| .iter() | ||
| .map(|arg| { | ||
| Parameter::parse(arg).ok_or_else(|| anyhow!("Unable to parse parameter: {arg}")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good though one thing to bear in mind is that we can push string parsing all the way up into clap structs where applicable, and I think this is one of those cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that would be ideal. It's a bit awkward the way things are right now though, because Parameter is always borrowed from elsewhere (typically from its parent Cmdline). I guess we could refactor it to work exactly like Cmdline so it uses a Cow internally and then we could build owned values from the clap options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that would be ideal. It's a bit awkward the way things are right now though, because
Parameteris always borrowed from elsewhere (typically from its parentCmdline). I guess we could refactor it to work exactly likeCmdlineso it uses aCowinternally and then we could build owned values from the clap options.
Actually after sleeping on it, it occurs to me that we can just use Option<Vec<CmdlineOwned>> for the karg flag. As a side-effect of that you would be able to specify multiple parameters in one option while still supporting multiple options. So for example: --karg "foo bar baz" --karg "wuz" would correctly parse that as three and one arg respectively, and add all four.
|
Hmm That looks unrelated to this but worth noting. |
Ah I see #1748 now 👍 |
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
This covers the issue reported in ostreedev/ostree#3544 Signed-off-by: John Eckersberg <jeckersb@redhat.com>
babf2d4 to
9b18b22
Compare
Had this working earlier this afternoon but broke it in rebase somehow. Time for halloween festivities but wanted to throw it up incase my laptop is hit by a meteor over the weekend.