From: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
To: mhiramat@kernel.org
Cc: rostedt@goodmis.org, linux-trace-kernel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] tools/bootconfig: Preserve arrays starting with an empty value
Date: Wed, 18 Nov 2026 00:07:57 +0100 [thread overview]
Message-ID: <e40c6adf42ba4b90cd16d9ca955f38c6c4783eb1.1794956874.git.edumucelli@gmail.com> (raw)
bootconfig -l treats an empty first value as a key without a value.
When the value is an array, this drops every subsequent entry from the
output. For example, 'key = "", "value"' is printed as 'key = ""'.
Reading the list output back loses the second entry.
Check for a child value node instead of checking the contents of the
first string. This lets xbc_show_value() print all the array entries
and keeps the existing output for keys without a value.
Add tests for direct arrays, appended values, nested keys, empty
scalars and keys without values. Exercise list output from both a
configuration file and a test initrd.
Fixes: e4f70b7badb4 ("tools/bootconfig: Add list option")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
---
Hi Masami,
Thanks again for reviewing the earlier bootconfig fixes.
I tested the list output on my Ubuntu machine using plain bootconfig
files and a temporary initrd image. The two new output comparisons fail
on the original tool and pass with this change. The full bootconfig
test suite also passes with the patch applied.
Thanks,
Eduardo
tools/bootconfig/main.c | 2 +-
tools/bootconfig/test-bootconfig.sh | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index d3f840c5adce..b189ca0935b9 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -170,7 +170,7 @@ static void xbc_show_list(void)
break;
}
printf("%s = ", key);
- if (!val || val[0] == '\0') {
+ if (!val || !xbc_node_get_child(leaf)) {
printf("\"\"\n");
continue;
}
diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh
index f584f7637e12..85d56b7e4ac7 100755
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -156,6 +156,30 @@ $BOOTCONF $INITRD > $TEMPCONF
cat $TEMPCONF
xpass grep \'\"string\"\' $TEMPCONF
+echo "List output preserves arrays starting with an empty value"
+cat > $TEMPCONF << EOF
+flag
+empty = ""
+array = "", "value", ""
+append = ""
+append += "value"
+nested.array = "", "value"
+EOF
+$BOOTCONF -l $TEMPCONF > $OUTFILE
+cat > $TEMPCONF << EOF
+flag = ""
+empty = ""
+array = "", "value", ""
+append = "", "value"
+nested.array = "", "value"
+EOF
+xpass diff -u $TEMPCONF $OUTFILE
+
+echo "List output preserves empty array values in an initrd"
+xpass $BOOTCONF -a $TEMPCONF $INITRD
+$BOOTCONF -l $INITRD > $OUTFILE
+xpass diff -u $TEMPCONF $OUTFILE
+
echo "Repeat same-key tree"
cat > $TEMPCONF << EOF
foo
base-commit: 381b391bfaa3f10d52da4740529804b0b6b8160d
--
2.53.0
next reply other threads:[~2026-11-17 23:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 23:07 Eduardo Mucelli Rezende Oliveira [this message]
2026-11-22 2:02 ` Masami Hiramatsu (Google)
2026-11-22 14:11 ` [PATCH v2] " Eduardo Mucelli Rezende Oliveira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e40c6adf42ba4b90cd16d9ca955f38c6c4783eb1.1794956874.git.edumucelli@gmail.com \
--to=edumucelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®