summaryrefslogtreecommitdiff
path: root/src/locale
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2023-03-08 09:11:22 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-03-08 19:44:12 +0900
commit82c2095a5e407bcf041dc7bde84791deec95ff9c (patch)
tree3d6ba41a318b88b159c15b409199721686e14280 /src/locale
parent81707069fc0e6b5fc28752a625695e226e136e3b (diff)
downloadsystemd-82c2095a5e407bcf041dc7bde84791deec95ff9c.tar.gz
localed: skip verification when libxkbcommon is not installed
When compliled without libxkbcommon, we do no verification and accept the arguments as given. When compliled against with, if dlopen() works, we do the verification. But if dlopen() fails, we would refuse the call and return SD_BUS_ERROR_INVALID_ARGS. 5de344704df64d8f31448f1222432bc87ddcfbef added things this way when converting to dlopen(), but it seems not very useful: it can be expected that when the library is supported but missing at runtime, we degrade softly, and that the behaviour is something inbetween the cases of hard disable at compilation time and full support. But right now we behave more strictly then if disabled at compilation. Change the code to just warn if dlopen fails, but accept the arguments. (There are various minimization scenarios where forcing the installation of libxkbcommon is not useful. E.g. a small installation where we want to set the keymap via logind, but the configuration is managed by a configuration management system and is known to be valid. Verification via libxkbcommon is just overhead in this case.) 800f65f827c9828d4c872d44b19ca8a008505690 moved the check earlier, so now even a noop case of setting the values that were already in place can fail. C.f. https://bugzilla.redhat.com/show_bug.cgi?id=2175244.
Diffstat (limited to 'src/locale')
-rw-r--r--src/locale/localed.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/locale/localed.c b/src/locale/localed.c
index 267f27635b..0e1680d72a 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -614,13 +614,13 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err
r = verify_xkb_rmlvo(in.model, in.layout, in.variant, in.options);
if (r < 0) {
- log_error_errno(r, "Cannot compile XKB keymap for new x11 keyboard layout ('%s' / '%s' / '%s' / '%s'): %m",
- strempty(in.model), strempty(in.layout), strempty(in.variant), strempty(in.options));
+ log_full_errno(r == -EOPNOTSUPP ? LOG_NOTICE : LOG_ERR, r,
+ "Cannot compile XKB keymap for new x11 keyboard layout ('%s' / '%s' / '%s' / '%s'): %m",
+ strempty(in.model), strempty(in.layout), strempty(in.variant), strempty(in.options));
- if (r == -EOPNOTSUPP)
- return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, "Local keyboard configuration not supported on this system.");
-
- return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Specified keymap cannot be compiled, refusing as invalid.");
+ if (r != -EOPNOTSUPP)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
+ "Specified keymap cannot be compiled, refusing as invalid.");
}
r = vconsole_read_data(c, m);