2020-09-21 09:48:02

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH 0/4] bootconfig: Fix a parser bug

Hi,

Here are patches to fix 2 bugs in the parser. One issue happens
when a key has a siblings and the key repeated with brace after
sibling nodes. Another one is that the parser keeps tailing
spaces when we put a comment on the line.

For example, the minimum example of the 1st issue is here;

foo
bar
foo { buz }

This should be parsed as

foo.buz
bar

But the bootconfig parser parses it as foo.buz (no bar node)
because foo->bar link is unlinked when the brace ("foo {") was
found.

The second one is simpler, if we have

foo = val # comment

The value's space after the word was not removed.

foo="val "

But this also should be

foo="val"

If user needs tailing spaces, they can use quotes, e.g.

foo = "val " # comment


Thank you,

---

Masami Hiramatsu (4):
lib/bootconfig: Fix a bug of breaking existing tree nodes
lib/bootconfig: Fix to remove tailing spaces after value
tools/bootconfig: Add testcases for repeated key with brace
tools/bootconfig: Add testcase for tailing space


tools/bootconfig/test-bootconfig.sh | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

--
Masami Hiramatsu (Linaro) <[email protected]>


2020-09-21 10:00:39

by Masami Hiramatsu

[permalink] [raw]
Subject: bootconfig: Fix parser bugs (Re: [PATCH 0/4] bootconfig: Fix a parser bug)


Oops, the title is wrong, there are 2 bugs.

On Mon, 21 Sep 2020 18:44:33 +0900
Masami Hiramatsu <[email protected]> wrote:

> Hi,
>
> Here are patches to fix 2 bugs in the parser. One issue happens
> when a key has a siblings and the key repeated with brace after
> sibling nodes. Another one is that the parser keeps tailing
> spaces when we put a comment on the line.
>
> For example, the minimum example of the 1st issue is here;
>
> foo
> bar
> foo { buz }
>
> This should be parsed as
>
> foo.buz
> bar
>
> But the bootconfig parser parses it as foo.buz (no bar node)
> because foo->bar link is unlinked when the brace ("foo {") was
> found.
>
> The second one is simpler, if we have
>
> foo = val # comment
>
> The value's space after the word was not removed.
>
> foo="val "
>
> But this also should be
>
> foo="val"
>
> If user needs tailing spaces, they can use quotes, e.g.
>
> foo = "val " # comment
>
>
> Thank you,
>
> ---
>
> Masami Hiramatsu (4):
> lib/bootconfig: Fix a bug of breaking existing tree nodes
> lib/bootconfig: Fix to remove tailing spaces after value
> tools/bootconfig: Add testcases for repeated key with brace
> tools/bootconfig: Add testcase for tailing space
>
>
> tools/bootconfig/test-bootconfig.sh | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> --
> Masami Hiramatsu (Linaro) <[email protected]>


--
Masami Hiramatsu

2020-09-23 05:32:27

by Masami Hiramatsu

[permalink] [raw]
Subject: Re: [PATCH 0/4] bootconfig: Fix a parser bug

Hi Steve,

Thank you for merging previous 3 serieses!
Could you also pick this series as urgent-fix branch?

Thank you,

On Mon, 21 Sep 2020 18:44:33 +0900
Masami Hiramatsu <[email protected]> wrote:

> Hi,
>
> Here are patches to fix 2 bugs in the parser. One issue happens
> when a key has a siblings and the key repeated with brace after
> sibling nodes. Another one is that the parser keeps tailing
> spaces when we put a comment on the line.
>
> For example, the minimum example of the 1st issue is here;
>
> foo
> bar
> foo { buz }
>
> This should be parsed as
>
> foo.buz
> bar
>
> But the bootconfig parser parses it as foo.buz (no bar node)
> because foo->bar link is unlinked when the brace ("foo {") was
> found.
>
> The second one is simpler, if we have
>
> foo = val # comment
>
> The value's space after the word was not removed.
>
> foo="val "
>
> But this also should be
>
> foo="val"
>
> If user needs tailing spaces, they can use quotes, e.g.
>
> foo = "val " # comment
>
>
> Thank you,
>
> ---
>
> Masami Hiramatsu (4):
> lib/bootconfig: Fix a bug of breaking existing tree nodes
> lib/bootconfig: Fix to remove tailing spaces after value
> tools/bootconfig: Add testcases for repeated key with brace
> tools/bootconfig: Add testcase for tailing space
>
>
> tools/bootconfig/test-bootconfig.sh | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> --
> Masami Hiramatsu (Linaro) <[email protected]>


--
Masami Hiramatsu <[email protected]>

2020-09-23 14:53:34

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 0/4] bootconfig: Fix a parser bug

On Wed, 23 Sep 2020 14:30:14 +0900
Masami Hiramatsu <[email protected]> wrote:

> Hi Steve,
>
> Thank you for merging previous 3 serieses!
> Could you also pick this series as urgent-fix branch?
>

Already pulled them and just finished testing them. Will push to Linus
in a bit.

-- Steve