summary refs log tree commit diff
path: root/pkgs/tools/text/gnupatch
diff options
context:
space:
mode:
authorDanny Wilson <danny@prime.vc>2013-02-28 18:53:50 +0000
committerDanny Wilson <danny@onlinetouch.nl>2013-02-28 20:04:11 +0100
commit58e6277d77088629b72b2bf9a02f46edb4208c36 (patch)
tree180db4e17b00b7319e6a7f691b219c7db9adbb59 /pkgs/tools/text/gnupatch
parent66798d7aaf79fdb4eca7c1f04f092544b4afa4a6 (diff)
downloadnixlib-58e6277d77088629b72b2bf9a02f46edb4208c36.tar
nixlib-58e6277d77088629b72b2bf9a02f46edb4208c36.tar.gz
nixlib-58e6277d77088629b72b2bf9a02f46edb4208c36.tar.bz2
nixlib-58e6277d77088629b72b2bf9a02f46edb4208c36.tar.lz
nixlib-58e6277d77088629b72b2bf9a02f46edb4208c36.tar.xz
nixlib-58e6277d77088629b72b2bf9a02f46edb4208c36.tar.zst
nixlib-58e6277d77088629b72b2bf9a02f46edb4208c36.zip
Allow GNU Patch tests to run with non-bash shell.
Fix gnused url.
Diffstat (limited to 'pkgs/tools/text/gnupatch')
-rw-r--r--pkgs/tools/text/gnupatch/bashishms.patch67
-rw-r--r--pkgs/tools/text/gnupatch/default.nix5
2 files changed, 70 insertions, 2 deletions
diff --git a/pkgs/tools/text/gnupatch/bashishms.patch b/pkgs/tools/text/gnupatch/bashishms.patch
new file mode 100644
index 000000000000..1a2cfbd8e4a2
--- /dev/null
+++ b/pkgs/tools/text/gnupatch/bashishms.patch
@@ -0,0 +1,67 @@
+http://lists.gnu.org/archive/html/bug-patch/2012-11/msg00001.html
+Tested on Illumos, where ksh is /bin/sh.
+
+--- patch-2.7.1/tests/test-lib.sh
++++ patch-2.7.1/tests/test-lib.sh
+@@ -118,7 +118,7 @@
+ }
+ 
+ if test -z "`echo -n`"; then
+-    if eval 'test -n "${BASH_LINENO[0]}" 2>/dev/null'; then
++    if (eval 'test -n "${BASH_LINENO[0]}"') 2>/dev/null; then
+ 	eval '
+ 	    _start_test() {
+ 		echo -n "[${BASH_LINENO[2]}] $* -- "
+
+--- patch-2.7.1/tests/crlf-handling
++++ patch-2.7.1/tests/crlf-handling
+@@ -14,7 +14,7 @@
+ use_tmpdir
+ 
+ lf2crlf() {
+-    while read l; do echo -e "$l\r"; done
++    while read l; do printf "%s\r\n" "$l"; done
+ }
+ 
+ echo 1 > a
+
+--- patch-2.7.1/tests/merge
++++ patch-2.7.1/tests/merge
+@@ -32,18 +32,20 @@
+     shift
+     done > a.sed
+     echo "$body" | sed -f a.sed > b
+-    shift
+-    while test $# -gt 0 ; do
+-	echo "$1"
++    if test $# -gt 0 ; then
+ 	shift
+-    done > b.sed
++    while test $# -gt 0 ; do
++	echo "$1"
++	shift
++    done
++    fi > b.sed
+     echo "$body" | sed -f b.sed > c
+     rm -f a.sed b.sed
+     output=`diff -u a b | patch $ARGS -f c`
+     status=$?
+     echo "$output" | sed -e '/^$/d' -e '/^patching file c$/d'
+     cat c
+-    test $status == 0 || echo "Status: $status"
++    test $status = 0 || echo "Status: $status"
+ }
+ 
+ x() {
+
+--- patch-2.7.1/tests/read-only-files
++++ patch-2.7.1/tests/read-only-files
+@@ -16,7 +16,7 @@
+
+ : > read-only
+ chmod a-w read-only
+-if : 2> /dev/null > read-only; then
++if (: > read-only) 2> /dev/null; then
+     echo "Files with read-only permissions are writable" \
+         "(probably running as superuser)" >&2
+     exit 77
diff --git a/pkgs/tools/text/gnupatch/default.nix b/pkgs/tools/text/gnupatch/default.nix
index c8c336ad202c..83430a87105c 100644
--- a/pkgs/tools/text/gnupatch/default.nix
+++ b/pkgs/tools/text/gnupatch/default.nix
@@ -14,8 +14,9 @@ stdenv.mkDerivation rec {
     configureFlags = [ "ac_cv_func_strnlen_working=yes" ];
   };
 
-  # Tests fail on FreeBSD due to a Bashism in the tests.
-  doCheck = !stdenv.isFreeBSD;
+  patches = [ ./bashishms.patch ];
+
+  doCheck = true;
 
   meta = {
     description = "GNU Patch, a program to apply differences to files";