[kbd] [PATCH] src/libkeymap: add support for parsing more unicode values

Alexey Gladkov gladkov.alexey at gmail.com
Mon Mar 1 17:09:39 MSK 2021


On Sat, Feb 27, 2021 at 03:36:11PM +0100, Anisse Astier wrote:
> The auto-generated (with ckbcomp) file fr-bepo_afnor did not load (even
> partially), because of an U+1f12f (copyleft symbol) that is wrongly
> parsed, generating this error message:
> 
> 	too many (160) entries on one line
> 
> Fix libkeymap so that the keymap can be parsed, even if the offending
> character won't be loaded because of the ushort limitation of the
> kb_value KDSKBENT uapi.
> 
> It's better to have the keymap partially loaded than not at all.

Nop. Partially keymap loading is very dangerous. You can get a completely
unusable console. The libkeymap shouldn't break the console if it is known
in advance that the keymap is not correct. You should fix ckbcomp so that
it generates the correct keymap.

> Signed-off-by: Anisse Astier <anisse at astier.eu>
> Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=968195
> ---
>  src/libkeymap/analyze.l | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libkeymap/analyze.l b/src/libkeymap/analyze.l
> index 9e76eae..4bdffb4 100644
> --- a/src/libkeymap/analyze.l
> +++ b/src/libkeymap/analyze.l
> @@ -319,7 +319,7 @@ Include			include[ \t]*
>  Decimal			[1-9][0-9]*
>  Octal			0[0-7]*
>  Hex			0[xX][0-9a-fA-F]+
> -Unicode			U\+([0-9a-fA-F]){4}
> +Unicode			U\+([0-9a-fA-F]){4,6}
>  Literal			[a-zA-Z][a-zA-Z_0-9]*
>  Octa			([0-7]){1,3}
>  Charset			charset|Charset|CharSet|CHARSET
> @@ -404,7 +404,7 @@ To                      to|To|TO
>  				if (parse_int(yyextra, yytext, yytext + 1, 16, &(yylval->num)) < 0)
>  					return(ERROR);
>  
> -				if (yylval->num >= 0xf000) {
> +				if (yylval->num >= 0x10ffff) {
>  					ERR(yyextra, _("unicode keysym out of range: %s"),
>  						yytext);
>  					return(ERROR);
> -- 
> 2.29.2
> 

-- 
Rgrds, legion



More information about the kbd mailing list