diff --git a/doc/message-registry.md b/doc/message-registry.md index b126aee1..8ff1c9ee 100644 --- a/doc/message-registry.md +++ b/doc/message-registry.md @@ -6,7 +6,7 @@ NOTE: This file has been generated automatically by “update-message-registry.p --> This page lists the warnings and errors generated by xkbcommon. -There are currently 57 entries. +There are currently 60 entries. @todo The documentation of the log messages is a work in progress. @@ -23,6 +23,7 @@ There are currently 57 entries. | [XKB-123] | `undeclared-virtual-modifier` | A virtual modifier is used before being declared | Error | | [XKB-134] | `insufficient-buffer-size` | A buffer has an insufficient size | Error | | [XKB-150] | `wrong-statement-type` | The type of the statement is not allowed in the context | Error | +| [XKB-161] | `invalid-path` | The given path is invalid | Error | | [XKB-172] | `unsupported-geometry-section` | Geometry sections are not supported | Warning | | [XKB-183] | `cannot-infer-key-type` | Warn if no key type can be inferred | Warning | | [XKB-193] | `invalid-escape-sequence` | Invalid escape sequence in a string | Warning | @@ -52,6 +53,7 @@ There are currently 57 entries. | [XKB-523] | `conflicting-key-name` | Conflicting definitions of a key name or alias | Warning | | [XKB-550] | `allocation-error` | Cannot allocate memory | Error | | [XKB-578] | `wrong-field-type` | Warn when a field has not the expected type | Error | +| [XKB-595] | `cannot-resolve-rmlvo` | Cannot resolve a given (Rules, Model, Layout, Variant, Options) configuration | Error | | [XKB-623] | `invalid-real-modifier` | Invalid _real_ modifier | Error | | [XKB-645] | `unknown-char-escape-sequence` | Warn on unknown escape sequence in string literal | Warning | | [XKB-661] | `invalid-included-file` | The target file of an include statement could not be processed | Error | @@ -63,6 +65,7 @@ There are currently 57 entries. | [XKB-796] | `invalid-value` | A value is invalid and will be ignored | Error | | [XKB-800] | `conflicting-modmap` | Warn if there are conflicting modmap definitions | Warning | | [XKB-812] | `unknown-field` | A field is unknown and will be ignored | Error | +| [XKB-822] | `keymap-compilation-failed` | Keymap compilation failed | Error | | [XKB-883] | `conflicting-key-action` | Warn if there are conflicting actions while merging keys | Warning | | [XKB-893] | `conflicting-key-type-merging-groups` | Warn if there are conflicting key types while merging groups | Warning | | [XKB-901] | `conflicting-key-symbols-entry` | Conflicting symbols entry for a key | Error | @@ -195,6 +198,14 @@ key {[ comma, semicolon, periodcentered, multiply ]};
Summary
The type of the statement is not allowed in the context
+### XKB-161 – Invalid path {#XKB-161} + +
+
Since
1.0.0
+
Type
Error
+
Summary
The given path is invalid
+
+ ### XKB-172 – Unsupported geometry section {#XKB-172}
@@ -538,6 +549,14 @@ key { [ U1ED0 ] };
Summary
Warn when a field has not the expected type
+### XKB-595 – Cannot resolve rmlvo {#XKB-595} + +
+
Since
1.0.0
+
Type
Error
+
Summary
Cannot resolve a given (Rules, Model, Layout, Variant, Options) configuration
+
+ ### XKB-623 – Invalid real modifier {#XKB-623}
@@ -644,6 +663,14 @@ xkbcommon support the following escape sequences in string literals:
Summary
A field is unknown and will be ignored
+### XKB-822 – Keymap compilation failed {#XKB-822} + +
+
Since
1.0.0
+
Type
Error
+
Summary
Keymap compilation failed
+
+ ### XKB-883 – Conflicting key action {#XKB-883}
@@ -721,6 +748,7 @@ The modifiers used in `map` or `preserve` entries should be declared using the e [XKB-123]: @ref XKB-123 [XKB-134]: @ref XKB-134 [XKB-150]: @ref XKB-150 +[XKB-161]: @ref XKB-161 [XKB-172]: @ref XKB-172 [XKB-183]: @ref XKB-183 [XKB-193]: @ref XKB-193 @@ -750,6 +778,7 @@ The modifiers used in `map` or `preserve` entries should be declared using the e [XKB-523]: @ref XKB-523 [XKB-550]: @ref XKB-550 [XKB-578]: @ref XKB-578 +[XKB-595]: @ref XKB-595 [XKB-623]: @ref XKB-623 [XKB-645]: @ref XKB-645 [XKB-661]: @ref XKB-661 @@ -761,6 +790,7 @@ The modifiers used in `map` or `preserve` entries should be declared using the e [XKB-796]: @ref XKB-796 [XKB-800]: @ref XKB-800 [XKB-812]: @ref XKB-812 +[XKB-822]: @ref XKB-822 [XKB-883]: @ref XKB-883 [XKB-893]: @ref XKB-893 [XKB-901]: @ref XKB-901 diff --git a/doc/message-registry.yaml b/doc/message-registry.yaml index 7445aafc..aecc7031 100644 --- a/doc/message-registry.yaml +++ b/doc/message-registry.yaml @@ -95,6 +95,11 @@ added: ALWAYS type: error description: "The type of the statement is not allowed in the context" +- id: "invalid-path" + code: 161 + added: ALWAYS + type: error + description: "The given path is invalid" - id: "unsupported-geometry-section" code: 172 added: ALWAYS @@ -312,6 +317,11 @@ added: ALWAYS type: error description: "Warn when a field has not the expected type" +- id: "cannot-resolve-rmlvo" + code: 595 + added: ALWAYS + type: error + description: "Cannot resolve a given (Rules, Model, Layout, Variant, Options) configuration" - id: "invalid-real-modifier" code: 623 added: ALWAYS @@ -383,6 +393,11 @@ added: ALWAYS type: error description: "A field is unknown and will be ignored" +- id: "keymap-compilation-failed" + code: 822 + added: ALWAYS + type: error + description: "Keymap compilation failed" - id: "conflicting-key-action" code: 883 added: ALWAYS diff --git a/src/messages-codes.h b/src/messages-codes.h index a60c5430..1d9e4102 100644 --- a/src/messages-codes.h +++ b/src/messages-codes.h @@ -63,6 +63,8 @@ enum xkb_message_code { XKB_ERROR_INSUFFICIENT_BUFFER_SIZE = 134, /** The type of the statement is not allowed in the context */ XKB_ERROR_WRONG_STATEMENT_TYPE = 150, + /** The given path is invalid */ + XKB_ERROR_INVALID_PATH = 161, /** Geometry sections are not supported */ XKB_WARNING_UNSUPPORTED_GEOMETRY_SECTION = 172, /** Warn if no key type can be inferred */ @@ -121,6 +123,8 @@ enum xkb_message_code { XKB_ERROR_ALLOCATION_ERROR = 550, /** Warn when a field has not the expected type */ XKB_ERROR_WRONG_FIELD_TYPE = 578, + /** Cannot resolve a given (Rules, Model, Layout, Variant, Options) configuration */ + XKB_ERROR_CANNOT_RESOLVE_RMLVO = 595, /** Invalid _real_ modifier */ XKB_ERROR_INVALID_REAL_MODIFIER = 623, /** Warn on unknown escape sequence in string literal */ @@ -143,6 +147,8 @@ enum xkb_message_code { XKB_WARNING_CONFLICTING_MODMAP = 800, /** A field is unknown and will be ignored */ XKB_ERROR_UNKNOWN_FIELD = 812, + /** Keymap compilation failed */ + XKB_ERROR_KEYMAP_COMPILATION_FAILED = 822, /** Warn if there are conflicting actions while merging keys */ XKB_WARNING_CONFLICTING_KEY_ACTION = 883, /** Warn if there are conflicting key types while merging groups */ diff --git a/src/registry.c b/src/registry.c index 80b25513..ea5aa80f 100644 --- a/src/registry.c +++ b/src/registry.c @@ -583,8 +583,13 @@ rxkb_context_include_path_append(struct rxkb_context *ctx, const char *path) * where this is the wrong behaviour aren't worth worrying about. */ if (!snprintf_safe(rules, sizeof(rules), "%s/rules/%s.xml", - path, DEFAULT_XKB_RULES)) + path, DEFAULT_XKB_RULES)) { + log_err(ctx, XKB_ERROR_INVALID_PATH, + "Path is too long: expected max length of %zu, " + "got: %s/rules/%s.xml\n", + sizeof(rules), path, DEFAULT_XKB_RULES); return false; + } tmp = strdup(path); if (!tmp) @@ -1140,7 +1145,7 @@ xml_error_func(void *ctx, const char *msg, ...) /* This shouldn't really happen */ if (rc < 0) { - log_err(ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(ctx, XKB_ERROR_INSUFFICIENT_BUFFER_SIZE, "+++ out of cheese error. redo from start +++\n"); slen = 0; memset(buf, 0, sizeof(buf)); diff --git a/src/xkbcomp/include.c b/src/xkbcomp/include.c index 92571008..96e17755 100644 --- a/src/xkbcomp/include.c +++ b/src/xkbcomp/include.c @@ -251,10 +251,11 @@ FindFileInXkbPath(struct xkb_context *ctx, const char *name, if (!snprintf_safe(buf, sizeof(buf), "%s/%s/%s", xkb_context_include_path_get(ctx, i), typeDir, name)) { - log_err(ctx, XKB_ERROR_INSUFFICIENT_BUFFER_SIZE, - "Path is too long: expected max length of %lu, got: %s/%s/%s\n", - (unsigned long int) sizeof(buf), - xkb_context_include_path_get(ctx, i), typeDir, name); + log_err(ctx, XKB_ERROR_INVALID_PATH, + "Path is too long: expected max length of %zu, " + "got: %s/%s/%s\n", + sizeof(buf), xkb_context_include_path_get(ctx, i), + typeDir, name); continue; } diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c index 66bd278a..e5c54ff1 100644 --- a/src/xkbcomp/rules.c +++ b/src/xkbcomp/rules.c @@ -1214,8 +1214,11 @@ xkb_components_from_rules(struct xkb_context *ctx, unsigned int offset = 0; file = FindFileInXkbPath(ctx, rmlvo->rules, FILE_TYPE_RULES, &path, &offset); - if (!file) + if (!file) { + log_err(ctx, XKB_ERROR_CANNOT_RESOLVE_RMLVO, + "Cannot load XKB rules \"%s\"\n", rmlvo->rules); goto err_out; + } matcher = matcher_new(ctx, rmlvo); @@ -1226,7 +1229,7 @@ xkb_components_from_rules(struct xkb_context *ctx, darray_empty(matcher->kccgst[KCCGST_COMPAT]) || /* darray_empty(matcher->kccgst[KCCGST_GEOMETRY]) || */ darray_empty(matcher->kccgst[KCCGST_SYMBOLS])) { - log_err(ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(ctx, XKB_ERROR_CANNOT_RESOLVE_RMLVO, "No components returned from XKB rules \"%s\"\n", path); ret = false; goto err_out; @@ -1240,22 +1243,22 @@ xkb_components_from_rules(struct xkb_context *ctx, mval = &matcher->rmlvo.model; if (!mval->matched && mval->sval.len > 0) - log_err(matcher->ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(matcher->ctx, XKB_ERROR_CANNOT_RESOLVE_RMLVO, "Unrecognized RMLVO model \"%.*s\" was ignored\n", mval->sval.len, mval->sval.start); darray_foreach(mval, matcher->rmlvo.layouts) if (!mval->matched && mval->sval.len > 0) - log_err(matcher->ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(matcher->ctx, XKB_ERROR_CANNOT_RESOLVE_RMLVO, "Unrecognized RMLVO layout \"%.*s\" was ignored\n", mval->sval.len, mval->sval.start); darray_foreach(mval, matcher->rmlvo.variants) if (!mval->matched && mval->sval.len > 0) - log_err(matcher->ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(matcher->ctx, XKB_ERROR_CANNOT_RESOLVE_RMLVO, "Unrecognized RMLVO variant \"%.*s\" was ignored\n", mval->sval.len, mval->sval.start); darray_foreach(mval, matcher->rmlvo.options) if (!mval->matched && mval->sval.len > 0) - log_err(matcher->ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(matcher->ctx, XKB_ERROR_CANNOT_RESOLVE_RMLVO, "Unrecognized RMLVO option \"%.*s\" was ignored\n", mval->sval.len, mval->sval.start); diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c index c3ff76d2..17364be3 100644 --- a/src/xkbcomp/xkbcomp.c +++ b/src/xkbcomp/xkbcomp.c @@ -36,14 +36,14 @@ static bool compile_keymap_file(struct xkb_keymap *keymap, XkbFile *file) { if (file->file_type != FILE_TYPE_KEYMAP) { - log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(keymap->ctx, XKB_ERROR_KEYMAP_COMPILATION_FAILED, "Cannot compile a %s file alone into a keymap\n", xkb_file_type_to_string(file->file_type)); return false; } if (!CompileKeymap(file, keymap, MERGE_OVERRIDE)) { - log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(keymap->ctx, XKB_ERROR_KEYMAP_COMPILATION_FAILED, "Failed to compile keymap\n"); return false; } @@ -67,7 +67,7 @@ text_v1_keymap_new_from_names(struct xkb_keymap *keymap, ok = xkb_components_from_rules(keymap->ctx, rmlvo, &kccgst); if (!ok) { - log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(keymap->ctx, XKB_ERROR_KEYMAP_COMPILATION_FAILED, "Couldn't look up rules '%s', model '%s', layout '%s', " "variant '%s', options '%s'\n", rmlvo->rules, rmlvo->model, rmlvo->layout, rmlvo->variant, @@ -88,7 +88,7 @@ text_v1_keymap_new_from_names(struct xkb_keymap *keymap, free(kccgst.symbols); if (!file) { - log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(keymap->ctx, XKB_ERROR_KEYMAP_COMPILATION_FAILED, "Failed to generate parsed XKB file from components\n"); return false; } @@ -107,7 +107,7 @@ text_v1_keymap_new_from_string(struct xkb_keymap *keymap, xkb_file = XkbParseString(keymap->ctx, string, len, "(input string)", NULL); if (!xkb_file) { - log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(keymap->ctx, XKB_ERROR_KEYMAP_COMPILATION_FAILED, "Failed to parse input xkb string\n"); return false; } @@ -125,7 +125,7 @@ text_v1_keymap_new_from_file(struct xkb_keymap *keymap, FILE *file) xkb_file = XkbParseFile(keymap->ctx, file, "(unknown file)", NULL); if (!xkb_file) { - log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID, + log_err(keymap->ctx, XKB_ERROR_KEYMAP_COMPILATION_FAILED, "Failed to parse input xkb file\n"); return false; } diff --git a/tools/messages.c b/tools/messages.c index d9823212..e8dd4a76 100644 --- a/tools/messages.c +++ b/tools/messages.c @@ -47,6 +47,7 @@ static const struct xkb_message_entry xkb_messages[] = { {XKB_ERROR_UNDECLARED_VIRTUAL_MODIFIER, "Undeclared virtual modifier"}, {XKB_ERROR_INSUFFICIENT_BUFFER_SIZE, "Insufficient buffer size"}, {XKB_ERROR_WRONG_STATEMENT_TYPE, "Wrong statement type"}, + {XKB_ERROR_INVALID_PATH, "Invalid path"}, {XKB_WARNING_UNSUPPORTED_GEOMETRY_SECTION, "Unsupported geometry section"}, {XKB_WARNING_CANNOT_INFER_KEY_TYPE, "Cannot infer key type"}, {XKB_WARNING_INVALID_ESCAPE_SEQUENCE, "Invalid escape sequence"}, @@ -76,6 +77,7 @@ static const struct xkb_message_entry xkb_messages[] = { {XKB_WARNING_CONFLICTING_KEY_NAME, "Conflicting key name"}, {XKB_ERROR_ALLOCATION_ERROR, "Allocation error"}, {XKB_ERROR_WRONG_FIELD_TYPE, "Wrong field type"}, + {XKB_ERROR_CANNOT_RESOLVE_RMLVO, "Cannot resolve rmlvo"}, {XKB_ERROR_INVALID_REAL_MODIFIER, "Invalid real modifier"}, {XKB_WARNING_UNKNOWN_CHAR_ESCAPE_SEQUENCE, "Unknown char escape sequence"}, {XKB_ERROR_INVALID_INCLUDED_FILE, "Invalid included file"}, @@ -87,6 +89,7 @@ static const struct xkb_message_entry xkb_messages[] = { {XKB_ERROR_INVALID_VALUE, "Invalid value"}, {XKB_WARNING_CONFLICTING_MODMAP, "Conflicting modmap"}, {XKB_ERROR_UNKNOWN_FIELD, "Unknown field"}, + {XKB_ERROR_KEYMAP_COMPILATION_FAILED, "Keymap compilation failed"}, {XKB_WARNING_CONFLICTING_KEY_ACTION, "Conflicting key action"}, {XKB_WARNING_CONFLICTING_KEY_TYPE_MERGING_GROUPS, "Conflicting key type merging groups"}, {XKB_ERROR_CONFLICTING_KEY_SYMBOLS_ENTRY, "Conflicting key symbols entry"},