Skip to content

bootloader: cmdline parser change and fixed escaping#432

Merged
yarda merged 1 commit intoredhat-performance:masterfrom
yarda:bootloader-escaping-fix
Aug 9, 2022
Merged

bootloader: cmdline parser change and fixed escaping#432
yarda merged 1 commit intoredhat-performance:masterfrom
yarda:bootloader-escaping-fix

Conversation

@yarda
Copy link
Contributor

@yarda yarda commented Apr 4, 2022

The following is now parsed differently:

[bootloader]
cmdline =+

Previously it was parsed as operator "=" adding symbol "+" to the cmdline,
now it is parsed as operator "=+" adding empty string "".

For the previous behaviour the leading "+" can now be escaped. It works the
following way:
cmdline =+ -> operator "=+" adding ""
cmdline =\+ -> operator "=" adding "+"
cmdline =\\+ -> operator "=" adding "\+"

Non leading escaping is ignored, e.g.:
cmdline =ab\+ -> operator "=" adding "ab\+"

Similarly for the operator "=-".

Also the arguments are now correctly escaped when further processed by
TuneD and the following problems should be now fixed:

cmdline =\n -> corruption of the /etc/tuned/bootcmdline with newlines
cmdline =\k -> TuneD traceback
cmdline =\1 -> operator "=" adding "TUNED_BOOT_CMDLINE="

There could be more undesired effects and that's why the escaping different
from the previously described leading escaping "\\", "\+", "\-" should be
now ignored.

Resolves: rhbz#1884472

Signed-off-by: Jaroslav Škarvada jskarvad@redhat.com

The following is now parsed differently:

[bootloader]
cmdline =+

Previously it was parsed as operator "=" adding symbol "+" to the cmdline,
now it is parsed as operator "=+" adding empty string "".

For the previous behaviour the leading "+" can now be escaped. It works the
following way:
cmdline =+ -> operator "=+" adding ""
cmdline =\+ -> operator "=" adding "+"
cmdline =\\+ -> operator "=" adding "\+"

Non leading escaping is ignored, e.g.:
cmdline =ab\+ -> operator "=" adding "ab\+"

Similarly for the operator "=-".

Also the arguments are now correctly escaped when further processed by
TuneD and the following problems should be now fixed:

cmdline =\n -> corruption of the /etc/tuned/bootcmdline with newlines
cmdline =\k -> TuneD traceback
cmdline =\1 -> operator "=" adding "TUNED_BOOT_CMDLINE="

There could be more undesired effects and that's why the escaping different
from the previously described leading escaping "\\", "\+", "\-" should be
now ignored.

Resolves: rhbz#1884472

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Copy link
Contributor

@jmencak jmencak left a comment

Choose a reason for hiding this comment

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

Thank you for the PR, @yarda . This looks good to me. I've tested the PR too. Could you fix the PR description though? The double '\\' get squashed into one '\'. AFAICS fix is needed in 3 places.

@yarda
Copy link
Contributor Author

yarda commented Apr 4, 2022

@jmencak thanks for the review and for noticing the bad escaping in the comment :) I fixed the comment, description in the PR should be OK.

@jmencak
Copy link
Contributor

jmencak commented Apr 5, 2022

@jmencak thanks for the review and for noticing the bad escaping in the comment :) I fixed the comment, description in the PR should be OK.

Thank you for the fixes, looks good to me now.

@yarda yarda merged commit b6d3cde into redhat-performance:master Aug 9, 2022
@yarda yarda deleted the bootloader-escaping-fix branch August 22, 2022 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants