Subject: [alpine-aports] [PATCH] Re: [alpine-devel] gpm patch bug

From: Isaac Dunham <[email-masked]>
Date: Thu, 11 Feb 2016 18:18:37 -0800

On Fri, Feb 12, 2016 at 01:07:42AM +0100, Szabolcs Nagy wrote:
> it seems this patch leaves .sa_flags uninitialized:
> 
> http://git.alpinelinux.org/cgit/aports/plain/testing/gpm/03-gpmroot.patch
> 
> either the struct should be zero initialized or do something like
> 
> #ifndef SA_INTERRUPT
> #define SA_INTERRUPT 0
> #endif

You are correct; I was not paying enough attention, just trying to get
it building.

Here's a patch to fix it, though I think that upgrading to the version in
github.com/telmich/gpm is probably the better solution.

Thanks,
Isaac Dunham
From 569bfef488748fdbb85c550e8c0df4b6ace91f22 Mon Sep 17 00:00:00 2001
From: Isaac Dunham <[email-masked]>
Date: Thu, 11 Feb 2016 18:09:12 -0800
Subject: [PATCH] testing/gpm: make sure sa_flags gets initialized

Initialization was disabled in v1 of 03-gpmroot.patch.
---
 testing/gpm/03-gpmroot.patch | 27 ++++++++++++++++++++-------
 testing/gpm/APKBUILD         |  6 +++---
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/testing/gpm/03-gpmroot.patch b/testing/gpm/03-gpmroot.patch
index fd3258c..bbfdfc7 100644
--- a/testing/gpm/03-gpmroot.patch
+++ b/testing/gpm/03-gpmroot.patch
@@ -1,14 +1,30 @@
-commit eb333988d937f3665348240c5551db3ec98fc679
+commit 9b66298a4262bfd90f3701c7f48c9dcf7a157cac
 Author: Isaac Dunham <[email-masked]>
-Date:   Tue Jul 15 18:18:26 2014 -0700
+Date:   Thu Feb 11 16:54:32 2016 -0800
 
     make gpm-root build
+    
+    * use sigemptyset() instead of nonportable equivalents
+    * if SA_INTERRUPT is undefined, set sa_flags to 0 because the implementation
+     defaults to interrupt mode (thanks to nsz for pointing out missing
+     initialization)
 
 diff --git a/src/prog/gpm-root.y b/src/prog/gpm-root.y
-index 069d801..3ad0d03 100644
+index 069d801..ed363f4 100644
 --- a/src/prog/gpm-root.y
 +++ b/src/prog/gpm-root.y
-@@ -1196,12 +1196,10 @@ int main(int argc, char **argv)
+@@ -76,6 +76,10 @@
+ #undef YYDEBUG
+ #endif
+ 
++#ifndef SA_INTERRUPT
++#define SA_INTERRUPT 0
++#endif
++
+ #define USER_CFG   ".gpm-root"
+ #define SYSTEM_CFG SYSCONFDIR "/gpm-root.conf"
+ 
+@@ -1196,11 +1200,7 @@ int main(int argc, char **argv)
                                                          LOG_DAEMON : LOG_USER);
     /* reap your zombies */
     childaction.sa_handler=reap_children;
@@ -18,9 +34,6 @@ index 069d801..3ad0d03 100644
 -   childaction.sa_mask=0;
 -#endif /* __GLIBC__ */
 +   sigemptyset(&childaction.sa_mask);
-+#ifdef SA_INTERRUPT
     childaction.sa_flags=SA_INTERRUPT; /* need to break the select() call */
-+#endif
     sigaction(SIGCHLD,&childaction,NULL);
  
-    /*....................................... Connect and get your buffer */
diff --git a/testing/gpm/APKBUILD b/testing/gpm/APKBUILD
index 91ef53f..d80c54b 100644
--- a/testing/gpm/APKBUILD
+++ b/testing/gpm/APKBUILD
@@ -71,20 +71,20 @@ md5sums="bf84143905a6a903dbd4d4b911a2a2b8  gpm-1.20.7.tar.bz2
 ba7ffe9a3b6e3f672081a5b7d17f4766  error-format.patch
 3adbe10e28d14d5b498a83bbccbba427  01-Iheaders.patch
 6b6ef5234d6903c666e0f12eb8a1b958  02-sys-select.patch
-3b2fe9f664c36f5cd395376eca43e63f  03-gpmroot.patch
+e248dda6c8fb4dae5262a3e15cadb1c9  03-gpmroot.patch
 c2d6e7341dc2bd285e276b14336b4bf6  gpm.initd
 887ce2e3743ac8ea9baf9f723876dc4b  gpm.confd"
 sha256sums="f011b7dc7afb824e0a017b89b7300514e772853ece7fc4ee640310889411a48d  gpm-1.20.7.tar.bz2
 290e032640c8cfb95d5a8dddfd99e11887100b08750b9f5ceaec6e3209e3ebf3  error-format.patch
 4b99946b86d9f21d7ec4f3e366dab18a57133903c480408bf0eb838fccc2f11d  01-Iheaders.patch
 04487ddfe3e2f5ada548d55bc0e62bf5f36e92641d254f4f24ee0428253b26a5  02-sys-select.patch
-a202d783c586e959ca28bc8bea5c99f0f1c68679f223a2241b04f74d9a31d01c  03-gpmroot.patch
+48a60c2661f675cc17c6fdc7d2f55f8836624df3c1c490160a321e846a9925aa  03-gpmroot.patch
 d3b6ba9da912f628572d9679311f562a2fb318765ae7397da535df830ccd09ba  gpm.initd
 260b40ffebc7eca901203ca7083cfd72a8ffb5da7210840b389ddc2317e80dba  gpm.confd"
 sha512sums="51c1141ed502f8b6bc846485a8e315bafe3cf2b7c9d1ea8a710d9748ff2058f29c7ab5715fc1730a8437c613181d2050f37b134e9288c69ba8ff7fb0be7ec0d1  gpm-1.20.7.tar.bz2
 caad0472374b9bb9bdf8f31480f88895b2d65dc0565611932fa185592ffcc18065bb66b433f54f0df9f6173056b6c34ec5d57f79bd19f38edefeca57603bc76c  error-format.patch
 cb9fa2c48b5fa7f06ccfa8be57e421ee228b49707027094a2fdca5809407e7e277484c820ed4ee0800ef1a36bfc322ac33b2f29b4411ffab345c900931113863  01-Iheaders.patch
 24fbc48408388a7481dadbccc6da3edbd5f82a644460e5a9ca6039fbac2d2eff6c16002b2158c1955fbd2677655b8b1acd1e12b94b9c29eeddb1a883e813e2a7  02-sys-select.patch
-5a021516a4833a270cbb7537f2096d6deabd40d874a9f4f9ba4d5728a89e1626ea9cbc4fefee354950f145d4c8735504a128da0fac7fa74a9c32c0d5a93125e9  03-gpmroot.patch
+e6bdef0847e06bb4fd15bae315cd8cdbdc5b02e7241da575127592689aad6da1b331e4442a70ae6fcb8068e844adf2de509f61c318572a91b97ab00efa6444fd  03-gpmroot.patch
 d268504bd0cf83706863a8af5c5719b0d192c34ae6a78ff0378521841eca242b39a6e6891080a5fc5512732f84e7439697ba92bfda3ecc1aaebd36b16e946477  gpm.initd
 0e7c96f29222d33301fc9c5c8cf409b7dbe6cbb1e79d76444ae5724e8b793679d3ea597a8ad64187e85680799847632095e469445ae56f893616cb0235a29f3a  gpm.confd"
-- 
2.7.1