summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Enge <andreas@enge.fr>2023-03-20 16:59:27 +0100
committerAndreas Enge <andreas@enge.fr>2023-03-20 16:59:27 +0100
commit098bd280f82350073e8280e37d56a14162eed09c (patch)
treeb0a56906d9d136969e69945b79deb28669c64e5a
parentf774aa2d17add128b88af8298a8aa183885df1a2 (diff)
downloadguix-098bd280f82350073e8280e37d56a14162eed09c.tar.gz
gnu: procps: Fix test failure on i686.
* gnu/packages/patches/procps-strtod-test.patch: New file.
* gnu/packages/linux.scm (procps): Add patch.
* gnu/local.mk (dist_patch_DATA): Register patch.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/linux.scm3
-rw-r--r--gnu/packages/patches/procps-strtod-test.patch36
3 files changed, 39 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 43b7e4ceb3..045d5cb1ee 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1635,6 +1635,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/pocketfft-cpp-prefer-preprocessor-if.patch			\
   %D%/packages/patches/pokerth-boost.patch			\
   %D%/packages/patches/ppsspp-disable-upgrade-and-gold.patch		\
+  %D%/packages/patches/procps-strtod-test.patch                 \
   %D%/packages/patches/pthreadpool-system-libraries.patch	\
   %D%/packages/patches/python-chai-drop-python2.patch		\
   %D%/packages/patches/python-feedparser-missing-import.patch	\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 7f00afc9d3..f956b274d6 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -2248,7 +2248,8 @@ parameters.")
                                   "procps-ng-" version ".tar.xz"))
               (sha256
                (base32
-                "14ms9mkqr1mgl3h5yl6w8m57cf39k382nv7qms78vqbaz728wg1h"))))
+                "14ms9mkqr1mgl3h5yl6w8m57cf39k382nv7qms78vqbaz728wg1h"))
+              (patches (search-patches "procps-strtod-test.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list #:modules '((guix build utils)
diff --git a/gnu/packages/patches/procps-strtod-test.patch b/gnu/packages/patches/procps-strtod-test.patch
new file mode 100644
index 0000000000..db1cee320e
--- /dev/null
+++ b/gnu/packages/patches/procps-strtod-test.patch
@@ -0,0 +1,36 @@
+See https://gitlab.com/procps-ng/procps/-/issues/271
+
+diff -u -r procps-ng-4.0.3.alt/src/tests/test_strtod_nol.c procps-ng-4.0.3/src/tests/test_strtod_nol.c
+--- procps-ng-4.0.3.alt/src/tests/test_strtod_nol.c	2022-12-18 23:44:18.383960834 +0100
++++ procps-ng-4.0.3/src/tests/test_strtod_nol.c	2023-03-20 16:52:26.680032658 +0100
+@@ -1,6 +1,7 @@
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <math.h>
+ #include "strutils.h"
+ 
+ struct strtod_tests {
+@@ -25,6 +26,11 @@
+     {NULL, 0.0}
+ };
+ 
++#define EPSILON 1.0  // Really not trying for precision here
++int dequal(const double d1, const double d2)
++{
++    return fabs(d1-d2) < EPSILON;
++}
+ 
+ 
+ int main(int argc, char *argv[])
+@@ -33,8 +39,8 @@
+     double val;
+ 
+     for(i=0; tests[i].string != NULL; i++) {
+-        if(strtod_nol_or_err(tests[i].string, "Cannot parse number") !=
+-           tests[i].result) {
++        if(!dequal (strtod_nol_or_err(tests[i].string, "Cannot parse number"),
++                    tests[i].result)) {
+             fprintf(stderr, "FAIL: strtod_nol_or_err(\"%s\") != %f\n",
+                     tests[i].string, tests[i].result);
+             return EXIT_FAILURE;