kargs: parse spaces in kargs input and keep quotes
authorHuijingHei <hhei@redhat.com>
Mon, 4 Mar 2024 02:44:42 +0000 (10:44 +0800)
committerHuijingHei <hhei@redhat.com>
Fri, 8 Mar 2024 02:01:06 +0000 (10:01 +0800)
commitabc7d5b9a0eb312288fc9b31505aedba8c555e65
tree4c7f7798e4083aee9cfe94605a3abab8a55c24fb
parentd95c2f8dd82d91f4366297efebe13398cc918334
kargs: parse spaces in kargs input and keep quotes

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 https://github.com/coreos/rpm-ostree/issues/4821
src/libostree/ostree-kernel-args.c
src/ostree/ot-admin-builtin-deploy.c
tests/test-admin-deploy-karg.sh
tests/test-kargs.c