summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-09-22 23:06:33 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-22 23:06:33 +0200
commitf07aa672fddd7b5405fc730ffebcda67daa71ae1 (patch)
tree52b2a3f246f5022ef7eaa7e20cb9aac067e10d05
parent52ac153e2a83035ce2bc875f9c414cb26db5f6fc (diff)
parentdd68dd137a4a70cde7e344bd969ef7849355d018 (diff)
downloadguix-f07aa672fddd7b5405fc730ffebcda67daa71ae1.tar.gz
Merge branch 'core-updates'
-rw-r--r--gnu-system.am4
-rw-r--r--gnu/packages/acl.scm4
-rw-r--r--gnu/packages/admin.scm13
-rw-r--r--gnu/packages/base.scm32
-rw-r--r--gnu/packages/bdw-gc.scm11
-rw-r--r--gnu/packages/commencement.scm12
-rw-r--r--gnu/packages/cyrus-sasl.scm8
-rw-r--r--gnu/packages/file.scm8
-rw-r--r--gnu/packages/gawk.scm9
-rw-r--r--gnu/packages/gcc.scm3
-rw-r--r--gnu/packages/gnutls.scm8
-rw-r--r--gnu/packages/guile.scm6
-rw-r--r--gnu/packages/image.scm12
-rw-r--r--gnu/packages/libffi.scm7
-rw-r--r--gnu/packages/libunistring.scm4
-rw-r--r--gnu/packages/linux.scm11
-rw-r--r--gnu/packages/mc.scm11
-rw-r--r--gnu/packages/mcrypt.scm7
-rw-r--r--gnu/packages/patches/coreutils-dummy-man.patch10
-rw-r--r--gnu/packages/patches/coreutils-skip-nohup.patch28
-rw-r--r--gnu/packages/patches/file-CVE-2014-3587.patch16
-rw-r--r--gnu/packages/patches/gcc-fix-pr61801.patch25
-rw-r--r--gnu/packages/patches/libffi-mips-n32-fix.patch21
-rw-r--r--gnu/packages/pretty-print.scm112
-rw-r--r--guix/build/gnu-build-system.scm30
-rw-r--r--guix/build/utils.scm50
-rw-r--r--tests/build-utils.scm57
27 files changed, 288 insertions, 231 deletions
diff --git a/gnu-system.am b/gnu-system.am
index 8f8ce4003d..67b13e7803 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -311,7 +311,6 @@ dist_patch_DATA =						\
   gnu/packages/patches/clucene-pkgconfig.patch			\
   gnu/packages/patches/cmake-fix-tests.patch			\
   gnu/packages/patches/coreutils-dummy-man.patch		\
-  gnu/packages/patches/coreutils-skip-nohup.patch		\
   gnu/packages/patches/cpio-gets-undeclared.patch		\
   gnu/packages/patches/cssc-gets-undeclared.patch               \
   gnu/packages/patches/cssc-missing-include.patch               \
@@ -322,11 +321,13 @@ dist_patch_DATA =						\
   gnu/packages/patches/doxygen-tmake.patch			\
   gnu/packages/patches/emacs-configure-sh.patch			\
   gnu/packages/patches/eudev-rules-directory.patch		\
+  gnu/packages/patches/file-CVE-2014-3587.patch			\
   gnu/packages/patches/findutils-absolute-paths.patch		\
   gnu/packages/patches/flashrom-use-libftdi1.patch		\
   gnu/packages/patches/flex-bison-tests.patch			\
   gnu/packages/patches/gawk-shell.patch				\
   gnu/packages/patches/gcc-cross-environment-variables.patch	\
+  gnu/packages/patches/gcc-fix-pr61801.patch			\
   gnu/packages/patches/gd-mips64-deplibs-fix.patch		\
   gnu/packages/patches/glib-tests-desktop.patch			\
   gnu/packages/patches/glib-tests-homedir.patch			\
@@ -354,7 +355,6 @@ dist_patch_DATA =						\
   gnu/packages/patches/kmod-module-directory.patch		\
   gnu/packages/patches/libbonobo-activation-test-race.patch	\
   gnu/packages/patches/libevent-dns-tests.patch			\
-  gnu/packages/patches/libffi-mips-n32-fix.patch		\
   gnu/packages/patches/liboop-mips64-deplibs-fix.patch		\
   gnu/packages/patches/libmad-mips-newgcc.patch			\
   gnu/packages/patches/libtheora-config-guess.patch		\
diff --git a/gnu/packages/acl.scm b/gnu/packages/acl.scm
index 37c0b71dc9..ef15022566 100644
--- a/gnu/packages/acl.scm
+++ b/gnu/packages/acl.scm
@@ -28,7 +28,7 @@
 (define-public acl
   (package
     (name "acl")
-    (version "2.2.51")
+    (version "2.2.52")
     (source
      (origin
       (method url-fetch)
@@ -36,7 +36,7 @@
                           version ".src.tar.gz"))
       (sha256
        (base32
-        "09aj30m49ivycl3irram8c3givc0crivjm3ymw0nhfaxrwhlb186"))))
+        "08qd9s3wfhv0ajswsylnfwr5h0d7j9d4rgip855nrh400nxp940p"))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 0f5af3f02b..ffeab07bde 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -647,18 +647,7 @@ system administrator.")
                       "")
                      (("^install: (.*)install-sudoers(.*)" _ before after)
                       ;; Don't try to create /etc/sudoers.
-                      (string-append "install: " before after "\n")))
-
-                   ;; XXX FIXME sudo 1.8.10p3 was bootstrapped with a
-                   ;; prerelease libtool, which fails on MIPS in the absence
-                   ;; of /usr/bin/file.  As a temporary workaround, we patch
-                   ;; the configure script to hardcode use of the little
-                   ;; endian N32 ABI on MIPS.
-                   ,@(if (equal? "mips64el-linux" (or (%current-target-system)
-                                                      (%current-system)))
-                         '((substitute* "configure"
-                             (("\\$emul") "elf32ltsmipn32")))
-                         '()))
+                      (string-append "install: " before after "\n"))))
                  %standard-phases)
 
        ;; XXX: The 'testsudoers' test series expects user 'root' to exist, but
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index debfa97509..fe2f0f07e8 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -25,6 +25,7 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages acl)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages ed)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages perl)
@@ -122,14 +123,14 @@ implementation offers several extensions over the standard utility.")
 (define-public tar
   (package
    (name "tar")
-   (version "1.27.1")
+   (version "1.28")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/tar/tar-"
-                                version ".tar.bz2"))
+                                version ".tar.xz"))
             (sha256
              (base32
-              "1iip0fk0wqhxb0jcwphz43r4fxkx1y7mznnhmlvr618jhp7b63wv"))))
+              "1wi2zwm4c9r3h3b8y4w0nm0qq897kn8kyj9k22ba0iqvxj48vvk4"))))
    (build-system gnu-build-system)
    (synopsis "Managing tar archives")
    (description
@@ -154,12 +155,9 @@ standard utility.")
              (base32
               "1sqckf560pzwgniy00vcpdv2c9c11s4cmhlm14yqgg8avd3bl94i"))))
    (build-system gnu-build-system)
-   (native-inputs '())                      ; FIXME: needs `ed' for the tests
-   (arguments
-    '(#:tests? #f)
+   (native-inputs `(("ed", ed)))
     ;; TODO: When cross-compiling, add this:
     ;;  '(#:configure-flags '("ac_cv_func_strnlen_working=yes"))
-    )
    (synopsis "Apply differences to originals, with optional backups")
    (description
     "Patch is a program that applies changes to files based on differences
@@ -225,17 +223,15 @@ used to apply commands with arbitrarily long arguments.")
 (define-public coreutils
   (package
    (name "coreutils")
-   (version "8.22")
+   (version "8.23")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/coreutils/coreutils-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "04hjzzv434fb8ak3hh3dyhdvg3hqjjwvjmjxqzk1gh2jh6cr8gjv"))
-            (patches (list (search-patch "coreutils-dummy-man.patch")
-                           ;; TODO: remove this patch for >= 8.23
-                           (search-patch "coreutils-skip-nohup.patch")))))
+              "0bdq6yggyl7nkc2pbl6pxhhyx15nyqhz3ds6rfn448n6rxdwlhzc"))
+            (patches (list (search-patch "coreutils-dummy-man.patch")))))
    (build-system gnu-build-system)
    (inputs `(("acl"  ,acl)                        ; TODO: add SELinux
              ("gmp"  ,gmp)))
@@ -362,14 +358,14 @@ included.")
 (define-public glibc
   (package
    (name "glibc")
-   (version "2.19")
+   (version "2.20")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/glibc/glibc-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "18m2dssd6ja5arxmdxinc90xvpqcsnqjfwmjl2as07j0i3srff9d"))
+              "19bbyfc2gcxr9rihrkkbd3p362i608yhlyrr7icqsa6cmr16sjzq"))
             (snippet
              ;; Disable 'ldconfig' and /etc/ld.so.cache.  The latter is
              ;; required on LFS distros to avoid loading the distro's libc.so
@@ -409,10 +405,10 @@ included.")
                            (assoc-ref %build-inputs "linux-headers")
                            "/include")
 
-            ;; The default is to assume a 2.4 Linux interface, but we'll
-            ;; always use something newer.  See "kernel-features.h" in the
-            ;; GNU libc for details.
-            "--enable-kernel=2.6.30"
+            ;; This is the default for most architectures as of GNU libc 2.20,
+            ;; but we specify it explicitly for clarity and consistency.  See
+            ;; "kernel-features.h" in the GNU libc for details.
+            "--enable-kernel=2.6.32"
 
             ;; Use our Bash instead of /bin/sh.
             (string-append "BASH_SHELL="
diff --git a/gnu/packages/bdw-gc.scm b/gnu/packages/bdw-gc.scm
index ebb02b1d74..66158912d7 100644
--- a/gnu/packages/bdw-gc.scm
+++ b/gnu/packages/bdw-gc.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -64,15 +65,15 @@ C or C++ programs, though that is not its primary goal.")
 (define-public libatomic-ops
   (package
     (name "libatomic-ops")
-    (version "7.4.0")
+    (version "7.4.2")
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "http://www.hboehm.info/gc/gc_source/libatomic_ops-"
+                    "http://www.ivmaisoft.com/_bin/atomic_ops/libatomic_ops-"
                     version ".tar.gz"))
               (sha256
                (base32
-                "0njv3n63zw6v45k68z6dz14g2hpk5p230ncwmdfkglsljb1cqx98"))))
+                "1pdm0h1y7bgkczr8byg20r6bq15m5072cqm5pny4f9crc9gn3yh4"))))
     (build-system gnu-build-system)
     (outputs '("out" "debug"))
     (synopsis "Accessing hardware atomic memory update operations")
@@ -88,14 +89,14 @@ lock-free code, experiment with thread programming paradigms, etc.")
 
 (define-public libgc
   (package (inherit libgc-7.2)
-    (version "7.4.0")
+    (version "7.4.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://www.hboehm.info/gc/gc_source/gc-"
                                   version ".tar.gz"))
               (sha256
                (base32
-                "10z2nph62ilab063wygg2lv0jxlsbcf2az9w1lx01jzqj5lzry31"))))
+                "18mg28rr6kwr5clc65k4l4hkyy4kd16amx831sjf8q2lqkbhlck3"))))
 
     ;; New dependencies.
     (native-inputs `(("pkg-config" ,pkg-config)))
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index a1d2fcaaed..79c22a5974 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -26,6 +26,8 @@
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages ed)
+  #:use-module (gnu packages file)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages multiprecision)
@@ -106,11 +108,20 @@
                                  (current-source-location)
                                  #:guile %bootstrap-guile)))
 
+(define file-boot0
+  (package-with-bootstrap-guile
+   (package-with-explicit-inputs file
+                                 `(("make" ,gnu-make-boot0)
+                                   ,@%bootstrap-inputs)
+                                 (current-source-location)
+                                 #:guile %bootstrap-guile)))
+
 
 (define %boot0-inputs
   `(("make" ,gnu-make-boot0)
     ("diffutils" ,diffutils-boot0)
     ("findutils" ,findutils-boot0)
+    ("file" ,file-boot0)
     ,@%bootstrap-inputs))
 
 (define* (nix-system->gnu-triplet
@@ -663,6 +674,7 @@ store.")
                ("gzip" ,gzip)
                ("bzip2" ,bzip2)
                ("xz" ,xz)
+               ("file" ,file)
                ("diffutils" ,diffutils)
                ("patch" ,patch)
                ("sed" ,sed)
diff --git a/gnu/packages/cyrus-sasl.scm b/gnu/packages/cyrus-sasl.scm
index 1913f93f0d..0c92cc36a1 100644
--- a/gnu/packages/cyrus-sasl.scm
+++ b/gnu/packages/cyrus-sasl.scm
@@ -49,7 +49,13 @@
    (arguments
     '(#:configure-flags (list (string-append "--with-plugindir="
                                              (assoc-ref %outputs "out")
-                                             "/lib/sasl2"))))
+                                             "/lib/sasl2"))
+
+      ;; The 'plugins' directory has shared source files, such as
+      ;; 'plugin_common.c'.  When building the shared libraries there, libtool
+      ;; ends up doing "ln -s plugin_common.lo plugin_common.o", which can
+      ;; fail with EEXIST when building things in parallel.
+      #:parallel-build? #f))
    (synopsis "Cyrus SASL, an implementation of the Simple Authentication Security Layer framework")
    (description
     "SASL (Simple Authentication Security Layer) is an Internet
diff --git a/gnu/packages/file.scm b/gnu/packages/file.scm
index f53c22f4cd..601b158128 100644
--- a/gnu/packages/file.scm
+++ b/gnu/packages/file.scm
@@ -27,17 +27,15 @@
 (define-public file
   (package
    (name "file")
-   (version "5.18")
+   (version "5.19")
    (source (origin
             (method url-fetch)
             (uri (string-append "ftp://ftp.astron.com/pub/file/file-"
                    version ".tar.gz"))
             (sha256 (base32
-                     "01xz106biz6x4h5ilymg5v3367djvgnfp4lm87132cjqdmqgn6b5"))))
+                     "0z1sgrcfy6d285kj5izy1yypf371bjl3247plh9ppk0svaxv714l"))
+            (patches (list (search-patch "file-CVE-2014-3587.patch")))))
    (build-system gnu-build-system)
-   (native-inputs
-    ;; This package depends upon a native install of itself.
-     (if (%current-target-system) `(("file" ,file)) '() ))
    (synopsis "file, a file type guesser")
    (description
     "The file command is a file type guesser, a command-line tool that tells
diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 718059e527..10506197f3 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -57,15 +57,12 @@
                                (string-append "### " match))))
                           '())
 
-                    ;; XXX FIXME gawk 4.1.1 was bootstrapped with a prerelease
-                    ;; libtool, which fails on MIPS in the absence of
-                    ;; /usr/bin/file.  As a temporary workaround, we patch
-                    ;; the configure script to hardcode use of the little
-                    ;; endian N32 ABI on MIPS.
+                    ;; XXX FIXME prerelease libtool fails on MIPS in the
+                    ;; absence of /usr/bin/file.
                     ,@(if (equal? "mips64el-linux" (or (%current-target-system)
                                                        (%current-system)))
                           '((substitute* "extension/configure"
-                              (("\\$emul") "elf32ltsmipn32")))
+                              (("/usr/bin/file") (which "file"))))
                           '())))
                 %standard-phases)))
    (inputs `(("libsigsegv" ,libsigsegv)
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 66888389d4..02601585b9 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -268,7 +268,8 @@ Go.  It also includes runtime support libraries for these languages.")
                                  version "/gcc-" version ".tar.bz2"))
              (sha256
               (base32
-               "07hg10zs7gnqz58my10ch0zygizqh0z0bz6pv4pgxx45n48lz3ka"))))))
+               "07hg10zs7gnqz58my10ch0zygizqh0z0bz6pv4pgxx45n48lz3ka"))
+             (patches (list (search-patch "gcc-fix-pr61801.patch")))))))
 
 (define-public gcc-4.9
   (package (inherit gcc-4.7)
diff --git a/gnu/packages/gnutls.scm b/gnu/packages/gnutls.scm
index 917dfdd228..89fc86d6ad 100644
--- a/gnu/packages/gnutls.scm
+++ b/gnu/packages/gnutls.scm
@@ -63,7 +63,7 @@ specifications.")
 (define-public gnutls
   (package
     (name "gnutls")
-    (version "3.2.15")
+    (version "3.2.16")
     (source (origin
              (method url-fetch)
              (uri
@@ -75,12 +75,8 @@ specifications.")
                              "/gnutls-" version ".tar.xz"))
              (sha256
               (base32
-               "1fbpr9r1r2y803s3avwjpy1higqsz85dyb302kvmh0i29frwgg9h"))))
+               "1bmwhg8y3mz5w2klclf5dz9502477kaj8r8db7k45fwb9ah3c63q"))))
     (build-system gnu-build-system)
-    (arguments
-     ;; Work around build issue reported at
-     ;; <https://lists.gnu.org/archive/html/guix-devel/2014-03/msg00027.html>.
-     '(#:make-flags '("CPPFLAGS=-DENABLE_RSA_EXPORT")))
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (inputs
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 906763e924..e928c311e4 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -122,11 +122,7 @@ without requiring the source code to be rewritten.")
    (native-inputs `(("pkgconfig" ,pkg-config)))
    (inputs `(("libffi" ,libffi)
              ("readline" ,readline)
-
-             ;; TODO: On next core-updates, make Bash input unconditional.
-             ,@(if (%current-target-system)
-                   `(("bash" ,bash))
-                   '())))
+             ("bash" ,bash)))
 
    (propagated-inputs
     `( ;; These ones aren't normally needed here, but since `libguile-2.0.la'
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 1ab79ad954..a55a5456af 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -19,7 +19,6 @@
 (define-module (gnu packages image)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages file)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages xml)
@@ -102,20 +101,11 @@ image files in PBMPLUS PPM/PGM, GIF, BMP, and Targa file formats.")
    (inputs `(("zlib" ,zlib)
              ("libjpeg-8" ,libjpeg-8)))
              ;; currently does not compile with libjpeg version 9
-   (native-inputs `(("file" ,file)))
    (arguments
     `(#:configure-flags
       (list (string-append "--with-jpeg-include-dir="
                            (assoc-ref %build-inputs "libjpeg-8")
-                           "/include"))
-      #:phases
-      (alist-cons-before
-       'configure 'patch-configure
-       (lambda _
-         (substitute* "configure"
-           (("`/usr/bin/file")
-            (string-append "`" (which "file")))))
-      %standard-phases)))
+                           "/include"))))
    (synopsis "Libtiff, a library for handling TIFF files")
    (description
     "Libtiff provides support for the Tag Image File Format (TIFF), a format
diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm
index c5e265087e..33e10d6fc2 100644
--- a/gnu/packages/libffi.scm
+++ b/gnu/packages/libffi.scm
@@ -29,11 +29,11 @@
          ;; available in $includedir where some users expect them.
          '(lambda* (#:key outputs #:allow-other-keys)
             (define out (assoc-ref outputs "out"))
-            (symlink (string-append out "/lib/libffi-3.0.13/include")
+            (symlink (string-append out "/lib/libffi-3.1/include")
                      (string-append out "/include")))))
    (package
     (name "libffi")
-    (version "3.0.13")
+    (version "3.1")
     (source (origin
              (method url-fetch)
              (uri
@@ -41,8 +41,7 @@
                              name "-" version ".tar.gz"))
              (sha256
               (base32
-               "077ibkf84bvcd6rw1m6jb107br63i2pp301rkmsbgg6300adxp8x"))
-             (patches (list (search-patch "libffi-mips-n32-fix.patch")))))
+               "1sznmrhcswwbyqla9y2ximlkzbxks59wjfs3lh7qf8ayranyxzlp"))))
     (build-system gnu-build-system)
     (arguments `(#:phases (alist-cons-after 'install 'post-install
                                             ,post-install-phase
diff --git a/gnu/packages/libunistring.scm b/gnu/packages/libunistring.scm
index a7681009ac..ddafd74202 100644
--- a/gnu/packages/libunistring.scm
+++ b/gnu/packages/libunistring.scm
@@ -25,7 +25,7 @@
 (define-public libunistring
   (package
    (name "libunistring")
-   (version "0.9.3")
+   (version "0.9.4")
    (source (origin
             (method url-fetch)
             (uri (string-append
@@ -33,7 +33,7 @@
                   version ".tar.gz"))
             (sha256
              (base32
-              "18q620269xzpw39dwvr9zpilnl2dkw5z5kz3mxaadnpv4k3kw3b1"))))
+              "19nqvn19hz25ig9dbmh2di5j1r7v852x9mlnq0nr0hka51ins97m"))))
    (propagated-inputs '())                  ; FIXME: add libiconv when !glibc
    (build-system gnu-build-system)
    (arguments
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 29c2878d84..561275c05f 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -379,7 +379,16 @@ providing the system administrator with some help in common tasks.")
               (sha256
                (base32
                 "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))
-              (patches (list (search-patch "util-linux-perl.patch")))))
+              (patches (list (search-patch "util-linux-perl.patch")))
+              (modules '((guix build utils)))
+              (snippet
+               ;; We take the 'logger' program from GNU Inetutils, so remove
+               ;; it from here.
+               '(substitute* "misc-utils/Makefile.in"
+                  (("PROGRAMS =(.*) logger(.*)" _ before after)
+                   (string-append "PROGRAMS =" before " " after))
+                  (("MANS =(.*) logger\\.1(.*)" _ before after)
+                   (string-append "MANS =" before " " after))))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags '("--disable-use-tty-group"
diff --git a/gnu/packages/mc.scm b/gnu/packages/mc.scm
index aba14d59ac..6e3747c943 100644
--- a/gnu/packages/mc.scm
+++ b/gnu/packages/mc.scm
@@ -28,7 +28,6 @@
   #:use-module (gnu packages ssh)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages check)
-  #:use-module (gnu packages file)
   #:use-module (gnu packages perl))
 
 (define-public mc
@@ -46,7 +45,6 @@
       (patches (list (search-patch "mc-fix-ncurses-build.patch")))))
     (build-system gnu-build-system)
     (native-inputs `(("pkg-config" ,pkg-config)
-                     ("file" ,file)
                      ("perl" ,perl)))
     (inputs `(("aspell" ,aspell)
               ("ncurses" ,ncurses)
@@ -55,14 +53,7 @@
               ("check" ,check)))
     (arguments
      `(#:configure-flags
-       '("--with-screen=ncurses" "--enable-aspell")
-       #:phases
-       (alist-cons-before
-        'configure 'patch-configure
-        (lambda _
-          (substitute* "configure"
-            (("/usr/bin/file") (which "file"))))
-        %standard-phases)))
+       '("--with-screen=ncurses" "--enable-aspell")))
     (home-page "http://www.midnight-commander.org")
     (synopsis "Graphical file manager")
     (description
diff --git a/gnu/packages/mcrypt.scm b/gnu/packages/mcrypt.scm
index eac8c72c5e..12a4827224 100644
--- a/gnu/packages/mcrypt.scm
+++ b/gnu/packages/mcrypt.scm
@@ -23,8 +23,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages perl)
-  #:use-module (gnu packages file))
+  #:use-module (gnu packages perl))
 
 (define-public mcrypt
   (package
@@ -68,7 +67,6 @@ them.")
        (base32
         "0gipgb939vy9m66d3k8il98rvvwczyaw2ixr8yn6icds9c3nrsz4"))))
     (build-system gnu-build-system)
-    (native-inputs `(("file" ,file)))
     (home-page "http://mcrypt.sourceforge.net/")
     (synopsis "Encryption algorithm library")
     (description
@@ -95,8 +93,7 @@ XTEA, 3WAY, TWOFISH, BLOWFISH, ARCFOUR, WAKE and more.")
       (patches (list (search-patch "mhash-keygen-test-segfault.patch")))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("file" ,file)
-       ("perl" ,perl)))                 ;for tests
+     `(("perl" ,perl)))                 ;for tests
     (home-page "http://mhash.sourceforge.net/")
     (synopsis "Thread-safe hash library")
     (description
diff --git a/gnu/packages/patches/coreutils-dummy-man.patch b/gnu/packages/patches/coreutils-dummy-man.patch
index f6a6a31002..a43cfc47c3 100644
--- a/gnu/packages/patches/coreutils-dummy-man.patch
+++ b/gnu/packages/patches/coreutils-dummy-man.patch
@@ -7,15 +7,15 @@ would appear when compiling:
 
   dummy-man: too many non-option arguments
 
---- coreutils-8.22/Makefile.in	2013-12-13 16:20:00.000000000 +0100
-+++ coreutils-8.22/Makefile.in	2014-02-28 10:53:27.000000000 +0100
-@@ -9977,8 +9977,8 @@ man/yes.1:       src/yes
+--- coreutils-8.23/Makefile.in	2014-07-18 18:22:24.000000000 -0400
++++ coreutils-8.23/Makefile.in	2014-08-03 20:21:10.849158313 -0400
+@@ -14076,8 +14076,8 @@
  	  && $(run_help2man)						\
  		     --source='$(PACKAGE_STRING)'			\
  		     --include=$(srcdir)/man/$$name.x			\
--		     --output=$$t/$$name.1 $$t/$$name			\
+-		     --output=$$t/$$name.1 $$t/$$argv			\
  		     --info-page='coreutils \(aq'$$name' invocation\(aq' \
-+		     --output=$$t/$$name.1 $$t/$$name			\
++		     --output=$$t/$$name.1 $$t/$$argv			\
  	  && sed \
  	       -e 's|$*\.td/||g' \
  	       -e '/For complete documentation/d' \
diff --git a/gnu/packages/patches/coreutils-skip-nohup.patch b/gnu/packages/patches/coreutils-skip-nohup.patch
deleted file mode 100644
index f5283a6b21..0000000000
--- a/gnu/packages/patches/coreutils-skip-nohup.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-commit 5dce6bdfafc930dfd17d5d16aea7d1add3472066
-Author: Pádraig Brady <P@draigBrady.com>
-Date:   Wed Mar 5 15:14:07 2014 +0000
-
-    tests: fix false failure in nohup.sh in non tty builds
-    
-    * tests/misc/nohup.sh: When running tests without a controlling tty,
-    an exec failure is triggered in a subshell, which causes POSIX
-    shells to immediately exit the subshell.  This was brought
-    to notice by the newly conforming bash 4.3.
-    Fixes http:/bugs.gnu.org/16940
-
-diff --git a/tests/misc/nohup.sh b/tests/misc/nohup.sh
-index 6d2b515..2328b43 100755
---- a/tests/misc/nohup.sh
-+++ b/tests/misc/nohup.sh
-@@ -63,6 +63,11 @@ rm -f nohup.out err
- # to stderr must be fatal.  Requires stdout to be terminal.
- if test -w /dev/full && test -c /dev/full; then
- (
-+  # POSIX shells immediately exit the subshell on exec error.
-+  # So check we can write to /dev/tty before the exec, which
-+  # isn't possible if we've no controlling tty for example.
-+  test -c /dev/tty && >/dev/tty || exit 0
-+
-   exec >/dev/tty
-   test -t 1 || exit 0
-   nohup echo hi 2> /dev/full
diff --git a/gnu/packages/patches/file-CVE-2014-3587.patch b/gnu/packages/patches/file-CVE-2014-3587.patch
new file mode 100644
index 0000000000..cf88bf5f3e
--- /dev/null
+++ b/gnu/packages/patches/file-CVE-2014-3587.patch
@@ -0,0 +1,16 @@
+Fixes CVE-2014-3587.  Copied from upstream commit
+0641e56be1af003aa02c7c6b0184466540637233.
+
+--- file-5.19/src/cdf.c.orig	2014-06-09 09:04:37.000000000 -0400
++++ file-5.19/src/cdf.c	2014-08-26 11:55:23.887118898 -0400
+@@ -824,6 +824,10 @@
+ 		q = (const uint8_t *)(const void *)
+ 		    ((const char *)(const void *)p + ofs
+ 		    - 2 * sizeof(uint32_t));
++		if (q < p) {
++			DPRINTF(("Wrapped around %p < %p\n", q, p));
++			goto out;
++		}
+ 		if (q > e) {
+ 			DPRINTF(("Ran of the end %p > %p\n", q, e));
+ 			goto out;
diff --git a/gnu/packages/patches/gcc-fix-pr61801.patch b/gnu/packages/patches/gcc-fix-pr61801.patch
new file mode 100644
index 0000000000..e9cd92aa1c
--- /dev/null
+++ b/gnu/packages/patches/gcc-fix-pr61801.patch
@@ -0,0 +1,25 @@
+GCC bug fix for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801>.
+Initially discussed at
+ <http://lists.gnu.org/archive/html/guix-devel/2014-09/msg00283.html>.
+Patch from <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=212740>.
+
+2014-07-17  Richard Biener  <rguenther@suse.de>
+
+        PR rtl-optimization/61801
+
+        * sched-deps.c (sched_analyze_2): For ASM_OPERANDS and
+        ASM_INPUT don't set reg_pending_barrier if it appears in a
+        debug-insn.
+
+--- gcc-4_8-branch/gcc/sched-deps.c	2014/07/17 07:48:49	212739
++++ gcc-4_8-branch/gcc/sched-deps.c	2014/07/17 07:49:44	212740
+@@ -2744,7 +2744,8 @@
+ 	   Consider for instance a volatile asm that changes the fpu rounding
+ 	   mode.  An insn should not be moved across this even if it only uses
+ 	   pseudo-regs because it might give an incorrectly rounded result.  */
+-	if (code != ASM_OPERANDS || MEM_VOLATILE_P (x))
++	if ((code != ASM_OPERANDS || MEM_VOLATILE_P (x))
++	    && !DEBUG_INSN_P (insn))
+ 	  reg_pending_barrier = TRUE_BARRIER;
+ 
+ 	/* For all ASM_OPERANDS, we must traverse the vector of input operands.
diff --git a/gnu/packages/patches/libffi-mips-n32-fix.patch b/gnu/packages/patches/libffi-mips-n32-fix.patch
deleted file mode 100644
index 87ec48f883..0000000000
--- a/gnu/packages/patches/libffi-mips-n32-fix.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Fix handling of uint32_t arguments on the MIPS N32 ABI.
-
-Patch by Mark H Weaver <mhw@netris.org>.
-
---- libffi/src/mips/ffi.c.orig	2013-03-16 07:19:39.000000000 -0400
-+++ libffi/src/mips/ffi.c	2013-10-22 01:11:03.111985247 -0400
-@@ -170,7 +170,14 @@
- 		break;
- 		  
- 	      case FFI_TYPE_UINT32:
-+#ifdef FFI_MIPS_N32
-+		/* The N32 ABI requires that 32-bit integers
-+		   be sign-extended to 64-bits, regardless of
-+		   whether they are signed or unsigned. */
-+		*(ffi_arg *)argp = *(SINT32 *)(* p_argv);
-+#else
- 		*(ffi_arg *)argp = *(UINT32 *)(* p_argv);
-+#endif
- 		break;
- 
- 	      /* This can only happen with 64bit slots.  */
diff --git a/gnu/packages/pretty-print.scm b/gnu/packages/pretty-print.scm
index 8c51b54f18..07837eb1ac 100644
--- a/gnu/packages/pretty-print.scm
+++ b/gnu/packages/pretty-print.scm
@@ -30,8 +30,7 @@
   #:use-module (gnu packages bison)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages gperf)
-  #:use-module (gnu packages perl)
-  #:use-module (gnu packages file))
+  #:use-module (gnu packages perl))
 
 (define-public a2ps
   (package
@@ -53,45 +52,39 @@
        ("imagemagick" ,imagemagick)))
     (native-inputs
      `(("gperf" ,gperf)
-       ("perl" ,perl)
-       ("file" ,file)))
+       ("perl" ,perl)))
     (arguments
      '(#:phases (alist-cons-before
-                 'configure 'patch-configure
+                 'build 'patch-scripts
                  (lambda _
-                   (substitute* "configure"
-                     (("/usr/bin/file") (which "file"))))
+                   (substitute*
+                       '("afm/make_fonts_map.sh"
+                         "tests/defs"
+                         "tests/backup.tst"
+                         "tests/styles.tst")
+                     (("/bin/rm") (which "rm"))))
                  (alist-cons-before
-                  'build 'patch-scripts
-                  (lambda _
-                    (substitute*
-                        '("afm/make_fonts_map.sh"
-                          "tests/defs"
-                          "tests/backup.tst"
-                          "tests/styles.tst")
-                      (("/bin/rm") (which "rm"))))
-                  (alist-cons-before
-                   'check 'patch-test-files
-                   ;; Alternatively, we could unpatch the shebangs in tstfiles
-                   (lambda* (#:key inputs #:allow-other-keys)
-                     (let ((perl (assoc-ref inputs "perl")))
-                       (substitute* '("tests/ps-ref/includeres.ps"
-                                      "tests/gps-ref/includeres.ps")
-                         (("/usr/local/bin/perl")
-                          (string-append perl "/bin/perl"))))
-                     ;; Some of the reference postscript contain a 'version 3'
-                     ;; string that in inconsistent with the source text in the
-                     ;; tstfiles directory.  Erroneous search-and-replace?
-                     (substitute* '("tests/ps-ref/InsertBlock.ps"
-                                    "tests/gps-ref/InsertBlock.ps"
-                                    "tests/ps-ref/bookie.ps"
-                                    "tests/gps-ref/bookie.ps")
-                       (("version 3") "version 2"))
-                     (substitute* '("tests/ps-ref/psmandup.ps"
-                                    "tests/gps-ref/psmandup.ps")
-                       (("#! */bin/sh") (string-append
-                                         "#!" (which "sh")))))
-                   %standard-phases)))))
+                  'check 'patch-test-files
+                  ;; Alternatively, we could unpatch the shebangs in tstfiles
+                  (lambda* (#:key inputs #:allow-other-keys)
+                    (let ((perl (assoc-ref inputs "perl")))
+                      (substitute* '("tests/ps-ref/includeres.ps"
+                                     "tests/gps-ref/includeres.ps")
+                        (("/usr/local/bin/perl")
+                         (string-append perl "/bin/perl"))))
+                    ;; Some of the reference postscript contain a 'version 3'
+                    ;; string that in inconsistent with the source text in the
+                    ;; tstfiles directory.  Erroneous search-and-replace?
+                    (substitute* '("tests/ps-ref/InsertBlock.ps"
+                                   "tests/gps-ref/InsertBlock.ps"
+                                   "tests/ps-ref/bookie.ps"
+                                   "tests/gps-ref/bookie.ps")
+                      (("version 3") "version 2"))
+                    (substitute* '("tests/ps-ref/psmandup.ps"
+                                   "tests/gps-ref/psmandup.ps")
+                      (("#! */bin/sh") (string-append
+                                        "#!" (which "sh")))))
+                  %standard-phases))))
     (home-page "http://www.gnu.org/software/a2ps")
     (synopsis "Any file to PostScript, including pretty-printing")
     (description
@@ -115,16 +108,9 @@ special cases, such as pretty-printing \"--help\" output.")
        (base32
         "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
     (build-system gnu-build-system)
-    (native-inputs `(("file" ,file)))
     (arguments
      ;; Must define DIFF_CMD for tests to pass
-     '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")
-       #:phases (alist-cons-before
-                 'configure 'patch-configure
-                 (lambda _
-                   (substitute* "configure"
-                     (("/usr/bin/file") (which "file"))))
-                 %standard-phases)))
+     '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")))
     (home-page "http://www.gnu.org/software/trueprint")
     (synopsis "Pretty-print C sources and other plain text to PostScript")
     (description
@@ -178,34 +164,28 @@ different programming languages.")
      `(("boost" ,boost)))
     (native-inputs
      `(("bison" ,bison)
-       ("flex" ,flex)
-       ("file" ,file)))
+       ("flex" ,flex)))
     (arguments
      `(#:configure-flags
        (list (string-append "--with-boost="
                             (assoc-ref %build-inputs "boost")))
        #:parallel-tests? #f             ;There appear to be race conditions
        #:phases (alist-cons-before
-                 'configure 'patch-configure
+                 'check 'patch-test-files
                  (lambda _
-                   (substitute* "configure"
-                     (("/usr/bin/file") (which "file"))))
-                 (alist-cons-before
-                  'check 'patch-test-files
-                  (lambda _
-                    ;; Unpatch shebangs in test input so that source-highlight
-                    ;; is still able to infer input language
-                    (substitute* '("tests/test.sh"
-                                   "tests/test2.sh"
-                                   "tests/test.tcl")
-                      (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
-                    ;; Initial patching unrecoverably removes whitespace, so
-                    ;; remove it also in the comparison output.
-                    (substitute* '("tests/test.sh.html"
-                                   "tests/test2.sh.html"
-                                   "tests/test.tcl.html")
-                      (("#! */bin/sh") "#!/bin/sh")))
-                  %standard-phases))))
+                   ;; Unpatch shebangs in test input so that source-highlight
+                   ;; is still able to infer input language
+                   (substitute* '("tests/test.sh"
+                                  "tests/test2.sh"
+                                  "tests/test.tcl")
+                     (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
+                   ;; Initial patching unrecoverably removes whitespace, so
+                   ;; remove it also in the comparison output.
+                   (substitute* '("tests/test.sh.html"
+                                  "tests/test2.sh.html"
+                                  "tests/test.tcl.html")
+                     (("#! */bin/sh") "#!/bin/sh")))
+                 %standard-phases)))
     (home-page "http://www.gnu.org/software/src-highlite")
     (synopsis "Produce a document with syntax highlighting from a source file")
     (description
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 8636931ed9..17fa7afd8d 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -106,6 +106,35 @@ working directory."
       (and (zero? (system* "tar" "xvf" source))
            (chdir (first-subdirectory ".")))))
 
+;; See <http://bugs.gnu.org/17840>.
+(define* (patch-usr-bin-file #:key native-inputs inputs
+                             (patch-/usr/bin/file? #t)
+                             #:allow-other-keys)
+  "Patch occurrences of /usr/bin/file in configure, if present."
+  (when patch-/usr/bin/file?
+    (let ((file "configure")
+          (file-command (or (and=> (assoc-ref (or native-inputs inputs) "file")
+                                   (cut string-append <> "/bin/file"))
+                            (which "file"))))
+      (cond ((not (file-exists? file))
+             (format (current-error-port)
+                     "patch-usr-bin-file: warning: `~a' not found~%"
+                     file))
+            ((not file-command)
+             (format (current-error-port)
+                     "patch-usr-bin-file: warning: `file' not found in PATH~%"))
+            (else
+             (let ((st (stat file)))
+               (substitute* file
+                 (("/usr/bin/file")
+                  (begin
+                    (format (current-error-port)
+                            "patch-usr-bin-file: ~a: changing `~a' to `~a'~%"
+                            file "/usr/bin/file" file-command)
+                    file-command)))
+               (set-file-time file st))))))
+  #t)
+
 (define* (patch-source-shebangs #:key source #:allow-other-keys)
   "Patch shebangs in all source files; this includes non-executable
 files such as `.in' templates.  Most scripts honor $SHELL and
@@ -353,6 +382,7 @@ makefiles."
   (let-syntax ((phases (syntax-rules ()
                          ((_ p ...) `((p . ,p) ...)))))
     (phases set-paths unpack
+            patch-usr-bin-file
             patch-source-shebangs configure patch-generated-file-shebangs
             build check install
             patch-shebangs strip)))
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 2f3dc9cad0..cda4fb12ef 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -25,6 +25,7 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 regex)
   #:use-module (ice-9 rdelim)
+  #:use-module (ice-9 format)
   #:use-module (rnrs bytevectors)
   #:use-module (rnrs io ports)
   #:re-export (alist-cons
@@ -582,14 +583,15 @@ When KEEP-MTIME? is true, the atime/mtime of FILE are kept unchanged."
 
   (let ((st (stat file)))
    (substitute* file
-     (("^ *SHELL[[:blank:]]*=[[:blank:]]*([[:graph:]]*/)([[:graph:]]+)[[:blank:]]*" _ dir shell)
+     (("^ *SHELL[[:blank:]]*=[[:blank:]]*([[:graph:]]*/)([[:graph:]]+)(.*)$"
+       _ dir shell args)
       (let* ((old (string-append dir shell))
              (new (or (find-shell shell) old)))
         (unless (string=? new old)
           (format (current-error-port)
                   "patch-makefile-SHELL: ~a: changing `SHELL' from `~a' to `~a'~%"
                   file old new))
-        (string-append "SHELL = " new "\n"))))
+        (string-append "SHELL = " new args))))
 
    (when keep-mtime?
      (set-file-time file st))))
@@ -686,8 +688,7 @@ known as `nuke-refs' in Nixpkgs."
                              result))))))
 
 (define* (wrap-program prog #:rest vars)
-  "Rename PROG to .PROG-real and make PROG a wrapper.  VARS should look like
-this:
+  "Make a wrapper for PROG.  VARS should look like this:
 
   '(VARIABLE DELIMITER POSITION LIST-OF-DIRECTORIES)
 
@@ -696,23 +697,44 @@ where DELIMITER is optional.  ':' will be used if DELIMITER is not given.
 For example, this command:
 
   (wrap-program \"foo\"
-                '(\"PATH\" \":\" = (\"/nix/.../bar/bin\"))
-                '(\"CERT_PATH\" suffix (\"/nix/.../baz/certs\"
+                '(\"PATH\" \":\" = (\"/gnu/.../bar/bin\"))
+                '(\"CERT_PATH\" suffix (\"/gnu/.../baz/certs\"
                                         \"/qux/certs\")))
 
 will copy 'foo' to '.foo-real' and create the file 'foo' with the following
 contents:
 
   #!location/of/bin/bash
-  export PATH=\"/nix/.../bar/bin\"
-  export CERT_PATH=\"$CERT_PATH${CERT_PATH:+:}/nix/.../baz/certs:/qux/certs\"
+  export PATH=\"/gnu/.../bar/bin\"
+  export CERT_PATH=\"$CERT_PATH${CERT_PATH:+:}/gnu/.../baz/certs:/qux/certs\"
   exec location/of/.foo-real
 
 This is useful for scripts that expect particular programs to be in $PATH, for
 programs that expect particular shared libraries to be in $LD_LIBRARY_PATH, or
-modules in $GUILE_LOAD_PATH, etc."
-  (let ((prog-real (string-append (dirname prog) "/." (basename prog) "-real"))
-        (prog-tmp  (string-append (dirname prog) "/." (basename prog) "-tmp")))
+modules in $GUILE_LOAD_PATH, etc.
+
+If PROG has previously been wrapped by wrap-program the wrapper will point to
+the previous wrapper."
+  (define (wrapper-file-name number)
+    (format #f "~a/.~a-wrap-~2'0d" (dirname prog) (basename prog) number))
+  (define (next-wrapper-number)
+    (let ((wrappers
+           (find-files (dirname prog)
+                       (string-append "\\." (basename prog) "-wrap-.*"))))
+      (if (null? wrappers)
+          0
+          (string->number (string-take-right (last wrappers) 2)))))
+  (define (wrapper-target number)
+    (if (zero? number)
+        (let ((prog-real (string-append (dirname prog) "/."
+                                        (basename prog) "-real")))
+          (copy-file prog prog-real)
+          prog-real)
+        (wrapper-file-name number)))
+  (let* ((number   (next-wrapper-number))
+         (target   (wrapper-target number))
+         (wrapper  (wrapper-file-name (1+ number)))
+         (prog-tmp (string-append target "-tmp")))
     (define (export-variable lst)
       ;; Return a string that exports an environment variable.
       (match lst
@@ -735,8 +757,6 @@ modules in $GUILE_LOAD_PATH, etc."
          (format #f "export ~a=\"$~a${~a:+:}~a\""
                  var var var (string-join rest ":")))))
 
-    (copy-file prog prog-real)
-
     (with-output-to-file prog-tmp
       (lambda ()
         (format #t
@@ -744,9 +764,11 @@ modules in $GUILE_LOAD_PATH, etc."
                 (which "bash")
                 (string-join (map export-variable vars)
                              "\n")
-                (canonicalize-path prog-real))))
+                (canonicalize-path target))))
 
     (chmod prog-tmp #o755)
+    (rename-file prog-tmp wrapper)
+    (symlink wrapper prog-tmp)
     (rename-file prog-tmp prog)))
 
 ;;; Local Variables:
diff --git a/tests/build-utils.scm b/tests/build-utils.scm
index e94f04b239..a5ea640c47 100644
--- a/tests/build-utils.scm
+++ b/tests/build-utils.scm
@@ -18,9 +18,24 @@
 
 
 (define-module (test-build-utils)
+  #:use-module (guix tests)
+  #:use-module (guix store)
+  #:use-module (guix derivations)
   #:use-module (guix build utils)
-  #:use-module (srfi srfi-64))
+  #:use-module (guix packages)
+  #:use-module (guix build-system)
+  #:use-module (guix build-system trivial)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages bootstrap)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-64)
+  #:use-module (rnrs io ports)
+  #:use-module (ice-9 popen))
 
+(define %store
+  (open-connection-for-tests))
+
+
 (test-begin "build-utils")
 
 (test-equal "alist-cons-before"
@@ -80,6 +95,46 @@
                           port
                           cons)))))
 
+(test-assert "wrap-program, one input, multiple calls"
+  (let* ((p (package
+              (name "test-wrap-program") (version "0") (source #f)
+              (synopsis #f) (description #f) (license #f) (home-page #f)
+              (build-system trivial-build-system)
+              (arguments
+               `(#:guile ,%bootstrap-guile
+                 #:modules ((guix build utils))
+                 #:builder
+                 (let* ((out  (assoc-ref %outputs "out"))
+                        (bash (assoc-ref %build-inputs "bash"))
+                        (foo  (string-append out "/foo")))
+                   (begin
+                     (use-modules (guix build utils))
+                     (mkdir out)
+                     (call-with-output-file foo
+                       (lambda (p)
+                         (format p
+                                 "#!~a~%echo \"${GUIX_FOO} ${GUIX_BAR}\"~%"
+                                 bash)))
+                     (chmod foo #o777)
+                     ;; wrap-program uses `which' to find bash for the wrapper
+                     ;; shebang, but it can't know about the bootstrap bash in
+                     ;; the store, since it's not named "bash".  Help it out a
+                     ;; bit by providing a symlink it this package's output.
+                     (symlink bash (string-append out "/bash"))
+                     (setenv "PATH" out)
+                     (wrap-program foo `("GUIX_FOO" prefix ("hello")))
+                     (wrap-program foo `("GUIX_BAR" prefix ("world")))
+                     #t))))
+              (inputs `(("bash" ,(search-bootstrap-binary "bash"
+                                                          (%current-system)))))))
+         (d (package-derivation %store p)))
+    (and (build-derivations %store (pk 'drv d (list d)))
+         (let* ((p    (derivation->output-path d))
+                (foo  (string-append p "/foo"))
+                (pipe (open-input-pipe foo))
+                (str  (get-string-all pipe)))
+           (equal? str "hello world\n")))))
+
 (test-end)