rcxml: discourage empty strings in rc.xml configuration
Some checks failed
labwc.github.io / notify (push) Has been cancelled

Background:
I rewrote the config parser in 9462457..2f414a4, but it broke certain
configurations by changing how empty strings are handled: they were mostly
just ignored before my parser rewrite, but after that, they are
interpreted as just empty strings (output="" is considered as 'output named ""').

Though that was unintentional, I believe ignoring empty strings was not a
good idea in the first place, as we already allow empty strings for
certain configurations (e.g. `<desktop prefix="">`), which makes the
parser's behavior inconsistent.

Change:
So let's clarify that we intend to read empty strings as empty strings.
As a preparation, this commit adds warnings for empty strings we are
currently ignoring, so that users can be informed that we intend to just
read empty strings (e.g. `<theme name="">`) as empty strings in the future.
I removed existing empty strings in `rc.xml.all` to avoid warnings when
reading it.
This commit is contained in:
tokyo4j 2025-12-03 18:26:44 +09:00 committed by Hiroaki Yamamoto
parent a5db8e477a
commit 06505d24c8
2 changed files with 31 additions and 23 deletions

View file

@ -714,6 +714,8 @@ fill_libinput_category(xmlNode *node)
char *key, *content;
LAB_XML_FOR_EACH(node, child, key, content) {
if (string_null_or_empty(content)) {
wlr_log(WLR_ERROR, "Empty string is not allowed for "
"<libinput><device><%s>. Ignoring.", key);
continue;
}
if (!strcmp(key, "category")) {
@ -1076,7 +1078,8 @@ entry(xmlNode *node, char *nodename, char *content)
return true;
} else if (str_space_only(content)) {
/* ignore empty leaf nodes other than above */
wlr_log(WLR_ERROR, "Empty string is not allowed for %s. "
"Ignoring.", nodename);
/* handle non-empty leaf nodes */
} else if (!strcmp(nodename, "decoration.core")) {