From 06505d24c8d3a5e5fa1d0212789aa104ff97b8ed Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Wed, 3 Dec 2025 18:26:44 +0900 Subject: [PATCH] rcxml: discourage empty strings in rc.xml configuration 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. ``), 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. ``) as empty strings in the future. I removed existing empty strings in `rc.xml.all` to avoid warnings when reading it. --- docs/rc.xml.all | 49 +++++++++++++++++++++++++--------------------- src/config/rcxml.c | 5 ++++- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/docs/rc.xml.all b/docs/rc.xml.all index 97698aac..cd73f61e 100644 --- a/docs/rc.xml.all +++ b/docs/rc.xml.all @@ -33,8 +33,8 @@ - - + + labwc icon:iconify,max,close @@ -218,9 +218,9 @@ space automatically, so is only intended for other, specialist cases. - If output is left empty, the margin will be applied to all outputs. + If 'output' is not provided, the margin will be applied to all outputs. - + --> @@ -525,7 +525,11 @@ If mouseEmulation is enabled, all touch up/down/motion events are translated to mouse button and motion events. --> - + + + + no + - + + @@ -586,7 +591,7 @@ - sendEventsMode [yes|no|disabledOnExternalMouse] - calibrationMatrix [six float values split by space] - scrollFactor [float] - + The following ... block may not be complete for your requirements. Default values are device specific. Only set an option if you require to override the default. Valid values must be inserted. @@ -595,21 +600,21 @@ - - - - + + + + yes - - - - - - - - - - + + + + + + + + + + 1.0 @@ -678,7 +683,7 @@ 400 2.0 0.2 - true + yes diff --git a/src/config/rcxml.c b/src/config/rcxml.c index c5d94d4f..84054e82 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -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 " + "<%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")) {