Skip to content

Commit 8f383e8

Browse files
authored
shell: test -a|o is not POSIX (RsyncProject#250)
1 parent ca53896 commit 8f383e8

8 files changed

+14
-14
lines changed

Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ configure.sh config.h.in: configure.ac aclocal.m4
200200
else \
201201
echo "config.h.in has CHANGED."; \
202202
fi
203-
@if test -f configure.sh.old -o -f config.h.in.old; then \
203+
@if test -f configure.sh.old || test -f config.h.in.old; then \
204204
if test "$(MAKECMDGOALS)" = reconfigure; then \
205205
echo 'Continuing with "make reconfigure".'; \
206206
else \

configure.ac

+4-4
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ fi
262262

263263
if test x"$enable_simd" != x"no"; then
264264
# For x86-64 SIMD, g++ >=5 or clang++ >=7 is required
265-
if test x"$host_cpu" = x"x86_64" -o x"$host_cpu" = x"amd64"; then
265+
if test x"$host_cpu" = x"x86_64" || test x"$host_cpu" = x"amd64"; then
266266
AC_LANG(C++)
267267
if test x"$host_cpu" = x"$build_cpu"; then
268268
AC_RUN_IFELSE([AC_LANG_PROGRAM([SIMD_X86_64_TEST],[[if (test_ssse3(42) != 42 || test_sse2(42) != 42 || test_avx2(42) != 42) exit(1);]])],
@@ -326,7 +326,7 @@ if test x"$enable_asm" = x""; then
326326
fi
327327

328328
if test x"$enable_asm" != x"no"; then
329-
if test x"$host_cpu" = x"x86_64" -o x"$host_cpu" = x"amd64"; then
329+
if test x"$host_cpu" = x"x86_64" || test x"$host_cpu" = x"amd64"; then
330330
ASM="$host_cpu"
331331
elif test x"$enable_asm" = x"yes"; then
332332
AC_MSG_RESULT(unavailable)
@@ -712,7 +712,7 @@ yes
712712
#endif],
713713
rsync_cv_HAVE_GETADDR_DEFINES=yes,
714714
rsync_cv_HAVE_GETADDR_DEFINES=no)])
715-
AS_IF([test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"],[
715+
AS_IF([test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" && test x"$ac_cv_type_struct_addrinfo" = x"yes"],[
716716
# Tru64 UNIX has getaddrinfo() but has it renamed in libc as
717717
# something else so we must include <netdb.h> to get the
718718
# redefinition.
@@ -1384,7 +1384,7 @@ else
13841384
esac
13851385
fi
13861386

1387-
if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"$enable_iconv" = x"no"; then
1387+
if test x"$enable_acl_support" = x"no" || test x"$enable_xattr_support" = x"no" || test x"$enable_iconv" = x"no"; then
13881388
AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
13891389
OLD_CFLAGS="$CFLAGS"
13901390
CFLAGS="$CFLAGS -Wno-unused-parameter"

install-sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ else
115115
# might cause directories to be created, which would be especially bad
116116
# if $src (and thus $dsttmp) contains '*'.
117117

118-
if [ -f $src -o -d $src ]
118+
if [ -f $src ] || [ -d $src ]
119119
then
120120
true
121121
else

packaging/prep-auto-dir

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# run "make distclean" before creating the auto-build-save dir.
1414

1515
auto_top='auto-build-save'
16-
if test -d $auto_top -a -d .git; then
16+
if test -d $auto_top && test -d .git; then
1717
desired_branch=`git rev-parse --abbrev-ref HEAD | tr / %`
1818
if test "$desired_branch" = HEAD; then
1919
echo "ERROR: switch to the right build dir manually when in detached HEAD mode." 1>&2

prepare-source

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if test "$dir" != '.'; then
3232
fi
3333
done
3434
for fn in configure.sh config.h.in aclocal.m4; do
35-
test ! -f $fn -a -f "$dir/$fn" && cp -p "$dir/$fn" $fn
35+
test ! -f $fn && test -f "$dir/$fn" && cp -p "$dir/$fn" $fn
3636
done
3737
fi
3838

runtests.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ if test x"$TOOLDIR" = x; then
155155
TOOLDIR=`pwd`
156156
fi
157157
srcdir=`dirname $0`
158-
if test x"$srcdir" = x -o x"$srcdir" = x.; then
158+
if test x"$srcdir" = x || test x"$srcdir" = x.; then
159159
srcdir="$TOOLDIR"
160160
fi
161161
if test x"$rsync_bin" = x; then
@@ -288,7 +288,7 @@ for testscript in $suitedir/$whichtests; do
288288
result=$?
289289
set -e
290290

291-
if [ "x$always_log" = xyes -o \( $result != 0 -a $result != 77 -a $result != 78 \) ]
291+
if [ "x$always_log" = xyes ] || ( [ $result != 0 ] && [ $result != 77 ] && [ $result != 78 ] )
292292
then
293293
echo "----- $testbase log follows"
294294
cat "$scratchdir/test.log"
@@ -336,7 +336,7 @@ echo " $passed passed"
336336
[ "$failed" -gt 0 ] && echo " $failed failed"
337337
[ "$skipped" -gt 0 ] && echo " $skipped skipped"
338338
[ "$missing" -gt 0 ] && echo " $missing missing"
339-
if [ "$full_run" = yes -a "$expect_skipped" != IGNORE ]; then
339+
if [ "$full_run" = yes ] && [ "$expect_skipped" != IGNORE ]; then
340340
skipped_list=`echo "$skipped_list" | sed 's/^,//'`
341341
echo "----- skipped results:"
342342
echo " expected: $expect_skipped"
@@ -353,7 +353,7 @@ echo '------------------------------------------------------------'
353353
# because -e is set.
354354

355355
result=`expr $failed + $missing || true`
356-
if [ "$result" = 0 -a "$skipped_list" != "$expect_skipped" ]; then
356+
if [ "$result" = 0 ] && [ "$skipped_list" != "$expect_skipped" ]; then
357357
result=1
358358
fi
359359
echo "overall result is $result"

testsuite/chmod-temp-dir.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ sdev=`$TOOLDIR/getfsdev $scratchdir`
1717
tdev=$sdev
1818

1919
for tmpdir2 in "${RSYNC_TEST_TMP:-/override-tmp-not-specified}" /run/shm /var/tmp /tmp; do
20-
[ -d "$tmpdir2" -a -w "$tmpdir2" ] || continue
20+
[ -d "$tmpdir2" ] && [ -w "$tmpdir2" ] || continue
2121
tdev=`$TOOLDIR/getfsdev "$tmpdir2"`
2222
[ x$sdev != x$tdev ] && break
2323
done

testsuite/rsync.fns

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ set_cp_destdir() {
6565
# even if the copy rounded microsecond times on the destination file.
6666
cp_touch() {
6767
cp_p "${@}"
68-
if test $# -gt 2 -o -d "$2"; then
68+
if test $# -gt 2 || test -d "$2"; then
6969
set_cp_destdir "${@}" # sets destdir var
7070
while test $# -gt 1; do
7171
destname="$destdir/`basename $1`"

0 commit comments

Comments
 (0)