diff --git a/kbd-1.12-be-nice-to-kdm.diff b/kbd-1.12-be-nice-to-kdm.diff index 0c7d3fc..0c91243 100644 --- a/kbd-1.12-be-nice-to-kdm.diff +++ b/kbd-1.12-be-nice-to-kdm.diff @@ -52,157 +52,3 @@ if (i) { fprintf(stderr, "%s: putfont: %d,%dx%d: failed: %d\n", progname, count, width, height, i); perror("putfont: PIO_FONT"); ---- kbd-1.12/man/man1/loadkeys.1.in.orig 2005-03-04 19:10:30.000000000 +0000 -+++ kbd-1.12/man/man1/loadkeys.1.in 2005-03-04 19:11:13.000000000 +0000 -@@ -7,6 +7,10 @@ - [ - .I -c --clearcompose - ] [ -+.I -C '' -+| -+.I --console=cons1,cons2,... -+] [ - .I -d --default - ] [ - .I -h --help -@@ -28,6 +32,11 @@ - reads the file or files specified by - .IR filename... . - Its main purpose is to load the kernel keymap for the console. -+The affected console device or devices can be specified using the -+.I -C -+(or -+.I --console -+) option. This option supports a list of device names - .SH "RESET TO DEFAULT" - If the - .I -d ---- kbd-1.12/src/loadkeys.y.orig 2005-03-08 17:55:08.000000000 +0000 -+++ kbd-1.12/src/loadkeys.y 2005-03-08 17:10:06.000000000 +0000 -@@ -62,7 +62,7 @@ - static void compose(int diacr, int base, int res); - static void do_constant(void); - static void do_constant_key (int, u_short); --static void loadkeys(void); -+static void loadkeys(char *console, int *warned); - static void mktable(void); - static void strings_as_usual(void); - static void keypad_as_usual(char *keyboard); -@@ -250,6 +250,8 @@ - "valid options are:\n" - "\n" - " -c --clearcompose clear kernel compose table\n" -+" -C \n" -+" --console=<...> Indicate console device(s) to be used.\n" - " -d --default load \"" DEFMAP "\"\n" - " -h --help display this help text\n" - " -m --mktable output a \"defkeymap.c\" to stdout\n" -@@ -269,9 +271,10 @@ - - int - main(unsigned int argc, char *argv[]) { -- const char *short_opts = "cdhmsuqvV"; -+ const char *short_opts = "cC:dhmsuqvV"; - const struct option long_opts[] = { - { "clearcompose", no_argument, NULL, 'c' }, -+ { "console", 1, NULL, 'C' }, - { "default", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - { "mktable", no_argument, NULL, 'm' }, -@@ -283,6 +286,8 @@ - { NULL, 0, NULL, 0 } - }; - int c; -+ char *console = NULL; -+ int warned = 0; - - set_progname(argv[0]); - -@@ -292,6 +297,9 @@ - case 'c': - nocompose = 1; - break; -+ case 'C': -+ console = optarg; -+ break; - case 'd': - optd = 1; - break; -@@ -330,8 +338,26 @@ - do_constant(); - if(optm) - mktable(); -+ else if (console) -+ { -+ char *buf = strdup(console); /* make writable */ -+ char *e, *s = buf; -+ while (*s) -+ { -+ while ( *s == ' ' || *s == '\t' || *s == ',') s++; -+ e = s; -+ while (*e && *e != ' ' && *e != '\t' && *e != ',') e++; -+ char c = *e; -+ *e = '\0'; -+ if (verbose) printf("%s\n", s); -+ loadkeys(s, &warned); -+ *e = c; -+ s = e; -+ } -+ free(buf); -+ } - else -- loadkeys(); -+ loadkeys(NULL, &warned); - exit(0); - } - -@@ -760,7 +786,7 @@ - } - - static int --defkeys(int fd) { -+defkeys(int fd, char *cons, int *warned) { - struct kbentry ke; - int ct = 0; - int i,j,fail; -@@ -845,9 +871,21 @@ - fprintf(stderr, _("%s: failed to restore keyboard mode\n"), - progname); - } -- fprintf(stderr, _("%s: warning: this map uses Unicode symbols\n" -- " (perhaps you want to do `kbd_mode -u'?)\n"), -- progname); -+ -+ if (!warned++) -+ { -+ int kd_mode = -1; -+ if (ioctl(fd, KDGETMODE, &kd_mode) || (kd_mode != KD_GRAPHICS)) -+ { -+ /* -+ * It is okay for the graphics console to have a non-unicode mode. -+ * only talk about other consoles -+ */ -+ fprintf(stderr, _("%s: warning: this map uses Unicode symbols, %s mode=%d\n" -+ " (perhaps you want to do `kbd_mode -u'?)\n"), -+ progname, cons ? cons : "NULL", kd_mode); -+ } -+ } - } - return ct; - } -@@ -981,12 +1019,12 @@ - } - - static void --loadkeys (void) { -+loadkeys (char *console, int *warned) { - int fd; - int keyct, funcct, diacct; - -- fd = getfd(NULL); -- keyct = defkeys(fd); -+ fd = getfd(console); -+ keyct = defkeys(fd, console, &warned); - funcct = deffuncs(fd); - if (accent_table_size > 0 || nocompose) - diacct = defdiacs(fd); diff --git a/kbd-1.12-loadkeys-C-opt.diff b/kbd-1.12-loadkeys-C-opt.diff new file mode 100644 index 0000000..0b63e69 --- /dev/null +++ b/kbd-1.12-loadkeys-C-opt.diff @@ -0,0 +1,154 @@ +--- kbd-1.12/man/man1/loadkeys.1.in.orig 2005-03-04 19:10:30.000000000 +0000 ++++ kbd-1.12/man/man1/loadkeys.1.in 2005-03-04 19:11:13.000000000 +0000 +@@ -7,6 +7,10 @@ + [ + .I -c --clearcompose + ] [ ++.I -C '' ++| ++.I --console=cons1,cons2,... ++] [ + .I -d --default + ] [ + .I -h --help +@@ -28,6 +32,11 @@ + reads the file or files specified by + .IR filename... . + Its main purpose is to load the kernel keymap for the console. ++The affected console device or devices can be specified using the ++.I -C ++(or ++.I --console ++) option. This option supports a list of device names + .SH "RESET TO DEFAULT" + If the + .I -d +--- kbd-1.12/src/loadkeys.y.orig 2005-03-08 17:55:08.000000000 +0000 ++++ kbd-1.12/src/loadkeys.y 2005-03-08 17:10:06.000000000 +0000 +@@ -62,7 +62,7 @@ + static void compose(int diacr, int base, int res); + static void do_constant(void); + static void do_constant_key (int, u_short); +-static void loadkeys(void); ++static void loadkeys(char *console, int *warned); + static void mktable(void); + static void strings_as_usual(void); + static void keypad_as_usual(char *keyboard); +@@ -250,6 +250,8 @@ + "valid options are:\n" + "\n" + " -c --clearcompose clear kernel compose table\n" ++" -C \n" ++" --console=<...> Indicate console device(s) to be used.\n" + " -d --default load \"" DEFMAP "\"\n" + " -h --help display this help text\n" + " -m --mktable output a \"defkeymap.c\" to stdout\n" +@@ -269,9 +271,10 @@ + + int + main(unsigned int argc, char *argv[]) { +- const char *short_opts = "cdhmsuqvV"; ++ const char *short_opts = "cC:dhmsuqvV"; + const struct option long_opts[] = { + { "clearcompose", no_argument, NULL, 'c' }, ++ { "console", 1, NULL, 'C' }, + { "default", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + { "mktable", no_argument, NULL, 'm' }, +@@ -283,6 +286,8 @@ + { NULL, 0, NULL, 0 } + }; + int c; ++ char *console = NULL; ++ int warned = 0; + + set_progname(argv[0]); + +@@ -292,6 +297,9 @@ + case 'c': + nocompose = 1; + break; ++ case 'C': ++ console = optarg; ++ break; + case 'd': + optd = 1; + break; +@@ -330,8 +338,26 @@ + do_constant(); + if(optm) + mktable(); ++ else if (console) ++ { ++ char *buf = strdup(console); /* make writable */ ++ char *e, *s = buf; ++ while (*s) ++ { ++ while ( *s == ' ' || *s == '\t' || *s == ',') s++; ++ e = s; ++ while (*e && *e != ' ' && *e != '\t' && *e != ',') e++; ++ char c = *e; ++ *e = '\0'; ++ if (verbose) printf("%s\n", s); ++ loadkeys(s, &warned); ++ *e = c; ++ s = e; ++ } ++ free(buf); ++ } + else +- loadkeys(); ++ loadkeys(NULL, &warned); + exit(0); + } + +@@ -760,7 +786,7 @@ + } + + static int +-defkeys(int fd) { ++defkeys(int fd, char *cons, int *warned) { + struct kbentry ke; + int ct = 0; + int i,j,fail; +@@ -845,9 +871,21 @@ + fprintf(stderr, _("%s: failed to restore keyboard mode\n"), + progname); + } +- fprintf(stderr, _("%s: warning: this map uses Unicode symbols\n" +- " (perhaps you want to do `kbd_mode -u'?)\n"), +- progname); ++ ++ if (!warned++) ++ { ++ int kd_mode = -1; ++ if (ioctl(fd, KDGETMODE, &kd_mode) || (kd_mode != KD_GRAPHICS)) ++ { ++ /* ++ * It is okay for the graphics console to have a non-unicode mode. ++ * only talk about other consoles ++ */ ++ fprintf(stderr, _("%s: warning: this map uses Unicode symbols, %s mode=%d\n" ++ " (perhaps you want to do `kbd_mode -u'?)\n"), ++ progname, cons ? cons : "NULL", kd_mode); ++ } ++ } + } + return ct; + } +@@ -981,12 +1019,12 @@ + } + + static void +-loadkeys (void) { ++loadkeys (char *console, int *warned) { + int fd; + int keyct, funcct, diacct; + +- fd = getfd(NULL); +- keyct = defkeys(fd); ++ fd = getfd(console); ++ keyct = defkeys(fd, console, &warned); + funcct = deffuncs(fd); + if (accent_table_size > 0 || nocompose) + diacct = defdiacs(fd); diff --git a/kbd-1.12-setfont-no-cruft.diff b/kbd-1.12-setfont-no-cruft.diff new file mode 100644 index 0000000..a9f489f --- /dev/null +++ b/kbd-1.12-setfont-no-cruft.diff @@ -0,0 +1,44 @@ +--- kbd-1.12/src/kdfontop.c.orig 2007-08-21 19:28:47.000000000 +0200 ++++ kbd-1.12/src/kdfontop.c 2007-08-21 19:32:50.000000000 +0200 +@@ -268,26 +268,19 @@ + return 0; + } + +- /* Second attempt: PIO_FONTX */ +- cfd.charcount = count; +- cfd.charheight = height; +- cfd.chardata = buf; +- i = ioctl(fd, PIO_FONTX, &cfd); +- if (i == 0) +- return 0; +- if (errno != ENOSYS && errno != EINVAL) { +- fprintf(stderr, "%s: putfont: %d,%dx%d:failed: %d\n", progname, count, width, height, i); +- perror("putfont: PIO_FONTX"); +- return -1; +- } +- +- /* Third attempt: PIO_FONT */ +- /* This will load precisely 256 chars, independent of count */ +- i = ioctl(fd, PIO_FONT, buf); +- if (i) { +- fprintf(stderr, "%s: putfont: %d,%dx%d: failed: %d\n", progname, count, width, height, i); +- perror("putfont: PIO_FONT"); +- return -1; +- } +- return 0; ++ // We no longer try PIO_FONT* calls. ++ // A former patch even added a possible 5 seconds delay loop here, in an attempt to ++ // gain victory over kdm. We no do this fight, as it can only result in races. ++ // https://bugzilla.novell.com/show_bug.cgi?id=302010 ++ // ++ // Two effects: ++ // a) Without the delay loop, we are fast enough to run early. ++ // Moving setfont calls to an earlier point most likly ++ // avoids the race. ++ // b) Without the old compat calls, it should be easier to ++ // fix this in kernel side. ++ // ++ fprintf(stderr, "%s: putfont: %d,%dx%d: failed: %d\n", progname, count, width, height, i); ++ perror("putfont: KDFONTOP"); ++ return -1; + } diff --git a/kbd.changes b/kbd.changes index 55bc9aa..25cc35e 100644 --- a/kbd.changes +++ b/kbd.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Aug 21 19:53:59 CEST 2007 - jw@suse.de + +- cleaned up setfont according to bugzilla #302010 + ------------------------------------------------------------------- Thu Aug 16 12:56:42 CEST 2007 - jw@suse.de diff --git a/kbd.spec b/kbd.spec index 5958b49..40ab460 100644 --- a/kbd.spec +++ b/kbd.spec @@ -16,7 +16,7 @@ License: GPL v2 or later Group: System/Console Autoreqprov: on Version: 1.12 -Release: 129 +Release: 132 Summary: Keyboard and Font Utilities Source: ftp://ftp.win.tue.nl/pub/home/aeb/linux-local/utils/kbd/%{name}-%{version}.tar.bz2 Source1: kbd_fonts.tar.bz2 @@ -47,7 +47,7 @@ Patch14: kbd-%{version}-cz-us-qwertz.diff Patch15: kbd-%{version}-nounicode-nontty.diff Patch16: kbd-%{version}-kbd_mode.diff Patch17: piofont_debug.diff -Patch18: kbd-%{version}-be-nice-to-kdm.diff +Patch18: kbd-%{version}-loadkeys-C-opt.diff Patch19: kbd-%{version}-happy-abuild.diff Patch20: kbd-%{version}-strip.diff Patch21: kbd-%{version}-setfont-fpclose.diff @@ -55,6 +55,8 @@ Patch22: kbd-%{version}-showconsolefont-info.diff Patch23: kbd-%{version}-docu-X11R6-xorg.diff Patch24: kbd-%{version}-el-locale-update.diff Patch25: sv-latin1-keycode10.diff +Patch26: kbd-%{version}-setfont-no-cruft.diff +Patch27: kbd-%{version}-be-nice-to-kdm.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: %fillup_prereq %insserv_prereq BuildRequires: bison flex @@ -106,6 +108,8 @@ Authors: %patch23 -p1 %patch24 %patch25 -p1 +%patch26 -p1 +# %patch27 -p1 # obsoleted. #302010 %build for i in `find data/keymaps/mac -type f` ; do @@ -318,6 +322,8 @@ rm -rf $RPM_BUILD_ROOT #rm -rf $RPM_BUILD_DIR/kbd-%{version} %changelog +* Tue Aug 21 2007 - jw@suse.de +- cleaned up setfont according to bugzilla #302010 * Thu Aug 16 2007 - jw@suse.de - fixed fix of bugzilla #300076 (fillup_and_insserv is too ugly)