-
Notifications
You must be signed in to change notification settings - Fork 150
kernel_cmdline: Add canonicalized() methods
#1781
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
base: main
Are you sure you want to change the base?
Conversation
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 introduces canonicalized() methods to Cmdline, Parameter, and ParameterKey for both byte-based and UTF-8 representations of kernel command lines. This is a useful addition for creating deterministic command line strings, for example to support reproducible builds. The implementation is functionally correct, but I've identified a couple of opportunities for performance improvements in crates/kernel_cmdline/src/bytes.rs by avoiding unnecessary memory allocations. My review comments include specific suggestions to address these.
This seems generally useful, mostly I could see always canonicalizing the cmdline generated by bootc to remove a source of potential drift/nondeterminism and better enable reproducible builds. Signed-off-by: John Eckersberg <[email protected]>
15d7e28 to
abbb33e
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.
I'd be more comfortable with just doing semantic equality where it matters, like our handling of /usr/lib/bootc/kargs.d i.e. it'd be unfortunate for someone to have to reboot because their build system started quoting a karg unnecessarily or so.
| /// | ||
| /// This: | ||
| /// | ||
| /// 1. Sorts the parameter list |
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.
Hmm but I think in some corner cases this could actually change semantics. Some kargs probably have last-one-wins behavior e.g.
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's a good point. I don't think it's at all consistent either, it varies arg to arg.
|
I'm going to just mark this as draft for now since I kinda hastily threw it together from branches/stash I had lying around. Might make sense to rip the |
This seems generally useful, mostly I could see always canonicalizing
the cmdline generated by bootc to remove a source of potential
drift/nondeterminism and better enable reproducible builds.
Signed-off-by: John Eckersberg [email protected]