-
Notifications
You must be signed in to change notification settings - Fork 305
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
kargs: parse spaces in kargs input and keep quotes #3208
Conversation
Skipping CI for Draft Pull Request. |
15b1128
to
9cf500a
Compare
Do local testing and failed
|
Might be worth taking a peak at kernel/systemd and other karg parsing implementations, this kind of thing has been done in other places before. Sometimes for this kinda thing it's worth testing loads of random things in a small implementation for quick iterations (and use valgrind, sanitizers, -fanalyzer etc.):
then add as an automated test. I didn't look at the code in any great detail, but on first glance it looks like it could be a string manipulation bug based on the double free. seems to me that we don't exactly want to split by whitespace here. |
I also wonder should you just try and edit the BLS files directly rather than change this feature. grubby has a similar feature which I've had trouble with in the past, these days I find editing the BLS directly easier. |
tests/test-admin-deploy-karg.sh
Outdated
|
||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-append="test=\"1 2\"" testos:testos/buildmain/x86_64-runtime | ||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*test="1 2"' | ||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-delete="test=\"1 2\"" testos:testos/buildmain/x86_64-runtime |
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.
The delete interface might be a little simpler/cleaner if it expected key only (the test part)
83d0435
to
49bde06
Compare
Thanks @ericcurtin for the review, the error is fixed with the help of @jmarrero , it is because the previous change in |
49bde06
to
869f9ab
Compare
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.
LGTM, might want to run this through gcc's "-fanalyzer" to see if it identifies any potential problems, string manipulation is always tricky.
56d8c30
to
67d9b76
Compare
According to Jonathan's suggestion, should fix the code from ostree repo. With this patch: - kargs input like "init_on_alloc=1 init_on_free=1", will be parsed as 2 seperated args `init_on_alloc=1` and `init_on_free=1`, instead of whole; - According to https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html, need to keep spaces in double-quotes, like `param="spaces in here"` will be parsed as whole instead of 3. Fixes coreos/rpm-ostree#4821
67d9b76
to
abc7d5b
Compare
Related change in ostree is ostreedev/ostree#3208. Fixes: ostreedev/ostree#3228
Related change in ostree is ostreedev/ostree#3208. Fixes: ostreedev/ostree#3228
Related change in ostree is ostreedev/ostree#3208. Fixes: ostreedev/ostree#3228
Related change in ostree is ostreedev/ostree#3208. Fixes: ostreedev/ostree#3228
Related change in ostree is ostreedev/ostree#3208. Fixes: ostreedev/ostree#3228
Related change in ostree is ostreedev/ostree#3208. Fixes: ostreedev/ostree#3228
Related change in ostree is ostreedev/ostree#3208. Fixes: ostreedev/ostree#3228
Related change in ostree is ostreedev/ostree#3208. Fixes: ostreedev/ostree#3228
According to Jonathan's suggestion, should fix the code from
ostree repo.
With this patch:
parsed as 2 seperated args
init_on_alloc=1
andinit_on_free=1
,instead of whole;
need to keep spaces in double-quotes, like
param="spaces in here"
will be parsed as whole instead of 3.
Fixes coreos/rpm-ostree#4821