[patch] Two problems in testsuite (POSIX, perms)

Wayne Davison wayned at users.sourceforge.net
Tue Jan 21 19:44:00 EST 2003


Here's the patch I ended up committing.  Note that I had to change the
names of the UID/GID vars (since they can be read-only vars in certain
shells) and that I ensured that the chown would happen if any user has
the permissions to run the chown command (not just if that user is named
"root").

..wayne..
-------------- next part --------------
Index: runtests.sh
--- runtests.sh	26 Mar 2002 01:25:48 -0000	1.33
+++ runtests.sh	21 Jan 2003 19:27:11 -0000	1.34
@@ -230,7 +230,8 @@
 	;;
     77)
 	# backticks will fill the whole file onto one line, which is a feature
-	echo "SKIP    $testbase (`cat \"$scratchdir/whyskipped\"`)"
+	whyskipped=`cat "$scratchdir/whyskipped"`
+	echo "SKIP    $testbase ($whyskipped)"
 	skipped=`expr $skipped + 1`
 	maybe_discard_scratch
 	;;
Index: testsuite/daemon-gzip-download.test
--- testsuite/daemon-gzip-download.test	24 Dec 2002 07:25:25 -0000	1.2
+++ testsuite/daemon-gzip-download.test	21 Jan 2003 19:30:51 -0000	1.3
@@ -27,5 +27,12 @@
 export RSYNC_CONNECT_PROG
 
 hands_setup
+
+# If we are root, we must allow the rsyncd process (which runs under
+# a different uid/gid) to write to the destination directory. Source
+# directory must be chown'ed as well so that UIDs & GIDs match when 
+# the source & destination are compared after copying.
+chown -R $RSYNCD_UID:$RSYNCD_GID "$FROM" "$TO" 2>/dev/null || true
+
 checkit "$RSYNC -avvz localhost::test-from/ \"$TO/\"" "$FROM" "$TO"
 
Index: testsuite/rsync.fns
--- testsuite/rsync.fns	10 Jan 2003 15:06:10 -0000	1.50
+++ testsuite/rsync.fns	21 Jan 2003 19:28:29 -0000	1.51
@@ -24,6 +24,13 @@
 LOG=${TMP}/log
 RSYNC="$rsync_bin"
 
+# UID & GID to run rsyncd as if testsuite is running as root
+#
+# We don't know if this machine has "nobody" or "nogroup", so use the
+# quasi-canonical values of (uint16_t) -2.
+RSYNCD_UID=65534
+RSYNCD_GID=65534
+
 # Berkley's nice.
 PATH="$PATH:/usr/ucb"
 
@@ -191,11 +198,8 @@
 hosts allow = localhost, 127.0.0.1
 log file = $logfile
 
-# We don't know if this machine has "nobody" or "nogroup", so use the quasi-canonical
-# values of (uint16_t) -2. 
-
-uid = 65534
-gid = 65534
+uid = $RSYNCD_UID 
+gid = $RSYNCD_GID 
 
 [test-from]
 	path = $FROM


More information about the rsync mailing list