-
Notifications
You must be signed in to change notification settings - Fork 197
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
Parse Spaces in kargs
Input
#4821
Comments
Normally we do this via
|
Thank you for your response! I understand your point, but I think the user should at least get a warning about this, otherwise the semantics of For example, when user do This is not terrible, but to me, it feels like inelegant design in the software. And from the link https://discussion.fedoraproject.org/t/how-i-do-to-put-several-kernel-arguments-in-rpm-ostree-in-a-single-command/74113 , people indeed misinterprets the use cases of these commands. |
I think it'd be fine to handle this by splitting on whitespace. However, I'd suggest rather than trying to handle quoting, we just detect if any quotes are present and pass through as is in that case. Edit: so basically, something like this: if there's a literal |
Note that there are the
According to https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html, we can have quoted spaces in kernel command line arguments so we need to support that. Thus this makes this tricky, as we need to correctly detect spaces outside of quotes to split the arguments to process them.
|
Seems can append as whole, but failed when delete (if there is space), IMU, we should fix this.
We should split with space as the issue description.
Xerf to Colin's comment openshift/machine-config-operator#3856 (comment). |
Right, that's what I'm referring to in #4821 (comment). My suggestion is to not try to handle it and just pass through as is if there are literal quotes. OTOH, it wouldn't be very hard to make a quoting-aware splitter so cool with that too. (IIRC we have similar code already for handling this with package requests in manifests too.) |
According to Jonathan's suggestion, should fix this from ostree repo. With this patch: - kargs input like "init_on_alloc=1 init_on_free=1", will be parsed as 2 seperated arg `init_on_alloc=1` and `init_on_free=1`, instead of as whole; - According to https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html, should keep spaces in double-quotes, like `param="spaces in here"` will be parsed as whole instead of 3. Fixes coreos/rpm-ostree#4821
According to Jonathan's suggestion, should fix this from ostree repo. With this patch: - kargs input like "init_on_alloc=1 init_on_free=1", will be parsed as 2 seperated arg `init_on_alloc=1` and `init_on_free=1`, instead of as whole; - According to https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html, should keep spaces in double-quotes, like `param="spaces in here"` will be parsed as whole instead of 3. Fixes coreos/rpm-ostree#4821
According to Jonathan's suggestion, should fix this from ostree repo. With this patch: - kargs input like "init_on_alloc=1 init_on_free=1", will be parsed as 2 seperated arg `init_on_alloc=1` and `init_on_free=1`, instead of as whole; - According to https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html, should keep spaces in double-quotes, like `param="spaces in here"` will be parsed as whole instead of 3. Fixes coreos/rpm-ostree#4821
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
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
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
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
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
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
Should be available with https://koji.fedoraproject.org/koji/buildinfo?buildID=2420970 |
Describe the bug
When send in multiple kargs input in a single string, the
kargs
seems to treat it as a single key value pair. For example runrpm-ostree karg --delete "init_on_alloc=1 init_on_free=1"
will delete neither parameter, andrpm-ostree karg --append-if-missing "init_on_alloc=1 init_on_free=1"
will duplicate these two kargs even when they existsReproduction steps
rpm-ostree karg --append "init_on_alloc=1 init_on_free=1"
, notice thatinit_on_alloc=1 init_on_free=1
gets added to kargsrpm-ostree karg --append-if-missing "init_on_alloc=1 init_on_free=1"
, will duplicate these two kargs even when they are already presentrpm-ostree karg --delete "init_on_alloc=1 init_on_free=1"
will give an error stating the argument is not foundExpected behavior
rpm-ostree karg --append-if-missing "init_on_alloc=1 init_on_free=1"
should not duplicate the kargs, andrpm-ostree karg --delete "init_on_alloc=1 init_on_free=1"
should delete the kargs when they are present.Or at least raise an error/warning to the user about invalid input.
Actual behavior
Described in "Reproduction steps" section
System details
Additional information
Related:
delete-kargs-hardening
and documentation secureblue/secureblue#202The text was updated successfully, but these errors were encountered: