[PATCH] testing/ace-of-penguins: fix segfault on help screen
Export this patch
Signed-off-by: Sebastian <sebastian@sebsite.pw>
---
testing/ace-of-penguins/APKBUILD | 6 ++++--
testing/ace-of-penguins/fix-font.patch | 24 ++++++++++++++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
create mode 100644 testing/ace-of-penguins/fix-font.patch
diff --git a/testing/ace-of-penguins/APKBUILD b/testing/ace-of-penguins/APKBUILD
index 83ea1ee6..5ab3d880 100644
--- a/testing/ace-of-penguins/APKBUILD
+++ b/testing/ace-of-penguins/APKBUILD
@@ -1,8 +1,8 @@
-# Contributor: Sebastian Hudak <sebastian@sebsite.pw>
+# Contributor: Keith Toh <ktprograms@gmail.com>
# Maintainer: Sebastian Hudak <sebastian@sebsite.pw>
pkgname=ace-of-penguins
pkgver=1.4
-pkgrel=0
+pkgrel=1
pkgdesc="Collection of one-player games for X"
url="https://www.delorie.com/store/ace/"
arch="all"
@@ -14,6 +14,7 @@ subpackages="$pkgname-doc"
# https://aur.archlinux.org/packages/ace-of-penguins
source="https://www.delorie.com/store/ace/ace-$pkgver.tar.gz
ace.patch
+ fix-font.patch
canfield.desktop
freecell.desktop
golf.desktop
@@ -53,6 +54,7 @@ package() {
sha512sums="
cd382db95dc17d75a76809c7f1e096e14f5863c1166aa5db7f93204ce949a9ed21979212946b9d3a09667f4a93b30f4cc44a220940f9b5dd8996f28ecb4a6dcc ace-1.4.tar.gz
6846662deda4c21a89ecaf55afe1580f82f67122f236618a94dcd584cd3a5a76d0429c9bd4ac808e29d04ae78ab9cf9417e274585f87af46a0a769af4917f509 ace.patch
+b3cd34677326d4b9e47875698aa1bca6985231e1f0e14dc9acdb815c443f767f1199dbd8dd0c72a3aaa2eba62e35c3473a60acaab7c606d848c6cbdb854d3487 fix-font.patch
4ba6813cb57d2ed41ee8a582b4cc3026a9f69d4c78ee5a012cdcb3284efee0b3efb04917ad2bd9fb4846b7007cce4bfef7e5e9bd8e91c229b4ed31d077f4f10b canfield.desktop
3f0b3a55af0df885d23fcd73764e0548b7f7d0e25eb881ee1e24d108dd51a234e4140d37a6c616bc39dc2eb70aeeb0f370a1c0ef0ec3314ffb4a07ab89e0b005 freecell.desktop
d76332b739d938ed29ad30f41baaddff6efa70e674aa7354f60b342f828d470212bebacb2a02f6921b8740a616b97b97002455eb153555d7350ffab3ea7b670a golf.desktop
diff --git a/testing/ace-of-penguins/fix-font.patch b/testing/ace-of-penguins/fix-font.patch
new file mode 100644
index 00000000..6326dc91
--- /dev/null
+++ b/testing/ace-of-penguins/fix-font.patch
@@ -0,0 +1,24 @@
+Without this patch, trying to open the help screen could make the program
+segfault if the appropriate fonts weren't installed.
+
+--- ace-1.4/lib/help.c 2022-02-17 03:11:56.410174316 +0000
++++ ace-1.4-alpine/lib/help.c 2022-02-17 03:46:31.476912695 +0000
+@@ -179,7 +179,18 @@
+ for (i=0; i<17; i++)
+ {
+ if (!fonts[i])
++ {
+ fonts[i] = XLoadQueryFont(display, i & STYLE_TT ? "fixed" : "variable");
++ if (!fonts[i])
++ {
++ int count;
++ char **fontlist = XListFonts(display, "*", 1, &count);
++ if (count == 0)
++ abort();
++ fonts[i] = XLoadQueryFont(display, fontlist[0]);
++ XFreeFontNames(fontlist);
++ }
++ }
+ thin_space[i] = XTextWidth(fonts[i], " ", 1);
+ }
+ for (i=0; i<NTAGS; i++)
--
2.34.1