@@ -18,10 +18,30 @@ path_GNU="$(readlink -fm -- "${path_GNU:-${path_UUTILS}/../gnu}")"
18
18
19
19
# ##
20
20
21
+ # On MacOS there is no system /usr/bin/timeout
22
+ # and trying to add it to /usr/bin (with symlink of copy binary) will fail unless system integrity protection is disabled (not ideal)
23
+ # ref: https://support.apple.com/en-us/102149
24
+ # On MacOS the Homebrew coreutils could be installed and then "sudo ln -s /opt/homebrew/bin/timeout /usr/local/bin/timeout"
25
+ # Set to /usr/local/bin/timeout instead if /usr/bin/timeout is not found
26
+ SYSTEM_TIMEOUT=" timeout"
27
+ if [ -x /usr/bin/timeout ] ; then
28
+ SYSTEM_TIMEOUT=" /usr/bin/timeout"
29
+ elif [ -x /usr/local/bin/timeout ] ; then
30
+ SYSTEM_TIMEOUT=" /usr/local/bin/timeout"
31
+ fi
32
+
33
+ # ##
34
+
35
+ release_tag_GNU=" v9.4"
36
+
21
37
if test ! -d " ${path_GNU} " ; then
22
38
echo " Could not find GNU coreutils (expected at '${path_GNU} ')"
23
39
echo " Run the following to download into the expected path:"
24
40
echo " git clone --recurse-submodules https://github.com/coreutils/coreutils.git \" ${path_GNU} \" "
41
+ echo " After downloading GNU coreutils to \" ${path_GNU} \" run the following commands to checkout latest release tag"
42
+ echo " cd \" ${path_GNU} \" "
43
+ echo " git fetch --all --tags"
44
+ echo " git checkout tags/${release_tag_GNU} "
25
45
exit 1
26
46
fi
27
47
82
102
./bootstrap --skip-po
83
103
./configure --quiet --disable-gcc-warnings
84
104
# Add timeout to to protect against hangs
85
- sed -i ' s|^"\$@|/usr/bin/timeout 600 "\$@|' build-aux/test-driver
105
+ sed -i ' s|^"\$@|' " ${SYSTEM_TIMEOUT} " ' 600 "\$@|' build-aux/test-driver
86
106
# Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils
87
107
sed -i " s/^[[:blank:]]*PATH=.*/ PATH='${UU_BUILD_DIR// \/ / \\ / } \$ (PATH_SEPARATOR)'\"\$\$ PATH\" \\ \/" Makefile
88
108
sed -i ' s| tr | /usr/bin/tr |' tests/init.sh
@@ -153,13 +173,14 @@ sed -i 's|touch |/usr/bin/touch |' tests/cp/reflink-perm.sh tests/ls/block-size.
153
173
sed -i ' s|ln -|/usr/bin/ln -|' tests/cp/link-deref.sh
154
174
sed -i ' s|cp |/usr/bin/cp |' tests/mv/hard-2.sh
155
175
sed -i ' s|paste |/usr/bin/paste |' tests/od/od-endian.sh
156
- sed -i ' s|timeout |/usr/bin/timeout |' tests/tail/follow-stdin.sh
176
+ sed -i ' s|timeout |' " ${SYSTEM_TIMEOUT} " ' |' tests/tail/follow-stdin.sh
157
177
158
178
# Add specific timeout to tests that currently hang to limit time spent waiting
159
- sed -i ' s|\(^\s*\)seq \$|\1/usr/bin/timeout 0.1 seq \$|' tests/seq/seq-precision.sh tests/seq/seq-long-double.sh
179
+ sed -i ' s|\(^\s*\)seq \$|\1' " ${SYSTEM_TIMEOUT} " ' 0.1 seq \$|' tests/seq/seq-precision.sh tests/seq/seq-long-double.sh
160
180
161
- # Remove dup of /usr/bin/ when executed several times
181
+ # Remove dup of /usr/bin/ and /usr/local/bin/ when executed several times
162
182
grep -rlE ' /usr/bin/\s?/usr/bin' init.cfg tests/* | xargs --no-run-if-empty sed -Ei ' s|/usr/bin/\s?/usr/bin/|/usr/bin/|g'
183
+ grep -rlE ' /usr/local/bin/\s?/usr/local/bin' init.cfg tests/* | xargs --no-run-if-empty sed -Ei ' s|/usr/local/bin/\s?/usr/local/bin/|/usr/local/bin/|g'
163
184
164
185
# ### Adjust tests to make them work with Rust/coreutils
165
186
# in some cases, what we are doing in rust/coreutils is good (or better)
0 commit comments