summaryrefslogtreecommitdiff
path: root/app-misc/scrub/files/scrub-2.6.1-bashism-tests.patch
blob: 17999f341cd291949847b7c8fe8dc0d90d7737eb (plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
https://github.com/chaos/scrub/pull/31

From 545d1b9cae8da18864277ca14a227d4adfafdc32 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sun, 10 Jul 2022 10:23:09 +0100
Subject: [PATCH] test: fix bashisms in tests

We're using a /bin/sh shebang but the tests aren't
compatible with a POSIX-compliant /bin/sh (like dash,
instead of the usual bash).

Switch to = instead of == which works the same but
works with both Bash and dash.

If desired, we could switch the shebangs to
/bin/bash which would work.

(Notably, Debian defaults to dash as /bin/sh).
--- a/test/t09
+++ b/test/t09
@@ -4,7 +4,7 @@
 
 TEST=`basename $0 | cut -d- -f1`
 # Test requires root
-test `id -u` == 0 || exit 77
+test `id -u` = 0 || exit 77
 
 EXPFILE=${TEST}-`hostname`.exp
 TESTDEV=/dev/scrub-testdisk
--- a/test/t10
+++ b/test/t10
@@ -4,7 +4,7 @@
 
 TEST=`basename $0 | cut -d- -f1`
 # Test requires root
-test `id -u` == 0 || exit 77
+test `id -u` = 0 || exit 77
 
 EXPFILE=${TEST}-`hostname`.exp
 test -f $EXPFILE || exit 77
--- a/test/t18
+++ b/test/t18
@@ -1,7 +1,7 @@
 #!/bin/sh
 TEST=`basename $0 | cut -d- -f1`
 # Test requires root
-test `id -u` == 0 || exit 77
+test `id -u` = 0 || exit 77
 
 TMPLATE="${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"
 TESTDIR=`mktemp -d $TMPLATE` || exit 1
--- a/test/t19
+++ b/test/t19
@@ -1,7 +1,7 @@
 #!/bin/sh
 TEST=`basename $0 | cut -d- -f1`
 # Test requires root
-test `id -u` == 0 || exit 77
+test `id -u` = 0 || exit 77
 LOOPFILE=`losetup -f` || exit 77
 TMPLATE="${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"
 TESTFILE=`mktemp $TMPLATE` || exit 1
--- a/test/t20
+++ b/test/t20
@@ -1,7 +1,7 @@
 #!/bin/sh
 TEST=`basename $0 | cut -d- -f1`
 # Test requires root
-test `id -u` == 0 || exit 77
+test `id -u` = 0 || exit 77
 LOOPFILE=`losetup -f` || exit 77
 TMPLATE="${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"
 TESTFILE=`mktemp $TMPLATE` || exit 1
--- a/test/t21
+++ b/test/t21
@@ -1,7 +1,7 @@
 #!/bin/sh
 TEST=`basename $0 | cut -d- -f1`
 # Test requires root
-test `id -u` == 0 || exit 77
+test `id -u` = 0 || exit 77
 
 TMPLATE="${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"