rules: fix check for appending '|' character when applying There are two ways to separate multiple files in XKB include statements: '+' will cause the later file to override the first in case of conflict, while '|' will cause it augment it (this is done by xkbcomp). '!' is unrelated here. Since '|' is practically never used, this wasn't noticed. In the modified test, the '|some_compat' previously was just ignored. Signed-off-by: Ran Benita <ran234@gmail.com>
diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c
index a1a0da1..bd99dc1 100644
--- a/src/xkbcomp/rules.c
+++ b/src/xkbcomp/rules.c
@@ -629,7 +629,7 @@ apply(const char *src, char **dst)
if (!src)
return;
- if (*src == '+' || *src == '!') {
+ if (*src == '+' || *src == '|') {
tmp = *dst;
ret = asprintf(dst, "%s%s", *dst, src);
if (ret < 0)
diff --git a/test/data/rules/simple b/test/data/rules/simple
index 16fc495..446954e 100644
--- a/test/data/rules/simple
+++ b/test/data/rules/simple
@@ -18,4 +18,4 @@
* = default_compat
! option = compat
- my_option = +some:compat
+ my_option = |some:compat
diff --git a/test/rules-file.c b/test/rules-file.c
index ee53f09..67a000e 100644
--- a/test/rules-file.c
+++ b/test/rules-file.c
@@ -110,7 +110,7 @@ main(void)
.options = "my_option",
.keycodes = "my_keycodes", .types = "my_types",
- .compat = "my_compat+some:compat",
+ .compat = "my_compat|some:compat",
.symbols = "my_symbols+extra_variant",
};
assert(test_rules(ctx, &test1));