about summary refs log tree commit diff
path: root/pkgs/tools/text/gnupatch/bashishms.patch
blob: 1a2cfbd8e4a2d158a5b2cdbe13462aec3537fd45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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