Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37810662
en ru br
ALT Linux repositórios
S:2.6.1-alt1
5.0: 1.14.1.20081023-alt1
4.1: 1.13.99-alt5.M41.1
4.0: 1.12.1-alt2
3.0: 1.12-alt2.1
+updates:1.12-alt2.2

Group :: Terminais
RPM: kbd

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: kbd-1.12-alt-plainletter-safer.patch
Download


--- kbd-1.12/src/analyze.l.plainletter	2005-02-26 23:54:23 +0600
+++ kbd-1.12/src/analyze.l	2005-02-27 01:01:05 +0600
@@ -57,6 +57,19 @@
 On			on|On|ON
 To                      to|To|TO
 %%
+%{
+/* To protect from wrong code in the higher level parser (loadkeys.y), 
+ * make sure we do not return a sensible value if we
+ * do not intend to. (So wrong code would crash, or issue an error message.
+ * I mean the code like the one for PLAIN handling in past loadkeys.y.
+ * What to choose as the "bad" value: 0, -1?.. 
+ * Well, make it equal to CODE_FOR_UNKNOWN_KSYM as the most efficient thing.
+ */
+#define YYLVAL_UNDEF CODE_FOR_UNKNOWN_KSYM
+/* Every time yylex is called, initialize the associated
+ * yylval to YYLVAL_UNDEF. Then it might be overwritten by specific rules. */
+  yylval = YYLVAL_UNDEF;
+%}
 {Include}               {BEGIN(INCLSTR);}
 <INCLSTR>\"[^"\n]+\"	{ int l; char *s;
 			 l = strlen(yytext);
--- kbd-1.12/src/ksyms.h.plainletter	2005-02-27 00:15:54 +0600
+++ kbd-1.12/src/ksyms.h	2005-02-27 01:01:39 +0600
@@ -22,6 +22,9 @@
 extern const int syms_size;
 extern const int syn_size;
 
+/* Returned by ksymtocode to report an unknown symbol */
+#define CODE_FOR_UNKNOWN_KSYM (-1)
+
 extern int set_charset(const char *name);
 extern const char *unicodetoksym(int code);
 extern void list_charsets(FILE *f);
--- kbd-1.12/src/ksyms.c.plainletter	2005-02-27 00:16:50 +0600
+++ kbd-1.12/src/ksyms.c	2005-02-27 00:17:03 +0600
@@ -1780,7 +1780,7 @@
 
 	fprintf(stderr, _("unknown keysym '%s'\n"), s);
 
-	return -1;
+	return CODE_FOR_UNKNOWN_KSYM;
 }
 
 int
--- kbd-1.12/src/loadkeys.y.plainletter	2005-02-27 01:00:33 +0600
+++ kbd-1.12/src/loadkeys.y	2005-02-27 00:25:53 +0600
@@ -170,7 +170,7 @@
 			}
 		| PLAIN KEYCODE NUMBER EQUALS rvalue EOL
 			{
-			    addkey($4, 0, $6);
+			    addkey($3, 0, $5);
 			}
 		;
 modifiers	: modifiers modifier
@@ -659,8 +659,10 @@
 addkey(int index, int table, int keycode) {
 	int i;
 
-	if (keycode == -1)
-		return;
+	if (keycode == CODE_FOR_UNKNOWN_KSYM)
+	  /* is safer not to be silent in this case, 
+	   * it can be caused by coding errors as well. */
+	        lkfatal0(_("addkey called with bad keycode %d"), keycode);
         if (index < 0 || index >= NR_KEYS)
 	        lkfatal0(_("addkey called with bad index %d"), index);
         if (table < 0 || table >= MAX_NR_KEYMAPS)
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009