Minor cleanup (#214)
authora1346054 <36859588+a1346054@users.noreply.github.com>
Sun, 26 Sep 2021 23:57:55 +0000 (23:57 +0000)
committerGitHub <noreply@github.com>
Sun, 26 Sep 2021 23:57:55 +0000 (16:57 -0700)
- use `grep -E` and `grep -F` (`egrep` and `fgrep` are non-standard)
- use same hashbang style for all test scripts
- use explicit comparisons in test scripts
- remove redundant ; from test scripts
- make test script not executable, just like all the other scripts
- unify codestyle across all test scripts
- make openssl license exception clearer by having it at the top
- use modern links in COPYING. The text now matches:
  https://www.gnu.org/licenses/gpl-3.0.txt
- fix typo

39 files changed:
COPYING
rsync.h
runtests.sh
support/rsync-no-vanished
testsuite/00-hello.test
testsuite/README.testsuite
testsuite/acls.test
testsuite/atimes.test
testsuite/backup.test
testsuite/batch-mode.test
testsuite/chgrp.test
testsuite/chmod-option.test
testsuite/chmod-temp-dir.test
testsuite/chmod.test
testsuite/chown.test
testsuite/compare-dest.test
testsuite/crtimes.test
testsuite/default-acls.test
testsuite/delay-updates.test
testsuite/delete.test
testsuite/devices.test
testsuite/dir-sgid.test
testsuite/duplicates.test
testsuite/exclude.test
testsuite/executability.test
testsuite/fuzzy.test
testsuite/hardlinks.test
testsuite/itemize.test
testsuite/merge.test
testsuite/missing.test
testsuite/mkpath.test [changed mode: 0755->0644]
testsuite/rsync.fns
testsuite/ssh-basic.test
testsuite/symlink-ignore.test
testsuite/trimslash.test
testsuite/unsafe-byname.test
testsuite/unsafe-links.test
testsuite/wildmatch.test
testsuite/xattrs.test

diff --git a/COPYING b/COPYING
index 104c5831bfdd729d98df8e54ea62beb41836e8a9..fb19ef2ee3794f2c583af016cd149ea3db707b8d 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -1,7 +1,16 @@
+REGARDING OPENSSL AND XXHASH
+
+In addition, as a special exception, the copyright holders give
+permission to dynamically link rsync with the OpenSSL and xxhash
+libraries when those libraries are being distributed in compliance
+with their license terms, and to distribute a dynamically linked
+combination of rsync and these libraries.  This is also considered
+to be covered under the GPL's System Libraries exception.
+
                     GNU GENERAL PUBLIC LICENSE
                        Version 3, 29 June 2007
 
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
@@ -645,7 +654,7 @@ the "copyright" line and a pointer to where the full notice is found.
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 Also add information on how to contact you by electronic and paper mail.
 
@@ -664,20 +673,11 @@ might be different; for a GUI interface, you would use an "about box".
   You should also get your employer (if you work as a programmer) or school,
 if any, to sign a "copyright disclaimer" for the program, if necessary.
 For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
+<https://www.gnu.org/licenses/>.
 
   The GNU General Public License does not permit incorporating your program
 into proprietary programs.  If your program is a subroutine library, you
 may consider it more useful to permit linking proprietary applications with
 the library.  If this is what you want to do, use the GNU Lesser General
 Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
-
-REGARDING OPENSSL AND XXHASH
-
-In addition, as a special exception, the copyright holders give
-permission to dynamically link rsync with the OpenSSL and xxhash
-libraries when those libraries are being distributed in compliance
-with their license terms, and to distribute a dynamically linked
-combination of rsync and these libraries.  This is also considered
-to be covered under the GPL's System Libraries exception.
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/rsync.h b/rsync.h
index 13feb230576988fb24426b0b1763a2b15116000c..92ee1702d276f88cd2e256925db174523f849574 100644 (file)
--- a/rsync.h
+++ b/rsync.h
                             == ((unsigned)(b2) & (unsigned)(mask)))
 
 /* Update this if you make incompatible changes and ALSO update the
- * SUBPROTOCOL_VERSION if it is not a final (offical) release. */
+ * SUBPROTOCOL_VERSION if it is not a final (official) release. */
 #define PROTOCOL_VERSION 31
 
 /* This is used when working on a new protocol version or for any unofficial
index ecb383e81e03986c43d5cf40957edd2a056088f0..eb108706b2ced21a50e39130a8538d018837dbda 100755 (executable)
@@ -167,10 +167,10 @@ RSYNC="$rsync_bin $*"
 #RSYNC="valgrind $rsync_bin $*"
 
 TLS_ARGS=''
-if egrep '^#define HAVE_LUTIMES 1' config.h >/dev/null; then
+if grep -E '^#define HAVE_LUTIMES 1' config.h >/dev/null; then
     TLS_ARGS="$TLS_ARGS -l"
 fi
-if egrep '#undef CHOWN_MODIFIES_SYMLINK' config.h >/dev/null; then
+if grep -E '#undef CHOWN_MODIFIES_SYMLINK' config.h >/dev/null; then
     TLS_ARGS="$TLS_ARGS -L"
 fi
 
index cc3c29ce6fa7ec3c0cd5ffd2a4a3040b62fde07f..0f0bb22f5b31c962a54dc88d1ffd12a0611cf1e6 100755 (executable)
@@ -5,7 +5,7 @@ IGNOREOUT='^(file has vanished: |rsync warning: some files vanished before they
 
 set -o pipefail
 
-rsync "${@}" 2>&1 | (egrep -v "$IGNOREOUT" || true)
+rsync "${@}" 2>&1 | (grep -E -v "$IGNOREOUT" || true)
 ret=$?
 
 if [[ $ret == $IGNOREEXIT ]]; then
index ecb263489e4a87bc2073fffda856078d2262a136..ed72c0bdc52579c5cec44e278371317762749bf1 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 test_fail() {
     echo "$@" >&2
index d2fbe90c6cd3e406324722a0275d7f55671ceb20..782cb1ca636563cbd868e360fb7b7ac8cedbb9ac 100644 (file)
@@ -26,5 +26,3 @@ you could include the log messages when reporting a failure.
 
 These tests also run automatically on the build farm, and you can see
 the results on http://build.samba.org/.
-
-
index 5728cd577e3db1a46fdace5d8e34452bc3d02297..23449018a7036f445cbb914a7cfc4504069ffad7 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # This program is distributable under the terms of the GNU GPL (see
 # COPYING).
@@ -17,8 +17,8 @@ files='foo file1 file2'
 
 case "$setfacl_nodef" in
 true)
-    if ! chmod --help 2>&1 | fgrep +a >/dev/null; then
-       test_skipped "I don't know how to use setfacl or chmod for ACLs"
+    if ! chmod --help 2>&1 | grep -F +a >/dev/null; then
+        test_skipped "I don't know how to use setfacl or chmod for ACLs"
     fi
     chmod +a "root allow read,write,execute" "$fromdir/foo" || test_skipped "Your filesystem has ACLs disabled"
     chmod +a "root allow read,execute" "$fromdir/file1"
@@ -27,7 +27,7 @@ true)
     chmod +a "root allow read,execute" "$fromdir/file2"
 
     see_acls() {
-       ls -le "${@}"
+        ls -le "${@}"
     }
     ;;
 *)
@@ -45,7 +45,7 @@ true)
     setfacl -m u:0:5 "$fromdir/file2"
 
     see_acls() {
-       getfacl "${@}"
+        getfacl "${@}"
     }
     ;;
 esac
index 6dd581366e49621cd343efe24492a9024c26af1a..3bdb1d463308d0651b7c8f1894b35f1de6f3fa4e 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Test rsync copying atimes
 
index 3b49db94af08d017e505f69bbb677b26ae108dc8..925c9fe0b1c248c8b7dc35f6a0f736b6e20f7e9e 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2004-2020 Wayne Davison
 
index 7f92e4821ea362d02a1db82cc73cff5f5f50df8a..cf4e94d37949f5445967d52b2ac5940c56e1fcf0 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2004 by Chris Shoemaker <c.shoemaker@cox.net>
 
index 8cd6c107067b278ee9bdba62bd9193ce9e48f39c..467d4029f0f89816e1753308380b555c7b98a967 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
 
@@ -16,8 +16,7 @@
 mygrps="`rsync_getgroups`" || test_fail "Can't get groups"
 mkdir "$fromdir"
 
-for g in $mygrps
-do
+for g in $mygrps; do
     name="$fromdir/foo-$g"
     date > "$name"
     chgrp "$g" "$name" || test_fail "Can't chgrp"
index 81fd38c727c2faee25c477fe14ed0cc8ecda7c37..ddf764cf9766d28ae68a5cfe530d9f9c634e7db2 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
 
@@ -31,7 +31,7 @@ chmod 770 "$dir2"
 # Copy the files we've created over to another directory
 checkit "$RSYNC -avv '$fromdir/' '$checkdir/'" "$fromdir" "$checkdir"
 
-# And then manually make the changes which should occur 
+# And then manually make the changes which should occur
 umask 002
 chmod ug-s,a+rX "$checkdir"/*
 chmod +w "$checkdir" "$checkdir"/dir*
index d31a1bdfac7cfd3e31aa79db62053cee6bb90273..e5541e4c9c941e946eac51700631351b5316610b 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2004-2020 Wayne Davison
 
index f2dd4399208026920667b61a337febc35a6d1054..63258df7c5abaf2e9628766a8617415780a8d20b 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2004-2020 Wayne Davison
 
index 3aec55a9b4ffb559f3edc99267f5280591021e8b..5dadb836ccef2c8ff49958f2ddd6528dc139d380 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
 
index 7f193c58c3b6067a5d415189290a53336d91c519..3c6348576a7202b5ee5b0273086e82ab94bb8ade 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2004-2020 Wayne Davison
 
index aa71b456e3e0cb3584319c6a7234bbb0afa024dc..51bfe301cfec32e77276a10f6483928e9c38d521 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Test rsync copying create times
 
index 17893f93ea470897af02d0bf0f033bc2b44512b2..a0a482cedf7e3a0c511ab8fbdf632d180558d0c7 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # This program is distributable under the terms of the GNU GPL (see
 # COPYING).
@@ -21,7 +21,7 @@ testit() {
     todir="$scratchdir/$1"
     mkdir "$todir"
     $setfacl_nodef "$todir"
-    if [ "$2" ]; then
+    if [ -n "$2" ]; then
        case "$setfacl_nodef" in
        *-k*) opts="-dm $2" ;;
        *) opts="-m `echo $2 | sed 's/\([ugom]:\)/d:\1/g'`"
index 5896a9c7c444874d2d8fad1a5404925b121ace60..3b6226b4b28b9adf4b3a426947104403b48e7aac 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Test rsync --delay-updates
 
index 8c19827b7dc75075e1f28a907e606b03e20d1024..f54214cd2fe077ff8cde133f917bcd56369b3592 100644 (file)
@@ -1,11 +1,11 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2005-2020 Wayne Davison
 
 # This program is distributable under the terms of the GNU GPL (see
 # COPYING).
 
-# Test rsync handling of various delete directives.  
+# Test rsync handling of various delete directives.
 
 . "$suitedir/rsync.fns"
 
@@ -23,12 +23,12 @@ echo extra >"$todir"/emptydir/subdir/remove4
 # Also, make sure that --dry-run --del doesn't output anything extraneous.
 $RSYNC -av "$fromdir/" "$chkdir/copy/" >"$tmpdir/copy.out" 2>&1
 cat "$tmpdir/copy.out"
-egrep -v '^(created directory|sent|total size) ' "$tmpdir/copy.out" >"$tmpdir/copy.new"
+grep -E -v '^(created directory|sent|total size) ' "$tmpdir/copy.out" >"$tmpdir/copy.new"
 mv "$tmpdir/copy.new" "$tmpdir/copy.out"
 
 $RSYNC -avn --del "$fromdir/" "$chkdir/copy2/" >"$tmpdir/copy2.out" 2>&1 || true
 cat "$tmpdir/copy2.out"
-egrep -v '^(created directory|sent|total size) ' "$tmpdir/copy2.out" >"$tmpdir/copy2.new"
+grep -E -v '^(created directory|sent|total size) ' "$tmpdir/copy2.out" >"$tmpdir/copy2.new"
 mv "$tmpdir/copy2.new" "$tmpdir/copy2.out"
 
 diff $diffopt "$tmpdir/copy.out" "$tmpdir/copy2.out"
index 63d737c92e542c490c90c5d46deed82aea802712..cd9cf3a24ec85688619b2460182cda9230fa2e2f 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
 
index dadc55077413f7f591fd7583fb690e38de19f02f..d6b9a3c5912ebf15464d2e26fa27c4d2f6b1ba66 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # This program is distributable under the terms of the GNU GPL (see
 # COPYING).
index cd2f713a7594fed9b49c9024f11b64246827dd51..3317e72f68c0c9ee5fdfe5755475ed64b807217d 100644 (file)
@@ -1,11 +1,11 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
 
 # This program is distributable under the terms of the GNU GPL (see
 # COPYING).
 
-# Test rsync handling of duplicate filenames.  
+# Test rsync handling of duplicate filenames.
 
 # It's quite possible that the user might specify the same source file
 # more than once on the command line, perhaps through shell variables
@@ -33,12 +33,10 @@ checkit "$RSYNC -avv '$fromdir/' '$fromdir/' '$fromdir/' '$fromdir/' '$fromdir/'
     | tee "$outfile"
 
 # Make sure each file was only copied once...
-if [ `grep -c '^name1$' "$outfile"` != 1 ]
-then
+if [ `grep -c '^name1$' "$outfile"` != 1 ]; then
     test_fail "name1 was not copied exactly once"
 fi
-if [ `grep -c '^name2 -> ' "$outfile"` != 1 ]
-then
+if [ `grep -c '^name2 -> ' "$outfile"` != 1 ]; then
     test_fail "name2 was not copied exactly once"
 fi
 
index 9bc3b54298d4aba2deb7cd6bd56e9408ccd089a1..bd21c51cc27e9677af0bf334c98f2e11c90f9e41 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2003-2020 Wayne Davison
 
index 05a64e48d26f8ab0dc1973c35779ce3ce3b2933d..8f09d8f8bedb9f9019d2cc64147f65f9eadc2fee 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # This program is distributable under the terms of the GNU GPL (see
 # COPYING).
index 05c5b0682bd9260b79d912daa5760006fabcab04..2415173de774f5cb303bdd4e63d4c7431209e985 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2005-2020 Wayne Davison
 
index 6c4fafbc1cf7c7c95a6d40b9443086e380039259..af2ea4088e79880b8eb88f859f41bb3707233783 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
 
index 6a85ffab2a631f01d4ddb1cd13e68419a5fcf4d1..92327238965faf10a9b286f971dbe780acaf4707 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2005-2020 Wayne Davison
 
index 9b20f73ddafeffd7b7761bccd341b18ab9beefeb..5f9a6da6631845926a3e3a4fa0291b2c85588142 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2004-2020 Wayne Davison
 
index c6c8e576e5667355d6bb864b63511c7847d67e2f..2fbf4616ef0c7852b7aa7243cdaac8e593e84303 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # This program is distributable under the terms of the GNU GPL (see
 # COPYING).
old mode 100755 (executable)
new mode 100644 (file)
index 5c2ee016b5f4132a068419b1b058ffc3eef6b9aa..1e2b399f0cef21191b6ff297f09690578fda5fbd 100644 (file)
@@ -45,13 +45,12 @@ export HOME
 
 runtest() {
     echo $ECHO_N "Test $1: $ECHO_C"
-    if eval "$2"
-    then
-       echo "$ECHO_T   done."
-       return 0
+    if eval "$2"; then
+        echo "$ECHO_T  done."
+        return 0
     else
-       echo "$ECHO_T failed!"
-       return 1
+        echo "$ECHO_T failed!"
+        return 1
     fi
 }
 
@@ -220,16 +219,13 @@ makepath() {
        (echo "        makepath $p"
 
        # Absolute Unix path.
-       if echo $p | grep '^/' >/dev/null
-       then
+       if echo $p | grep '^/' >/dev/null; then
            cd /
        fi
 
        # This will break if $p contains a space.
-       for c in `echo $p | tr '/' ' '`
-       do
-           if [ -d "$c" ] || mkdir "$c"
-           then
+       for c in `echo $p | tr '/' ' '`; do
+           if [ -d "$c" ] || mkdir "$c"; then
                cd "$c" || return $?
            else
                echo "failed to create $c" >&2; return $?
@@ -293,7 +289,7 @@ checkit() {
     fi
 
     echo "-------------"
-    if [ -z "$failed" ] ; then
+    if [ -z "$failed" ]; then
        return 0
     fi
 
@@ -338,14 +334,14 @@ checkdiff2() {
        failed="$failed status=$status"
     fi
 
-    if [ "$2" ]; then
+    if [ -n "$2" ]; then
        eval "cat '$outfile' | $2 >'$outfile.new'"
        mv "$outfile.new" "$outfile"
     fi
 
     diff $diffopt "$chkfile" "$outfile" || failed="$failed output differs"
 
-    if [ "$failed" ] ; then
+    if [ -n "$failed" ]; then
        echo "Failed:$failed"
        return 1
     fi
@@ -465,25 +461,21 @@ test_xfail() {
 
 # Determine what shell command will appropriately test for links.
 ln -s foo "$scratchdir/testlink"
-for cmd in test /bin/test /usr/bin/test /usr/ucb/bin/test /usr/ucb/test
-do
-    for switch in -h -L
-    do
-        if $cmd $switch "$scratchdir/testlink" 2>/dev/null
-       then
-           # how nice
-           TEST_SYMLINK_CMD="$cmd $switch"
-           # i wonder if break 2 is portable?
-           break 2
-       fi
-   done
+for cmd in test /bin/test /usr/bin/test /usr/ucb/bin/test /usr/ucb/test; do
+    for switch in -h -L; do
+        if $cmd $switch "$scratchdir/testlink" 2>/dev/null; then
+            # how nice
+            TEST_SYMLINK_CMD="$cmd $switch"
+            # i wonder if break 2 is portable?
+            break 2
+        fi
+    done
 done
 # ok, now get rid of it
 rm "$scratchdir/testlink"
 
 
-if [ "x$TEST_SYMLINK_CMD" = 'x' ]
-then
+if [ "x$TEST_SYMLINK_CMD" = 'x' ]; then
     test_fail "Couldn't determine how to test for symlinks"
 else
     echo "Testing for symlinks using '$TEST_SYMLINK_CMD'"
index 4bcbdfe950d7eafb7281cbe8e7bafc765a516836..1559ca231ec14cc384059b837b2d43445da19e6a 100644 (file)
@@ -13,7 +13,7 @@
 SSH="$scratchdir/src/support/lsh.sh"
 
 if test x"$rsync_enable_ssh_tests" = xyes; then
-    if type ssh >/dev/null ; then
+    if type ssh >/dev/null; then
        SSH=ssh
     fi
 fi
index eec7a3011cd8b01bc8f2846ae8dffd2453a72f78..7055a920f242839910d805edf7f63f1eef6234ff 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2001 by Martin Pool <mbp@samba.org>
 
@@ -18,18 +18,15 @@ $RSYNC -r "$fromdir/" "$todir" || test_fail "$RSYNC returned $?"
 
 [ -f "$todir/referent" ] || test_fail "referent was not copied"
 [ -d "$todir/from" ] && test_fail "extra level of directories"
-if is_a_link "$todir/dangling" 
-then 
+if is_a_link "$todir/dangling"; then
     test_fail "dangling symlink was copied"
 fi
 
-if is_a_link "$todir/relative" 
-then
-    test_fail "relative symlink was copied" 
+if is_a_link "$todir/relative"; then
+    test_fail "relative symlink was copied"
 fi
 
-if is_a_link "$todir/absolute" 
-then
+if is_a_link "$todir/absolute"; then
     test_fail "absolute symlink was copied"
 fi
 
index ec551e65da5eb764ad6bbc707f3c18058750e354..2efaa078900f9b6c20fef753125c817db310fb90 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
 
index 55df086523744137004b7eee8a14bf815a601f63..75e720145a7aadf0db7f09d5010dbfd8b70f20a5 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2002 by Martin Pool
 
@@ -13,9 +13,8 @@ test_unsafe() {
     # or "unsafe" otherwise
 
     result=`"$TOOLDIR/t_unsafe" "$1" "$2"` || test_fail "Failed to check $1 $2"
-    if [ "$result" != "$3" ]
-    then
-       test_fail "t_unsafe $1 $2 returned \"$result\", expected \"$3\""
+    if [ "$result" != "$3" ]; then
+        test_fail "t_unsafe $1 $2 returned \"$result\", expected \"$3\""
     fi
 }
 
index 479d606c832a97c9791193d01c63a9313c1e0814..2d209eb65c793ac10e6b0698ab9439da5bd05648 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Originally by VladimĂ­r Michl <Vladimir.Michl@hlubocky.del.cz>
 
@@ -6,13 +6,13 @@
 
 test_symlink() {
        is_a_link "$1" || test_fail "File $1 is not a symlink"
-};
+}
 
 test_regular() {
        if [ ! -f "$1" ]; then
-               test_fail "File $1 is not regular file or not exists";
-       fi;
-};
+               test_fail "File $1 is not regular file or not exists"
+       fi
+}
 
 cd "$tmpdir"
 
@@ -32,7 +32,7 @@ ln -s ../files/file1 "from/safe/links/"
 ln -s ../files/file2 "from/safe/links/"
 ln -s ../../unsafe/unsafefile "from/safe/links/"
 
-echo "rsync with relative path and just -a";
+echo "rsync with relative path and just -a"
 $RSYNC -avv from/safe/ to
 test_symlink to/links/file1
 test_symlink to/links/file2
@@ -44,23 +44,22 @@ test_regular to/links/file1
 test_regular to/links/file2
 test_regular to/links/unsafefile
 
-echo "rsync with relative path and --copy-unsafe-links";
+echo "rsync with relative path and --copy-unsafe-links"
 $RSYNC -avv --copy-unsafe-links from/safe/ to
 test_symlink to/links/file1
 test_symlink to/links/file2
 test_regular to/links/unsafefile
 
 rm -rf to
-echo "rsync with relative2 path";
+echo "rsync with relative2 path"
 (cd from; $RSYNC -avv --copy-unsafe-links safe/ ../to)
 test_symlink to/links/file1
 test_symlink to/links/file2
 test_regular to/links/unsafefile
 
 rm -rf to
-echo "rsync with absolute path";
+echo "rsync with absolute path"
 $RSYNC -avv --copy-unsafe-links `pwd`/from/safe/ to
 test_symlink to/links/file1
 test_symlink to/links/file2
 test_regular to/links/unsafefile
-
index 12b872c8b0f3fc36f42598837289fefa5242d1de..fa225d90f9b8a0cc20f73847ff1668582c8ba3b2 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Copyright (C) 2003-2020 Wayne Davison
 
index 59fe1601f61f379adbb044024c227290678ae05e..455abef1b69dafeeabb03e92b8c59407df145eba 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # This program is distributable under the terms of the GNU GPL (see
 # COPYING).
@@ -150,7 +150,7 @@ xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" -
 
 cd "$fromdir"
 
-if [ "$dashH" ]; then
+if [ -n "$dashH" ]; then
     for fn in $files; do
        name=`basename $fn`
        ln $fn ../lnk/$name
@@ -162,7 +162,7 @@ checkit "$RSYNC -aiX $XFILT $dashH --super $altDest=../chk . ../to" "$fromdir" "
 cd "$todir"
 xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" -
 
-[ "$dashH" ] && rm -rf "$lnkdir"
+[ -n "$dashH" ] && rm -rf "$lnkdir"
 
 cd "$fromdir"
 rm -rf "$todir"
@@ -177,7 +177,7 @@ cd "$todir"
 xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" -
 
 sed -n -e '/^[^d ][^ ]*  *[^ ][^ ]*  *[^ ][^ ]*  *1 /p' "$scratchdir/ls-to" >"$scratchdir/ls-diff-all"
-fgrep -v './file1' "$scratchdir/ls-diff-all" >"$scratchdir/ls-diff" || :
+grep -F -v './file1' "$scratchdir/ls-diff-all" >"$scratchdir/ls-diff" || :
 if [ -s "$scratchdir/ls-diff" ]; then
     echo "Missing hard links on:"
     cat "$scratchdir/ls-diff"
@@ -213,13 +213,13 @@ $RSYNC -aX file1 file2
 $RSYNC -aX file1 file2 ../chk/
 $RSYNC -aX --del ../chk/ .
 $RSYNC -aX file1 ../lnk/
-[ "$dashH" ] && ln "$chkdir/file1" ../lnk/extra-link
+[ -n "$dashH" ] && ln "$chkdir/file1" ../lnk/extra-link
 
 xls file1 file2 >"$scratchdir/xattrs.txt"
 
 checkit "$RSYNC -aiiX $XFILT $dashH $altDest=../lnk . ../to" "$chkdir" "$todir"
 
-[ "$dashH" ] && rm ../lnk/extra-link
+[ -n "$dashH" ] && rm ../lnk/extra-link
 
 cd "$todir"
 xls file1 file2 | diff $diffopt "$scratchdir/xattrs.txt" -