aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2019-10-12 12:38:13 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2019-10-12 12:38:13 +0200
commit81189e08a0c497a44660eb479120917291a67776 (patch)
treee478c6f25f1e08d1562fa44538aacc2d1a0394ff
parentd4ce64e86a0b7aaca7870a1dc64c855b4a7dd417 (diff)
downloadaports-81189e08a0c497a44660eb479120917291a67776.tar.gz
aports-81189e08a0c497a44660eb479120917291a67776.tar.bz2
aports-81189e08a0c497a44660eb479120917291a67776.tar.xz
main/kbd: backport compatibility fix for busybox loadkmap
Should fix loading some keyboard layouts in the initramfs. See: https://gitlab.alpinelinux.org/alpine/aports/issues/10741
-rw-r--r--main/kbd/0001-libkeymap-Fix-the-compatibility-with-the-busybox-s-l.patch31
-rw-r--r--main/kbd/APKBUILD9
2 files changed, 39 insertions, 1 deletions
diff --git a/main/kbd/0001-libkeymap-Fix-the-compatibility-with-the-busybox-s-l.patch b/main/kbd/0001-libkeymap-Fix-the-compatibility-with-the-busybox-s-l.patch
new file mode 100644
index 0000000000..45508e3eee
--- /dev/null
+++ b/main/kbd/0001-libkeymap-Fix-the-compatibility-with-the-busybox-s-l.patch
@@ -0,0 +1,31 @@
+From c994c7763b390d28ac92223eaa6176a136ad7b58 Mon Sep 17 00:00:00 2001
+From: Alexey Gladkov <gladkov.alexey@gmail.com>
+Date: Thu, 26 Sep 2019 11:24:48 +0200
+Subject: [PATCH] libkeymap: Fix the compatibility with the busybox's loadkmap
+
+Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
+---
+ src/libkeymap/dump.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/src/libkeymap/dump.c b/src/libkeymap/dump.c
+index 83ac351..8531b5a 100644
+--- a/src/libkeymap/dump.c
++++ b/src/libkeymap/dump.c
+@@ -72,9 +72,14 @@ int lk_dump_bkeymap(struct lk_ctx *ctx, FILE *fd)
+ continue;
+
+ for (j = 0; j < NR_KEYS / 2; j++) {
+- int v = lk_get_key(ctx, i, j);
++ int value = lk_get_key(ctx, i, j);
+
+- if (fwrite(&v, sizeof(v), 1, fd) != 1)
++ if (value < 0 || value > USHRT_MAX) {
++ ERR(ctx, _("can not bind key %d to value %d because it is too large"), j, value);
++ goto fail;
++ }
++
++ if (fwrite(&value, sizeof(unsigned short), 1, fd) != 1)
+ goto fail;
+ }
+ }
diff --git a/main/kbd/APKBUILD b/main/kbd/APKBUILD
index d29be9986a..73d3a9e760 100644
--- a/main/kbd/APKBUILD
+++ b/main/kbd/APKBUILD
@@ -18,6 +18,7 @@ source="https://www.kernel.org/pub/linux/utils/kbd/kbd-$pkgver.tar.gz
error.h
fix-tests.patch
0001-libkbdfile-Check-compression-suffix-even-if-the-suff.patch
+ 0001-libkeymap-Fix-the-compatibility-with-the-busybox-s-l.patch
"
_datadir=/usr/share
@@ -28,6 +29,11 @@ _badmaps="pk-ara"
prepare() {
default_prepare
+ # 0001-libkeymap-Fix-the-compatibility-with-the-busybox-s-l.patch
+ # makes this test fail because changes to tests were not backported.
+ # Remove the following line when the patch is removed.
+ truncate -s0 "$builddir"/tests/dumpkeys-bkeymap.in
+
cd "$builddir"
cp "$srcdir"/error.h .
}
@@ -179,4 +185,5 @@ sha512sums="17f70402126e545c318a5de0265875135b6ebdc0ff9905cb8094dc74a5b27a9d6ced
12028796552a5ffed1d5cb19d37fc6a73fb4f2e2bf34d837a81171c7ebee98d6c3f557715bf79706d79ce053b9b2450cd8cf1c4ea045428fb7d8a5915ae3ed78 loadkeys.confd
c66f6b0d8c8b8d285c740bdbe7130dee272ac01cd5e73b35a58cedf1a77fe8d9e062631b804fb58014d8eb9861c8f28aed07bc022ef31662bcc61b5c85a21752 error.h
bb67e5bb933a48f4a04402e07d7d67169a97485e6b469f8ccd4436466eb17ec2ddcf0ef74d22b3aae9e813feaee5bef0822ec50c384e0276a8c91f9325502a5f fix-tests.patch
-edd53405ae22c19c0c4384318fde7bdea27de5428931b304b1d1a02bc268aea147ec9ff2c7296f7f22ee1b544c6ba30688d77e85a3f8751d4c5bcbe80fd0e518 0001-libkbdfile-Check-compression-suffix-even-if-the-suff.patch"
+edd53405ae22c19c0c4384318fde7bdea27de5428931b304b1d1a02bc268aea147ec9ff2c7296f7f22ee1b544c6ba30688d77e85a3f8751d4c5bcbe80fd0e518 0001-libkbdfile-Check-compression-suffix-even-if-the-suff.patch
+af4c92c7420a42b5ad7a8d24ad97ce8fd63c75f37e5f3dbc04adfdce2509d343160475e74c03f78243eff32abe5d5efa9df61cbe9b754f4ed8f56c07d7890969 0001-libkeymap-Fix-the-compatibility-with-the-busybox-s-l.patch"