|
version 1.1.1.1, 2012/02/17 15:09:30
|
version 1.1.1.3, 2021/03/17 00:32:36
|
|
Line 1
|
Line 1
|
| #! /bin/sh | #!/bin/sh |
| |
|
| # Copyright (C) 2001 by Martin Pool <mbp@samba.org> |
# Copyright (C) 2001 by Martin Pool <mbp@samba.org> |
| |
|
|
Line 17
|
Line 17
|
| # License along with this program; if not, write to the Free Software |
# License along with this program; if not, write to the Free Software |
| # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
|
| |
|
| tmpdir="$scratchdir" |
tmpdir="$scratchdir" |
| fromdir="$tmpdir/from" |
fromdir="$tmpdir/from" |
| todir="$tmpdir/to" |
todir="$tmpdir/to" |
| chkdir="$tmpdir/chk" |
chkdir="$tmpdir/chk" |
| |
|
| # For itemized output: |
# For itemized output: |
| all_plus='+++++++++' | all_plus='++++++++++' |
| allspace=' ' | allspace=' ' |
| dots='.....' # trailing dots after changes | dots='......' # trailing dots after changes |
| tab_ch=' ' # a single tab character |
tab_ch=' ' # a single tab character |
| |
|
| # Berkley's nice. |
# Berkley's nice. |
| PATH="$PATH:/usr/ucb" |
PATH="$PATH:/usr/ucb" |
| |
|
| if diff -u "$srcdir/testsuite/rsync.fns" "$srcdir/testsuite/rsync.fns" >/dev/null 2>&1; then | if diff -u "$suitedir/rsync.fns" "$suitedir/rsync.fns" >/dev/null 2>&1; then |
| diffopt="-u" |
diffopt="-u" |
| else |
else |
| diffopt="-c" |
diffopt="-c" |
|
Line 63 set_cp_destdir() {
|
Line 62 set_cp_destdir() {
|
| # Perform a "cp -p", making sure that timestamps are really the same, |
# Perform a "cp -p", making sure that timestamps are really the same, |
| # even if the copy rounded microsecond times on the destination file. |
# even if the copy rounded microsecond times on the destination file. |
| cp_touch() { |
cp_touch() { |
| cp -p "${@}" || test_fail "cp -p failed" | cp_p "${@}" |
| if test $# -gt 2 -o -d "$2"; then |
if test $# -gt 2 -o -d "$2"; then |
| set_cp_destdir "${@}" # sets destdir var |
set_cp_destdir "${@}" # sets destdir var |
| while test $# -gt 1; do |
while test $# -gt 1; do |
|
Line 98 printmsg() {
|
Line 97 printmsg() {
|
| } |
} |
| |
|
| rsync_ls_lR() { |
rsync_ls_lR() { |
| find "$@" -print | sort | sed 's/ /\\ /g' | xargs "$TOOLDIR/tls" $TLS_ARGS | find "$@" -name .git -prune -o -name auto-build-save -prune -o -print | \ |
| | sort | sed 's/ /\\ /g' | xargs "$TOOLDIR/tls" $TLS_ARGS |
| } |
} |
| |
|
| get_testuid() { |
get_testuid() { |
| id 2>/dev/null | sed 's/^[^0-9]*\([0-9][0-9]*\).*/\1/' | uid=`id -u 2>/dev/null || true` |
| | case "$uid" in |
| | [0-9]*) echo "$uid" ;; |
| | *) id 2>/dev/null | sed 's/^[^0-9]*\([0-9][0-9]*\).*/\1/' ;; |
| | esac |
| } |
} |
| |
|
| |
get_rootuid() { |
| |
uid=`id -u root 2>/dev/null || true` |
| |
case "$uid" in |
| |
[0-9]*) echo "$uid" ;; |
| |
*) echo 0 ;; |
| |
esac |
| |
} |
| |
|
| |
get_rootgid() { |
| |
gid=`id -g root 2>/dev/null || true` |
| |
case "$gid" in |
| |
[0-9]*) echo "$gid" ;; |
| |
*) echo 0 ;; |
| |
esac |
| |
} |
| |
|
| |
# When copying via "cp -p", we want to ensure that a non-root user does not |
| |
# preserve ownership (we want our files to be created as the testing user). |
| |
# For instance, a Cygwin CI run might have git files owned by a different |
| |
# user than the (admin) user running the tests. |
| |
cp_cmd="cp -p" |
| |
if test x`get_testuid` != x0; then |
| |
case `cp --help 2>/dev/null` in |
| |
*--no-preserve=*) cp_cmd="cp -p --no-preserve=ownership" ;; |
| |
esac |
| |
fi |
| |
cp_p() { |
| |
$cp_cmd "${@}" || test_fail "$cp_cmd failed" |
| |
} |
| |
|
| check_perms() { |
check_perms() { |
| perms=`"$TOOLDIR/tls" "$1" | sed 's/^[-d]\(.........\).*/\1/'` |
perms=`"$TOOLDIR/tls" "$1" | sed 's/^[-d]\(.........\).*/\1/'` |
| if test $perms = $2; then |
if test $perms = $2; then |
|
Line 184 makepath() {
|
Line 218 makepath() {
|
| for p in "${@}"; do |
for p in "${@}"; do |
| (echo " makepath $p" |
(echo " makepath $p" |
| |
|
| # Absolut Unix. | # Absolute Unix path. |
| if echo $p | grep '^/' >/dev/null |
if echo $p | grep '^/' >/dev/null |
| then |
then |
| cd / |
cd / |
|
Line 220 checkit() {
|
Line 254 checkit() {
|
| # We can just write everything to stdout/stderr, because the |
# We can just write everything to stdout/stderr, because the |
| # wrapper hides it unless there is a problem. |
# wrapper hides it unless there is a problem. |
| |
|
| |
case "x$TLS_ARGS" in |
| |
*--atimes*) |
| |
( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from" |
| |
;; |
| |
*) |
| |
;; |
| |
esac |
| |
|
| echo "Running: \"$1\"" |
echo "Running: \"$1\"" |
| eval "$1" |
eval "$1" |
| status=$? |
status=$? |
|
Line 227 checkit() {
|
Line 269 checkit() {
|
| failed="$failed status=$status" |
failed="$failed status=$status" |
| fi |
fi |
| |
|
| |
case "x$TLS_ARGS" in |
| |
*--atimes*) |
| |
;; |
| |
*) |
| |
( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from" |
| |
;; |
| |
esac |
| |
|
| echo "-------------" |
echo "-------------" |
| echo "check how the directory listings compare with diff:" |
echo "check how the directory listings compare with diff:" |
| echo "" |
echo "" |
| ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from" |
|
| ( cd "$3" && rsync_ls_lR . ) > "$tmpdir/ls-to" |
( cd "$3" && rsync_ls_lR . ) > "$tmpdir/ls-to" |
| diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed="$failed dir-diff" |
diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed="$failed dir-diff" |
| |
|
|
Line 263 build_rsyncd_conf() {
|
Line 312 build_rsyncd_conf() {
|
| logfile="$scratchdir/rsyncd.log" |
logfile="$scratchdir/rsyncd.log" |
| hostname=`uname -n` |
hostname=`uname -n` |
| |
|
| |
my_uid=`get_testuid` |
| |
root_uid=`get_rootuid` |
| |
root_gid=`get_rootgid` |
| |
|
| |
uid_setting="uid = $root_uid" |
| |
gid_setting="gid = $root_gid" |
| |
|
| |
if test x"$my_uid" != x"$root_uid"; then |
| |
# Non-root cannot specify uid & gid settings |
| |
uid_setting="#$uid_setting" |
| |
gid_setting="#$gid_setting" |
| |
fi |
| |
|
| cat >"$conf" <<EOF |
cat >"$conf" <<EOF |
| # rsyncd configuration file autogenerated by $0 |
# rsyncd configuration file autogenerated by $0 |
| |
|
|
Line 271 use chroot = no
|
Line 333 use chroot = no
|
| munge symlinks = no |
munge symlinks = no |
| hosts allow = localhost 127.0.0.0/24 192.168.0.0/16 10.0.0.0/8 $hostname |
hosts allow = localhost 127.0.0.0/24 192.168.0.0/16 10.0.0.0/8 $hostname |
| log file = $logfile |
log file = $logfile |
| log format = %i %h [%a] %m (%u) %l %f%L |
|
| transfer logging = yes |
transfer logging = yes |
| |
# We don't define log format here so that the test-hidden module will default |
| |
# to the internal static string (since we had a crash trying to tweak it). |
| exclude = ? foobar.baz |
exclude = ? foobar.baz |
| max verbosity = 9 | max verbosity = 4 |
| uid = 0 | $uid_setting |
| gid = 0 | $gid_setting |
| |
|
| [test-from] |
[test-from] |
| path = $fromdir |
path = $fromdir |
| |
log format = %i %h [%a] %m (%u) %l %f%L |
| read only = yes |
read only = yes |
| comment = r/o |
comment = r/o |
| |
|
| [test-to] |
[test-to] |
| path = $todir |
path = $todir |
| |
log format = %i %h [%a] %m (%u) %l %f%L |
| read only = no |
read only = no |
| comment = r/w |
comment = r/w |
| |
|
| [test-scratch] |
[test-scratch] |
| path = $scratchdir |
path = $scratchdir |
| |
log format = %i %h [%a] %m (%u) %l %f%L |
| read only = no |
read only = no |
| |
|
| [test-hidden] |
[test-hidden] |