diff --git a/Check-existance-of-map-before-dumping-it.patch b/Check-existance-of-map-before-dumping-it.patch new file mode 100644 index 0000000..90dc5b7 --- /dev/null +++ b/Check-existance-of-map-before-dumping-it.patch @@ -0,0 +1,42 @@ +From 7e665ed238d01917e40430680b1181c668772756 Mon Sep 17 00:00:00 2001 +From: Oleg Bulatov +Date: Wed, 25 Apr 2018 18:19:42 +0200 +Subject: [PATCH] Check existance of map before dumping it + +--- + src/libkeymap/dump.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/src/libkeymap/dump.c b/src/libkeymap/dump.c +index c4e2513..8bc5d70 100644 +--- a/src/libkeymap/dump.c ++++ b/src/libkeymap/dump.c +@@ -520,8 +520,10 @@ no_shorthands: + defs[j] = K(KT_META, KVAL(defs[j - 8])); + + for (j = 0; j < keymapnr; j++) { +- if ((j >= 16 && buf[j] != K_HOLE) || (j < 16 && buf[j] != defs[j])) +- goto unexpected; ++ if (lk_map_exists(ctx, j)) { ++ if ((j >= 16 && buf[j] != K_HOLE) || (j < 16 && buf[j] != defs[j])) ++ goto unexpected; ++ } + } + + isasexpected = 1; +@@ -577,8 +579,10 @@ no_shorthands: + fprintf(fd, "\n"); + + for (j = 1; j < keymapnr; j++) { +- if (buf[j] != buf[0] && !zapped[j]) { +- print_bind(ctx, fd, buf[j], i, j, numeric); ++ if (lk_map_exists(ctx, j)) { ++ if (buf[j] != buf[0] && !zapped[j]) { ++ print_bind(ctx, fd, buf[j], i, j, numeric); ++ } + } + } + } else { +-- +2.21.0.windows.1 + diff --git a/Fix-infinite-loop-of-vlock-if-locked-VC-is-closed.patch b/Fix-infinite-loop-of-vlock-if-locked-VC-is-closed.patch new file mode 100644 index 0000000..054504f --- /dev/null +++ b/Fix-infinite-loop-of-vlock-if-locked-VC-is-closed.patch @@ -0,0 +1,28 @@ +From afb661b80441b6e3fa8cfa3b69f50e4805ebf8be Mon Sep 17 00:00:00 2001 +From: Vitezslav Crhonek +Date: Mon, 14 May 2018 11:21:45 +0200 +Subject: [PATCH] Fix infinite loop of vlock if locked VC is closed + +--- + src/vlock/auth.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/vlock/auth.c b/src/vlock/auth.c +index 25efb5e..4cbc685 100644 +--- a/src/vlock/auth.c ++++ b/src/vlock/auth.c +@@ -140,9 +140,9 @@ int get_password(pam_handle_t *pamh, const char *username, const char *tty) + fflush(stdout); + /* + * EOF encountered on read? +- * If not on VT, check stdin. ++ * Check stdin. + */ +- if (is_vt || isatty(STDIN_FILENO)) { ++ if (isatty(STDIN_FILENO)) { + /* Ignore error. */ + sleep(SHORT_DELAY); + break; +-- +2.21.0.windows.1 + diff --git a/Fix-memory-leak.patch b/Fix-memory-leak.patch new file mode 100644 index 0000000..b4ad502 --- /dev/null +++ b/Fix-memory-leak.patch @@ -0,0 +1,43 @@ +From ca317cb7bd17792ff9f16a3c0eb49e11e963c63f Mon Sep 17 00:00:00 2001 +From: luochunsheng +Date: Sat, 13 Apr 2019 16:24:11 +0800 +Subject: [PATCH] Subject: [PATCH] Fix memory leak + +--- + src/libkeymap/parser.y | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/libkeymap/parser.y b/src/libkeymap/parser.y +index d9efbf8..50c4f14 100644 +--- a/src/libkeymap/parser.y ++++ b/src/libkeymap/parser.y +@@ -11,6 +11,7 @@ + */ + %{ + #define YY_HEADER_EXPORT_START_CONDITIONS 1 ++#define YY_YY_Y_TAB_H_INCLUDED 1 + + #include "config.h" + #include "nls.h" +@@ -411,7 +412,6 @@ lk_parse_keymap(struct lk_ctx *ctx, lkfile_t *f) + + ctx->mod = 0; + +- yylex_init(&scanner); + yylex_init_extra(ctx, &scanner); + + INFO(ctx, _("Loading %s"), f->pathname); +@@ -424,8 +424,9 @@ lk_parse_keymap(struct lk_ctx *ctx, lkfile_t *f) + + rc = 0; + ++fail: + stack_pop(ctx, scanner); + +- fail: yylex_destroy(scanner); ++ yylex_destroy(scanner); + return rc; + } +-- +1.8.3.1 + diff --git a/configure.ac-Fix-logic-of-vlock-configure-switch.patch b/configure.ac-Fix-logic-of-vlock-configure-switch.patch new file mode 100644 index 0000000..771161f --- /dev/null +++ b/configure.ac-Fix-logic-of-vlock-configure-switch.patch @@ -0,0 +1,28 @@ +From f7f357ef079b6d185f340e716d7c72a98d82bad0 Mon Sep 17 00:00:00 2001 +From: Garry Filakhtov +Date: Fri, 20 Jul 2018 15:58:56 +0200 +Subject: [PATCH] configure.ac: Fix logic of vlock configure switch + +Downstream bug report: https://bugs.gentoo.org/661650 + +Signed-off-by: Lars Wendler +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 87eb63c..07098cf 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -119,7 +119,7 @@ AM_CONDITIONAL(BUILD_LIBKEYMAP, test "$BUILD_LIBKEYMAP" = "yes") + + AC_ARG_ENABLE(vlock, + AS_HELP_STRING(--disable-vlock, [do not build vlock]), +- [VLOCK_PROG=no],[VLOCK_PROG=yes]) ++ [VLOCK_PROG=$enableval],[VLOCK_PROG=yes]) + AM_CONDITIONAL(VLOCK, test "$VLOCK_PROG" = "yes") + + if test "$VLOCK_PROG" = "yes"; then +-- +2.21.0.windows.1 + diff --git a/kbd-1.15-keycodes-man.patch b/kbd-1.15-keycodes-man.patch new file mode 100644 index 0000000..8616274 --- /dev/null +++ b/kbd-1.15-keycodes-man.patch @@ -0,0 +1,52 @@ +diff -up kbd-2.0.4/docs/man/man1/showkey.1.orig kbd-2.0.4/docs/man/man1/showkey.1 +--- kbd-2.0.4/docs/man/man1/showkey.1.orig 2016-10-31 16:56:02.000000000 +0100 ++++ kbd-2.0.4/docs/man/man1/showkey.1 2017-01-11 10:45:03.763312393 +0100 +@@ -84,6 +84,19 @@ corresponds to what the keyboard hardwar + to know the scan codes sent by various keys it is better to boot a + 2.4 kernel. Since 2.6.9 there also is the boot option atkbd.softraw=0 + that tells the 2.6 kernel to return the actual scan codes. ++ ++.SH NOTES ++The raw scan codes are available only on AT and PS/2 keyboards, ++and even then they are disabled unless the ++.B atkbd.softraw=0 ++kernel parameter is used. ++When the raw scan codes are not available, the kernel uses a fixed built-in ++table to produce scan codes from keycodes. Thus, ++.BR setkeycodes (8) ++can affect the output of ++.B showkey ++in scan code dump mode. ++ + .SH "SEE ALSO" + .BR loadkeys (1), + .BR dumpkeys (1), +diff -up kbd-2.0.4/docs/man/man8/setkeycodes.8.orig kbd-2.0.4/docs/man/man8/setkeycodes.8 +--- kbd-2.0.4/docs/man/man8/setkeycodes.8.orig 2016-10-31 16:56:02.000000000 +0100 ++++ kbd-2.0.4/docs/man/man8/setkeycodes.8 2017-01-11 10:45:03.763312393 +0100 +@@ -38,6 +38,10 @@ to showkey(1), the command + .RE + will assign the keycode 112 to it, and then loadkeys(1) can be used + to define the function of this key. ++ ++USB keyboards have standardized keycodes and ++.B setkeycodes ++doesn't affect them at all. + .LP + Some older kernels might hardwire a low scancode range to the + equivalent keycodes; setkeycodes will fail when you try to remap +@@ -56,6 +60,14 @@ None. + .SH BUGS + The keycodes of X have nothing to do with those of Linux. + Unusual keys can be made visible under Linux, but not under X. ++ ++.B setkeycodes ++affects only the "first" input device ++that has modifiable scancode-to-keycode mapping. ++If there is more than one such device, ++.B setkeycodes ++cannot change the mapping of other devices than the "first" one. ++ + .SH "SEE ALSO" + .I "dumpkeys (1), loadkeys (1), showkey (1), getkeycodes (8)" + diff --git a/kbd-1.15-sparc.patch b/kbd-1.15-sparc.patch new file mode 100644 index 0000000..6a2c204 --- /dev/null +++ b/kbd-1.15-sparc.patch @@ -0,0 +1,65 @@ +diff -up kbd-2.0.4/docs/man/man8/kbdrate.8.orig kbd-2.0.4/docs/man/man8/kbdrate.8 +--- kbd-2.0.4/docs/man/man8/kbdrate.8.orig 2017-01-11 11:04:50.114831348 +0100 ++++ kbd-2.0.4/docs/man/man8/kbdrate.8 2017-01-11 11:05:35.619851252 +0100 +@@ -22,7 +22,7 @@ Using + without any options will reset the repeat rate to 10.9 characters per second (cps) + and the delay to 250 milliseconds (ms) for Intel- and M68K-based systems. + These are the IBM defaults. On SPARC-based systems it will reset the repeat rate +-to 5 cps and the delay to 200 ms. ++to 20 cps and the delay to 200 ms. + + .SH OPTIONS + .TP +diff -up kbd-2.0.4/src/kbdrate.c.orig kbd-2.0.4/src/kbdrate.c +--- kbd-2.0.4/src/kbdrate.c.orig 2017-01-11 11:05:10.226840148 +0100 ++++ kbd-2.0.4/src/kbdrate.c 2017-01-11 11:05:56.832860537 +0100 +@@ -111,9 +111,12 @@ static int valid_delays[] = { 250, 500, + static int + KDKBDREP_ioctl_ok(double rate, int delay, int silent) + { ++#if defined(KDKBDREP) && !defined(__sparc__) + /* + * This ioctl is defined in but is not + * implemented anywhere - must be in some m68k patches. ++ * We cannot blindly try unimplemented ioctls on sparc64 - ++ * the 32<->64bit transition layer does not like it. + * Since 2.4.9 also on i386. + */ + struct my_kbd_repeat kbdrep_s; +@@ -176,6 +179,9 @@ KDKBDREP_ioctl_ok(double rate, int delay + rate, kbdrep_s.delay); + + return 1; /* success! */ ++#else /* no KDKBDREP or __sparc__ */ ++ return 0; ++#endif /* KDKBDREP */ + } + + #ifndef KIOCSRATE +@@ -226,7 +232,7 @@ sigalrmhandler(int sig __attribute__((un + int main(int argc, char **argv) + { + #ifdef __sparc__ +- double rate = 5.0; /* Default rate */ ++ double rate = 20.0; /* Default rate */ + int delay = 200; /* Default delay */ + #else + double rate = 10.9; /* Default rate */ +@@ -275,8 +281,9 @@ int main(int argc, char **argv) + if (KIOCSRATE_ioctl_ok(rate, delay, silent)) /* sparc? */ + return 0; + +- /* The ioport way */ ++ /* The ioport way - will crash on sparc */ + ++#ifndef __sparc__ + for (i = 0; i < RATE_COUNT; i++) + if (rate * 10 >= valid_rates[i]) { + value &= 0x60; +@@ -333,5 +340,6 @@ int main(int argc, char **argv) + valid_rates[value & 0x1f] / 10.0, + valid_delays[(value & 0x60) >> 5]); + ++#endif + return EXIT_SUCCESS; + } diff --git a/kbd-1.15-unicode_start.patch b/kbd-1.15-unicode_start.patch new file mode 100644 index 0000000..119fe78 --- /dev/null +++ b/kbd-1.15-unicode_start.patch @@ -0,0 +1,21 @@ +diff -up kbd-1.15.2/src/unicode_start.orig kbd-1.15.2/src/unicode_start +--- kbd-1.15.2/src/unicode_start.orig 2011-01-05 13:28:22.079662644 +0100 ++++ kbd-1.15.2/src/unicode_start 2011-01-05 13:29:01.327353698 +0100 +@@ -72,6 +72,9 @@ stty iutf8 + # have a Unicode map attached, or explicitly specified, e.g., + # by giving `def.uni' as a second argument. + ++DEFAULT_UNICODE_FONT=latarcyrheb-sun16 ++# Also drdos8x16 is a good candidate. ++ + case "$#" in + 2) + setfont "$1" -u "$2" +@@ -80,6 +83,7 @@ case "$#" in + setfont "$1" + ;; + 0) ++ setfont $DEFAULT_UNICODE_FONT + ;; + *) + echo "usage: unicode_start [font [unicode map]]" diff --git a/kbd-1.15.3-dumpkeys-man.patch b/kbd-1.15.3-dumpkeys-man.patch new file mode 100644 index 0000000..fc90412 --- /dev/null +++ b/kbd-1.15.3-dumpkeys-man.patch @@ -0,0 +1,18 @@ +diff -up kbd-2.0.4/docs/man/man1/dumpkeys.1.in.orig kbd-2.0.4/docs/man/man1/dumpkeys.1.in +--- kbd-2.0.4/docs/man/man1/dumpkeys.1.in.orig 2017-01-11 11:12:22.884029413 +0100 ++++ kbd-2.0.4/docs/man/man1/dumpkeys.1.in 2017-01-11 11:12:47.537040194 +0100 +@@ -164,6 +164,14 @@ output of + .BI \-S shape " " " " \-\-shape= shape + .LP + .TP ++.B \-1 \-\-separate-lines ++This forces ++.B dumpkeys ++to write one line per (modifier,keycode) pair. It prefixes the word ++.I plain ++for plain keycodes. ++.LP ++.TP + .B \-t \-\-funcs-only + When this option is given, + .B dumpkeys diff --git a/kbd-1.15.5-loadkeys-search-path.patch b/kbd-1.15.5-loadkeys-search-path.patch new file mode 100644 index 0000000..c2013b8 --- /dev/null +++ b/kbd-1.15.5-loadkeys-search-path.patch @@ -0,0 +1,24 @@ +diff -up kbd-2.0.4/src/loadkeys.c.orig kbd-2.0.4/src/loadkeys.c +--- kbd-2.0.4/src/loadkeys.c.orig 2017-01-11 11:14:48.308093019 +0100 ++++ kbd-2.0.4/src/loadkeys.c 2017-01-11 11:15:18.018106020 +0100 +@@ -27,7 +27,7 @@ + #include "keymap.h" + + static const char *progname = NULL; +-static const char *const dirpath1[] = { "", DATADIR "/" KEYMAPDIR "/**", KERNDIR "/", 0 }; ++static const char *const dirpath1[] = { "", DATADIR "/" KEYMAPDIR "/**", DATADIR "/" XKBKEYMAPDIR "/", DATADIR "/" LEGACYKEYMAPDIR "/**", KERNDIR "/", 0 }; + static const char *const suffixes[] = { "", ".kmap", ".map", 0 }; + + static void __attribute__((noreturn)) +diff -up kbd-2.0.4/src/paths.h.orig kbd-2.0.4/src/paths.h +--- kbd-2.0.4/src/paths.h.orig 2017-01-11 11:15:40.404115812 +0100 ++++ kbd-2.0.4/src/paths.h 2017-01-11 11:15:59.730124274 +0100 +@@ -5,6 +5,8 @@ + * The following five subdirectories are defined: + */ + #define KEYMAPDIR "keymaps" ++#define XKBKEYMAPDIR "keymaps/xkb" ++#define LEGACYKEYMAPDIR "keymaps/legacy" + #define UNIMAPDIR "unimaps" + #define TRANSDIR "consoletrans" + #define VIDEOMODEDIR "videomodes" diff --git a/kbd-1.15.5-sg-decimal-separator.patch b/kbd-1.15.5-sg-decimal-separator.patch new file mode 100644 index 0000000..cb7398d --- /dev/null +++ b/kbd-1.15.5-sg-decimal-separator.patch @@ -0,0 +1,12 @@ +diff -up kbd-1.15.5/data/keymaps/i386/qwertz/sg.map.orig kbd-1.15.5/data/keymaps/i386/qwertz/sg.map +--- kbd-1.15.5/data/keymaps/i386/qwertz/sg.map.orig 2013-02-21 15:54:39.362799094 +0100 ++++ kbd-1.15.5/data/keymaps/i386/qwertz/sg.map 2013-02-21 15:54:46.448838554 +0100 +@@ -1,7 +1,7 @@ + keymaps 0-2,4-6,8,12 + include "qwertz-layout" + include "linux-with-alt-and-altgr.inc" +- plain keycode 83 = KP_Comma ++ plain keycode 83 = KP_Period + strings as usual + + keycode 1 = Escape Escape diff --git a/kbd-2.0.2-unicode-start-font.patch b/kbd-2.0.2-unicode-start-font.patch new file mode 100644 index 0000000..72d47f4 --- /dev/null +++ b/kbd-2.0.2-unicode-start-font.patch @@ -0,0 +1,15 @@ +diff -up kbd-2.0.2/src/unicode_start.orig kbd-2.0.2/src/unicode_start +--- kbd-2.0.2/src/unicode_start.orig 2014-08-12 14:47:53.019028849 +0200 ++++ kbd-2.0.2/src/unicode_start 2014-08-12 14:54:42.631427602 +0200 +@@ -72,7 +72,10 @@ stty iutf8 + # have a Unicode map attached, or explicitly specified, e.g., + # by giving `def.uni' as a second argument. + +-DEFAULT_UNICODE_FONT=latarcyrheb-sun16 ++# Source /etc/vconsole.conf to get default font ++. /etc/vconsole.conf ++ ++DEFAULT_UNICODE_FONT=$FONT + # Also drdos8x16 is a good candidate. + + case "$#" in diff --git a/kbd-2.0.4.tar.xz b/kbd-2.0.4.tar.xz new file mode 100644 index 0000000..dab5153 Binary files /dev/null and b/kbd-2.0.4.tar.xz differ diff --git a/kbd-2.2.0.tar.gz b/kbd-2.2.0.tar.gz deleted file mode 100644 index 90c695e..0000000 Binary files a/kbd-2.2.0.tar.gz and /dev/null differ diff --git a/kbd.spec b/kbd.spec index 9d144ef..1e9d4ca 100644 --- a/kbd.spec +++ b/kbd.spec @@ -1,19 +1,34 @@ Name: kbd -Version: 2.2.0 -Release: 1 +Version: 2.0.4 +Release: 10 Summary: Tools for managing Linux console(keyboard, virtual terminals, etc.) License: GPLv2+ URL: https://www.%{name}-project.org/ -Source0: http://ftp.altlinux.org/pub/people/legion/%{name}/%{name}-%{version}.tar.gz +Source0: http://ftp.altlinux.org/pub/people/legion/%{name}/%{name}-%{version}.tar.xz Source1: %{name}-latsun-fonts.tar.bz2 Source2: %{name}-latarcyrheb-32.tar.bz2 Source3: xml2lst.pl Source4: vlock.pamd +Source5: kbdinfo.1 Source6: cz-map.patch +Patch0: %{name}-1.15-keycodes-man.patch +Patch1: %{name}-1.15-sparc.patch +Patch2: %{name}-1.15-unicode_start.patch +Patch3: %{name}-1.15.3-dumpkeys-man.patch +Patch4: %{name}-1.15.5-sg-decimal-separator.patch +Patch5: %{name}-1.15.5-loadkeys-search-path.patch +Patch6: %{name}-2.0.2-unicode-start-font.patch + +Patch6000: Check-existance-of-map-before-dumping-it.patch +Patch6001: Fix-infinite-loop-of-vlock-if-locked-VC-is-closed.patch +Patch6002: setmetamode-use-unsigned-int-type-for-KDGKBMETA-KDSK.patch +Patch6003: Fix-memory-leak.patch +Patch6004: configure.ac-Fix-logic-of-vlock-configure-switch.patch + BuildRequires: bison flex gettext pam-devel check-devel -BuildRequires: gcc console-setup xkeyboard-config gettext-devel +BuildRequires: gcc console-setup xkeyboard-config Requires: %{name}-misc = %{version}-%{release} Requires: %{name}-legacy = %{version}-%{release} Provides: vlock = %{version} @@ -36,7 +51,7 @@ keymaps and so on. But %{name}-misc can do nothing without %{name}. %package legacy Summary: Legacy data for %{name} package BuildArch: noarch - + %description legacy The %{name}-legacy package contains original keymaps for %{name} package. But %{name}-legacy can do nothing without %{name}. @@ -47,6 +62,18 @@ But %{name}-legacy can do nothing without %{name}. %setup -q -a 1 -a 2 cp -fp %{SOURCE3} . cp -fp %{SOURCE6} . +%patch0 -p1 -b .keycodes-man +%patch1 -p1 -b .sparc +%patch2 -p1 -b .unicode_start +%patch3 -p1 -b .dumpkeys-man +%patch4 -p1 -b .sg-decimal-separator +%patch5 -p1 -b .loadkeys-search-path +%patch6 -p1 -b .unicode-start-font +%patch6000 -p1 +%patch6001 -p1 +%patch6002 -p1 +%patch6003 -p1 +%patch6004 -p1 pushd data/keymaps/i386 cp qwerty/pt-latin9.map qwerty/pt.map @@ -57,7 +84,7 @@ cp azerty/fr-latin9.map azerty/fr.map cp azerty/fr-latin9.map azerty/fr-latin0.map -mv dvorak/dvorak-no.map dvorak/no-dvorak.map +mv dvorak/no.map dvorak/no-dvorak.map mv fgGIod/trf.map fgGIod/trf-fgGIod.map mv olpc/es.map olpc/es-olpc.map mv olpc/pt.map olpc/pt-olpc.map @@ -70,11 +97,8 @@ popd iconv -f iso-8859-1 -t utf-8 < "ChangeLog" > "ChangeLog_" mv "ChangeLog_" "ChangeLog" -./autogen.sh %build - - %configure --prefix=%{_prefix} --datadir=/lib/%{name} --mandir=%{_mandir} --localedir=%{_datadir}/locale --enable-nls %make_build @@ -95,6 +119,8 @@ done sed -i -e 's,\<%{name}_mode\>,/bin/%{name}_mode,g;s,\,/bin/setfont,g' \ %{buildroot}/bin/unicode_start +gzip -c %SOURCE5 > %{buildroot}/%{_mandir}/man1/kbdinfo.1.gz + cp -r %{buildroot}/lib/%{name}/locale/ %{buildroot}%{_datadir}/locale rm -rf %{buildroot}/lib/%{name}/locale @@ -118,6 +144,8 @@ while read line; do ckbcomp "$line" | gzip > %{buildroot}/lib/%{name}/keymaps/xkb/"$line".map.gz done < layouts-list-uniq.lst +zgrep -L "U+0041" %{buildroot}/lib/%{name}/keymaps/xkb/* | xargs rm -f + gunzip %{buildroot}/lib/%{name}/keymaps/xkb/fi.map.gz mv %{buildroot}/lib/%{name}/keymaps/xkb/fi.map %{buildroot}/lib/%{name}/keymaps/xkb/fi-kotoistus.map gzip %{buildroot}/lib/%{name}/keymaps/xkb/fi-kotoistus.map @@ -153,11 +181,5 @@ gzip %{buildroot}/lib/%{name}/keymaps/xkb/cz.map %{_mandir}/man8/*.8.gz %changelog -* Sat Jan 11 2020 openEuler Buildteam - 2.2.0-1 -- Type:bugfix -- Id:NA -- SUG:NA -- DESC:update to 2.2.0 - * Wed Sep 18 2019 openEuler Buildteam - 2.0.4-10 - Package init diff --git a/kbdinfo.1 b/kbdinfo.1 new file mode 100644 index 0000000..da84f76 --- /dev/null +++ b/kbdinfo.1 @@ -0,0 +1,33 @@ +.TH KBDINFO 1 "June 2011" +.SH NAME +kbdinfo \- obtain information about the status of a console +.SH SYNOPSIS +\fBkbdinfo\fR [\-C \fIDEVICE\fR] getmode [text|graphics] +.LP +\fBkbdinfo\fR [\-C \fIDEVICE\fR] gkbmode [raw|xlate|mediumraw|unicode] +.LP +\fBkbdinfo\fR [\-C \fIDEVICE\fR] gkbmeta [metabit|escprefix] +.LP +\fBkbdinfo\fR [\-C \fIDEVICE\fR] gkbled [scrolllock|numlock|capslock] +.SH DESCRIPTION +.B kbdinfo +is an interface to KDGETMODE, GKBMODE, GKBMETA and GKBLED ioctls. Its +primary use case is to query the status of the given +.I CONSOLE +(or the currently active one, if no \-C option is present) from a shell +script. +.LP +If the final value argument is not specified, +.B kbdinfo +will print the result of the desired ioctl to the standard output. +Otherwise, the given value is compared to the actual result, and the +utility will exit with a status code of 0 for a match, 1 otherwise. No +text is printed for this style of invocation. +.SH "SEE ALSO" +.BR kbd_mode (1) +.SH AUTHOR +kbdinfo is Copyright \(co 2011 Alexey Gladkov +. +.LP +This manual page was written by Michael Schutte for +the Debian GNU/Linux system (but may be used by others). diff --git a/setmetamode-use-unsigned-int-type-for-KDGKBMETA-KDSK.patch b/setmetamode-use-unsigned-int-type-for-KDGKBMETA-KDSK.patch new file mode 100644 index 0000000..1ff247f --- /dev/null +++ b/setmetamode-use-unsigned-int-type-for-KDGKBMETA-KDSK.patch @@ -0,0 +1,45 @@ +From 6613abc26a853293c12f4e146a27606f02c8dd03 Mon Sep 17 00:00:00 2001 +From: Andreas Henriksson +Date: Mon, 28 May 2018 21:19:22 +0200 +Subject: [PATCH] setmetamode: use unsigned int type for KDGKBMETA / KDSKBMETA + +alsauser@pragmasoft.com reported that he detected a stack smash +and analyzed the problem as allocating too little space for +the resulting put_user after calling ioctl KDGKBMETA. +The ometa variable should be defined as unsigned int. + +While at it and for correctness, also nmeta and thus the +val member of the struct meta where changed to unsigned +int as it seems the kernel wants to take this type +(but should be harmless to use char). + +Original bug report at https://bugs.debian.org/872623 +--- + src/setmetamode.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/setmetamode.c b/src/setmetamode.c +index 8d75b94..adec0e9 100644 +--- a/src/setmetamode.c ++++ b/src/setmetamode.c +@@ -50,7 +50,7 @@ report(int meta) + + struct meta { + char *name; +- int val; ++ unsigned int val; + } metas[] = { + { "metabit", K_METABIT }, + { "meta", K_METABIT }, +@@ -64,7 +64,7 @@ struct meta { + + int main(int argc, char **argv) + { +- char ometa, nmeta; ++ unsigned int ometa, nmeta; + struct meta *mp; + + set_progname(argv[0]); +-- +2.21.0.windows.1 +