summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/base.scm31
-rw-r--r--gnu/packages/patches/coreutils-cut-huge-range-test.patch22
3 files changed, 50 insertions, 4 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 6df3e58465..ba908cd4aa 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -514,6 +514,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/clx-remove-demo.patch			\
   %D%/packages/patches/cmake-fix-tests.patch			\
   %D%/packages/patches/coda-use-system-libs.patch		\
+  %D%/packages/patches/coreutils-cut-huge-range-test.patch	\
   %D%/packages/patches/coreutils-fix-cross-compilation.patch    \
   %D%/packages/patches/cpio-CVE-2016-2037.patch			\
   %D%/packages/patches/cpufrequtils-fix-aclocal.patch		\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index ba9c820efa..2a6f6a43ed 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -307,9 +307,17 @@ used to apply commands with arbitrarily long arguments.")
     ;; copy of help2man.  However, don't pass it when cross-compiling since
     ;; that would lead it to try to run programs to get their '--help' output
     ;; for help2man.
-    (if (%current-target-system)
-        '()
-        `(("perl" ,perl))))
+    `(,@(if (%current-target-system)
+            '()
+            `(("perl" ,perl)))
+
+      ;; Apply this patch only on ARM to avoid a full rebuild.
+      ;; TODO: Move to 'patches' in the next update cycle.
+      ,@(if (string-prefix? "arm" (or (%current-target-system)
+                                      (%current-system)))
+            `(("cut-test.patch"
+               ,(search-patch "coreutils-cut-huge-range-test.patch")))
+            '())))
    (outputs '("out" "debug"))
    (arguments
     `(#:parallel-build? #f            ; help2man may be called too early
@@ -328,7 +336,22 @@ used to apply commands with arbitrarily long arguments.")
                     (substitute* (find-files "tests" "\\.sh$")
                       (("#!/bin/sh")
                        (format #f "#!~a/bin/sh" bash)))))
-                %standard-phases)))
+
+                ,@(if (string-prefix? "arm" (or (%current-target-system)
+                                                (%current-system)))
+                      '((alist-cons-before
+                         'build 'patch-cut-test
+                         (lambda* (#:key inputs native-inputs
+                                   #:allow-other-keys)
+                           (let ((patch (or (assoc-ref inputs
+                                                       "cut-test.patch")
+                                            (assoc-ref native-inputs
+                                                       "cut-test.patch"))))
+                             (zero?
+                              (system* "patch" "-p1" "--force"
+                                       "--input" patch))))
+                         %standard-phases))
+                      '(%standard-phases)))))
    (synopsis "Core GNU utilities (file, text, shell)")
    (description
     "GNU Coreutils includes all of the basic command-line tools that are
diff --git a/gnu/packages/patches/coreutils-cut-huge-range-test.patch b/gnu/packages/patches/coreutils-cut-huge-range-test.patch
new file mode 100644
index 0000000000..0be2cef2b8
--- /dev/null
+++ b/gnu/packages/patches/coreutils-cut-huge-range-test.patch
@@ -0,0 +1,22 @@
+This patch fixes 100% reproducible test failures on arm-linux-gnueabihf in our
+the build environment chroot, as reported at <https://bugs.gnu.org/26253>.
+It is a followup to this upstream patch:
+
+   commit 28803c8a3144d5d4363cdbd148bbe067af1a67c2
+   Author: Pádraig Brady <P@draigBrady.com>
+   Date:   Fri Mar 3 00:25:54 2017 -0800
+
+       tests: avoid a spurious failure on older debian
+
+... which appeared to be insufficient.
+
+--- a/tests/misc/cut-huge-range.sh
++++ b/tests/misc/cut-huge-range.sh
+@@ -22,6 +22,7 @@ getlimits_
+ 
+ vm=$(get_min_ulimit_v_ cut -b1 /dev/null) \
+   || skip_ "this shell lacks ulimit support"
++vm=$(($vm + $(getconf PAGESIZE))) # avoid spurious failures
+ 
+ # sed script to subtract one from the input.
+ # Each input line should consist of a positive decimal number.