]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bootconfig: Terminate value search if it hits a newline
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Thu, 5 Feb 2026 00:46:25 +0000 (09:46 +0900)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Thu, 5 Feb 2026 13:21:07 +0000 (22:21 +0900)
commit1cadf2819bc91ab5cb060ec3ce473bae30c9e52d
treeab8f9c19bc39383a118324b464db522ef6a5d27f
parent18f7fcd5e69a04df57b563360b88be72471d6b62
bootconfig: Terminate value search if it hits a newline

Terminate the value search for a key if it hits a newline and make
the value empty.

When we pass a bootconfig with an empty value terminated by the
newline, like below::

  foo =
  bar = value

Current bootconfig interprets it as a single entry::

  foo = "bar = value";

The Documentation/admin-guide/bootconfig.rst defines the value
itself is terminated by newline:

  The value has to be terminated by semi-colon (``;``) or newline (``\n``).

but it does not define when the value search is terminated.
This changes the behavior to be more line-oriented, so that it is
clearer in how it works.

- The value search of key-value pair will be terminated by a comment
  or newline.
- The value search of an array will continue beyond comments and
  newlines.

Thus, with this update, the above example is interpreted as::

  foo = "";
  bar = "value";

And the below example will cause a syntax error because "bar" is expected
as a key but it has ','.

  foo =
    bar, buz

According to this change, one wrong example config is updated.

Link: https://lore.kernel.org/all/177025238503.14982.17059549076175612447.stgit@devnote2/
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Documentation/admin-guide/bootconfig.rst
lib/bootconfig.c
tools/bootconfig/samples/bad-array-after-comment.bconf [new file with mode: 0644]
tools/bootconfig/samples/bad-array-in-next-line.bconf [new file with mode: 0644]
tools/bootconfig/samples/good-array-space-comment.bconf