Skip to content

Conversation

@jeckersb
Copy link
Collaborator

@jeckersb jeckersb commented Nov 13, 2025

  • kernel_cmdline: Add some more derives for Cmdline
  • install: Hoist InstallResetOpts kargs parsing up into clap
  • kernel_cmdline: Standardize Deref/AsRef impls across types
  • Use Cmdline for kargs fields in InstallConfigOpts and RootSetup
  • kernel_cmdline: impl PartialOrd/Ord/PartialEq/Eq for Parameter/ParameterKey
  • kernel_cmdline: Manually impl semantically-correct equivalence for Cmdline

Prep so we can parse these directly via clap

Signed-off-by: John Eckersberg <[email protected]>
Implement generic AsRef in terms of Deref as suggested in:

https://doc.rust-lang.org/std/convert/trait.AsRef.html#generic-implementations

I'm not 100% sold on this since in some case (like the change to the
tests here) you have to end up doing `&*` coercion to get the right
type, but this at least makes everything consistent.

Would be a bit nicer when/if str_as_str[1] stabilizes, at least for
the most common UTF-8 case.

[1] rust-lang/rust#130366

Signed-off-by: John Eckersberg <[email protected]>
@github-actions github-actions bot added the area/install Issues related to `bootc install` label Nov 13, 2025
@bootc-bot bootc-bot bot requested a review from gursewak1997 November 13, 2025 14:37

use crate::composefs_consts::COMPOSEFS_CMDLINE;

#[derive(Debug, PartialEq, PartialOrd, Eq, Default)]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I want to specifically call out that I removed this PartialOrd derive, I'm not sure why it was there and I don't think it makes sense to apply an ordering to this type. But it was blocking me from switching to Cmdline here since Cmdline does not impl PartialOrd. I could add it but I don't think it makes sense.

Copy link
Collaborator Author

@jeckersb jeckersb Nov 13, 2025

Choose a reason for hiding this comment

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

Actually maybe it would make sense. I could see adding a canonicalize() method to Cmdline which would sort the params and render them out with some opinionated quoting 🤔

Edit: Or at least make sense for Cmdline... still not sure it makes sense here for BLSConfigType but if I end up adding it for Cmdline I'll just put it back for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well down below I added PartialOrd/Ord for Parameter which makes sense in the context of comparing two Cmdlines by sorting their Parameters. But I still don't think it makes sense for Cmdline itself to have ordering.

@jeckersb
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 improvement, refactoring kernel argument handling to use the Cmdline type throughout the codebase. This centralizes parsing logic and makes the code more robust and readable. The changes to use CmdlineOwned in clap structures and standardizing Deref/AsRef implementations are well-executed. I have one suggestion to improve consistency and efficiency in how kernel arguments from the install configuration are processed.

Plus all of the various places this trickles down.

Signed-off-by: John Eckersberg <[email protected]>
@jeckersb jeckersb marked this pull request as ready for review November 13, 2025 16:48
@jeckersb
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 great improvement, refactoring kernel argument handling to use a dedicated Cmdline type. This significantly enhances type safety and maintainability by moving away from string manipulation. The changes are well-applied across the codebase. I've found one issue in the PartialEq implementation for Cmdline that doesn't correctly handle duplicate parameters, and I've provided a suggestion to fix it. The rest of the changes look solid.

…terKey

We need to be able to check equality on Cmdline by comparing sorted
parameters.

Signed-off-by: John Eckersberg <[email protected]>
@jeckersb
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 significantly improves kernel argument handling by introducing and consistently using the Cmdline type from the bootc-kernel-cmdline crate. Hoisting the parsing logic into clap and using the Cmdline type throughout the installation process makes the code cleaner and more robust.

I've found a couple of critical issues that will prevent the code from compiling, which I've detailed in the comments. Once these are addressed, this will be a great improvement.

Comment on lines +415 to +418
Cmdline::from(format!(
"root=UUID={} {RW_KARG} {COMPOSEFS_CMDLINE}={id_hex}",
this_arch_root()
)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it'd be cleaner for this to remain split up kargs instead of being parsed from a string again.

Copy link
Collaborator Author

@jeckersb jeckersb Nov 13, 2025

Choose a reason for hiding this comment

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

It's all just Vec<u8> under the covers, it doesn't really get parsed again. The only "parsing" is when it hands out slices via the various iter methods.

@cgwalters cgwalters enabled auto-merge (rebase) November 13, 2025 20:13
@cgwalters cgwalters merged commit 809b18b into bootc-dev:main Nov 13, 2025
34 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install Issues related to `bootc install`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants