Skip to content

Commit

Permalink
Minor cleanup (#214)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
a1346054 authored Sep 26, 2021
1 parent 3337930 commit dde4695
Show file tree
Hide file tree
Showing 39 changed files with 102 additions and 120 deletions.
26 changes: 13 additions & 13 deletions COPYING
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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.

Expand All @@ -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>.
2 changes: 1 addition & 1 deletion rsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
== ((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
Expand Down
4 changes: 2 additions & 2 deletions runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion support/rsync-no-vanished
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion testsuite/00-hello.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

test_fail() {
echo "$@" >&2
Expand Down
2 changes: 0 additions & 2 deletions testsuite/README.testsuite
Original file line number Diff line number Diff line change
Expand Up @@ -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/.


10 changes: 5 additions & 5 deletions testsuite/acls.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# This program is distributable under the terms of the GNU GPL (see
# COPYING).
Expand All @@ -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"
Expand All @@ -27,7 +27,7 @@ true)
chmod +a "root allow read,execute" "$fromdir/file2"

see_acls() {
ls -le "${@}"
ls -le "${@}"
}
;;
*)
Expand All @@ -45,7 +45,7 @@ true)
setfacl -m u:0:5 "$fromdir/file2"

see_acls() {
getfacl "${@}"
getfacl "${@}"
}
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion testsuite/atimes.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Test rsync copying atimes

Expand Down
2 changes: 1 addition & 1 deletion testsuite/backup.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2004-2020 Wayne Davison

Expand Down
2 changes: 1 addition & 1 deletion testsuite/batch-mode.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2004 by Chris Shoemaker <c.shoemaker@cox.net>

Expand Down
5 changes: 2 additions & 3 deletions testsuite/chgrp.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2002 by Martin Pool <mbp@samba.org>

Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions testsuite/chmod-option.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2002 by Martin Pool <mbp@samba.org>

Expand Down Expand Up @@ -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*
Expand Down
2 changes: 1 addition & 1 deletion testsuite/chmod-temp-dir.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2004-2020 Wayne Davison

Expand Down
2 changes: 1 addition & 1 deletion testsuite/chmod.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2004-2020 Wayne Davison

Expand Down
2 changes: 1 addition & 1 deletion testsuite/chown.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2002 by Martin Pool <mbp@samba.org>

Expand Down
2 changes: 1 addition & 1 deletion testsuite/compare-dest.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2004-2020 Wayne Davison

Expand Down
2 changes: 1 addition & 1 deletion testsuite/crtimes.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Test rsync copying create times

Expand Down
4 changes: 2 additions & 2 deletions testsuite/default-acls.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# This program is distributable under the terms of the GNU GPL (see
# COPYING).
Expand All @@ -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'`"
Expand Down
2 changes: 1 addition & 1 deletion testsuite/delay-updates.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Test rsync --delay-updates

Expand Down
8 changes: 4 additions & 4 deletions testsuite/delete.test
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion testsuite/devices.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2002 by Martin Pool <mbp@samba.org>

Expand Down
2 changes: 1 addition & 1 deletion testsuite/dir-sgid.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# This program is distributable under the terms of the GNU GPL (see
# COPYING).
Expand Down
10 changes: 4 additions & 6 deletions testsuite/duplicates.test
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion testsuite/exclude.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2003-2020 Wayne Davison

Expand Down
2 changes: 1 addition & 1 deletion testsuite/executability.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# This program is distributable under the terms of the GNU GPL (see
# COPYING).
Expand Down
2 changes: 1 addition & 1 deletion testsuite/fuzzy.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2005-2020 Wayne Davison

Expand Down
2 changes: 1 addition & 1 deletion testsuite/hardlinks.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2002 by Martin Pool <mbp@samba.org>

Expand Down
2 changes: 1 addition & 1 deletion testsuite/itemize.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2005-2020 Wayne Davison

Expand Down
2 changes: 1 addition & 1 deletion testsuite/merge.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Copyright (C) 2004-2020 Wayne Davison

Expand Down
2 changes: 1 addition & 1 deletion testsuite/missing.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# This program is distributable under the terms of the GNU GPL (see
# COPYING).
Expand Down
Empty file modified testsuite/mkpath.test
100755 → 100644
Empty file.
Loading

0 comments on commit dde4695

Please sign in to comment.