~ruther/guix-local

ff3c0c1b805453990a42f690f148b41b9dff382a — Cyril Roelandt 12 years ago 1faca89
coreutils: fix test suite

* gnu/packages/patches/coreutils-skip-nohup.patch: patch taken from the git
  repository of coreutils, that makes sure tests/misc/nohup.sh does not fail
  when /dev/tty does not exist.
* gnu/packages/base.scm (coreutils): use it.
* gnu-system.am (dist_patch_DATA): add it.
3 files changed, 32 insertions(+), 1 deletions(-)

M gnu-system.am
M gnu/packages/base.scm
A gnu/packages/patches/coreutils-skip-nohup.patch
M gnu-system.am => gnu-system.am +1 -0
@@ 252,6 252,7 @@ dist_patch_DATA =						\
  gnu/packages/patches/cdparanoia-fpic.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/curl-fix-test172.patch			\
  gnu/packages/patches/dbus-localstatedir.patch			\

M gnu/packages/base.scm => gnu/packages/base.scm +3 -1
@@ 240,7 240,9 @@ used to apply commands with arbitrarily long arguments.")
            (sha256
             (base32
              "04hjzzv434fb8ak3hh3dyhdvg3hqjjwvjmjxqzk1gh2jh6cr8gjv"))
            (patches (list (search-patch "coreutils-dummy-man.patch")))))
            (patches (list (search-patch "coreutils-dummy-man.patch")
                           ;; TODO: remove this patch for >= 8.23
                           (search-patch "coreutils-skip-nohup.patch")))))
   (build-system gnu-build-system)
   (inputs `(("acl"  ,acl)                        ; TODO: add SELinux
             ("gmp"  ,gmp)))

A gnu/packages/patches/coreutils-skip-nohup.patch => gnu/packages/patches/coreutils-skip-nohup.patch +28 -0
@@ 0,0 1,28 @@
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