[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Mon Jul 13 22:33:45 UTC 2020


The branch, master has been updated
       via  4c0be4da Avoid a failed test on Cygwin.
       via  45498551 Search for cmark.
       via  284c28c7 Add new code to recv_group_name() too.
       via  d2406ae3 Give up on commonmark.
       via  1e9c3497 Avoid a crash if id-0 doesn't exist.
       via  116bd193 One more commonmark try.
       via  883de22c Avoid a test failure if `id` didn't work.
       via  18f500a7 Try another way to get commonmark working.
       via  d14b0ca4 Install commonmark on FreeBSD.
       via  4156e7d4 Tweak lsh's Usage message & opening comment.
       via  9e48da65 Search for commonmark pkg.
      from  2cdf9416 Tweak brew run.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4c0be4da13d13bdac1b28bf60a388c02fb8ce9cf
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Jul 13 15:33:07 2020 -0700

    Avoid a failed test on Cygwin.

commit 45498551260467c3ffdbaa7455e546827abedd84
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Jul 13 14:09:24 2020 -0700

    Search for cmark.

commit 284c28c77374cb8ceb41f51f7382b94bd24a2a0d
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Jul 13 13:43:17 2020 -0700

    Add new code to recv_group_name() too.

commit d2406ae372d92582eb6254e93384f35ed9563c98
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Jul 13 13:42:28 2020 -0700

    Give up on commonmark.

commit 1e9c34972a583da3a35636c93b05687108da5ff3
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Jul 13 13:18:38 2020 -0700

    Avoid a crash if id-0 doesn't exist.

commit 116bd19324acb359fbdde65d1f93ae92e49fd760
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Jul 13 13:12:39 2020 -0700

    One more commonmark try.

commit 883de22c29a6e24a9fbf75524fe427dc078db51e
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Jul 13 12:59:22 2020 -0700

    Avoid a test failure if `id` didn't work.

commit 18f500a7a4fa8d9d437343ccf5863e8e72a9d717
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Jul 13 12:59:07 2020 -0700

    Try another way to get commonmark working.

commit d14b0ca4db76309041595091f8ae851a1e42bcc2
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Jul 13 12:18:13 2020 -0700

    Install commonmark on FreeBSD.

commit 4156e7d464643d55576c397d6ab064fb5e0a2fc9
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Jul 13 12:01:00 2020 -0700

    Tweak lsh's Usage message & opening comment.

commit 9e48da65c1cfa9211f3cc3089f5b9e44f66c2b7c
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Jul 13 12:00:44 2020 -0700

    Search for commonmark pkg.

-----------------------------------------------------------------------

Summary of changes:
 .cirrus.yml             |  1 +
 support/lsh             | 20 +++++++++++---------
 testsuite/dir-sgid.test |  9 ++++++++-
 testsuite/rsync.fns     |  6 +++---
 uidlist.c               | 42 +++++++++++++++++++++++++++++-------------
 5 files changed, 52 insertions(+), 26 deletions(-)


Changeset truncated at 500 lines:

diff --git a/.cirrus.yml b/.cirrus.yml
index 9d5f5a35..88e00e1d 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -7,6 +7,7 @@ task:
     - zpool create -m `pwd`/testtmp zpool /tmp/zpool
     - pkg install -y autotools xxhash zstd liblz4 openssl bash
     - ln -s /usr/local/bin/bash /bin/bash
+    - pkg search cmark
   configure_script:
     - CPPFLAGS=-I/usr/local/include/ LDFLAGS=-L/usr/local/lib/ ./configure --disable-md2man
   make_script:
diff --git a/support/lsh b/support/lsh
index 40f70c88..be29310c 100755
--- a/support/lsh
+++ b/support/lsh
@@ -1,10 +1,6 @@
 #!/usr/bin/env perl
-# This script can be used as a "remote shell" command that is only
-# capable of pretending to connect to "localhost".  This is useful
-# for testing or for running a local copy where the sender and the
-# receiver needs to use different options (e.g. --fake-super).  If
-# we get -l USER, we try to become the USER, either directly (must
-# be root) or by using "sudo -H -u USER" (requires --sudo option).
+# This is a "local shell" command that works like a remote shell but only for
+# the local host.  See the usage message for more details.
 
 use strict;
 use warnings;
@@ -78,9 +74,15 @@ die "Failed to exec: $!\n";
 sub usage
 {
     die <<EOT;
-Usage: lsh [-l user] [--sudo] [--no-cd] localhost COMMAND [...]
+Usage: lsh [-l USER] [--sudo] [--no-cd] localhost COMMAND [...]
 
-Note that if you pass hostname "lh" instead of "localhost" that
-the --no-cd option is implied.
+This is a "local shell" command that works like a remote shell but only for the
+local host.  This is useful for rsync testing or for running a local copy where
+the sender and the receiver need to use different options (e.g. --fake-super).
+If the -l option is used, we try to become the USER, either directly (when
+root) or by using "sudo -H -u USER" (requires --sudo option).
+
+Note that if you pass hostname "lh" instead of "localhost" that the --no-cd
+option is implied.  The default is to "cd \$HOME" to simulate ssh behavior.
 EOT
 }
diff --git a/testsuite/dir-sgid.test b/testsuite/dir-sgid.test
index 44cd61e7..dadc5507 100644
--- a/testsuite/dir-sgid.test
+++ b/testsuite/dir-sgid.test
@@ -23,12 +23,19 @@ testit() {
     check_perms "$todir/to/program" $4 "Target $1"
 }
 
+mkdir "$scratchdir/dir"
+# Cygwin has a persistent default dir ACL that ruins this test.
+case `getfacl "$scratchdir/dir" 2>/dev/null || true` in
+*default:user::*) test_skipped "The default ACL mode interferes with this test" ;;
+esac
+
 echo "File!" >"$scratchdir/file"
 echo "#!/bin/sh" >"$scratchdir/program"
-mkdir "$scratchdir/dir"
+
 chmod u=rwx,g=rw,g+s,o=r "$scratchdir/dir" || test_skipped "Can't chmod"
 chmod 664 "$scratchdir/file"
 chmod 775 "$scratchdir/program"
+
 [ -g "$scratchdir/dir" ] || test_skipped "The directory setgid bit vanished!"
 mkdir "$scratchdir/dir/blah"
 [ -g "$scratchdir/dir/blah" ] || test_skipped "Your filesystem doesn't use directory setgid; maybe it's BSD."
diff --git a/testsuite/rsync.fns b/testsuite/rsync.fns
index 023a8e19..fb1721f3 100644
--- a/testsuite/rsync.fns
+++ b/testsuite/rsync.fns
@@ -102,7 +102,7 @@ rsync_ls_lR() {
 }
 
 get_testuid() {
-    uid=`id -u 2>/dev/null`
+    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/' ;;
@@ -110,7 +110,7 @@ get_testuid() {
 }
 
 get_rootuid() {
-    uid=`id -u root 2>/dev/null`
+    uid=`id -u root 2>/dev/null || true`
     case "$uid" in
 	[0-9]*) echo "$uid" ;;
 	*) echo 0 ;;
@@ -118,7 +118,7 @@ get_rootuid() {
 }
 
 get_rootgid() {
-    gid=`id -g root 2>/dev/null`
+    gid=`id -g root 2>/dev/null || true`
     case "$gid" in
 	[0-9]*) echo "$gid" ;;
 	*) echo 0 ;;
diff --git a/uidlist.c b/uidlist.c
index 975636a8..4506de2e 100644
--- a/uidlist.c
+++ b/uidlist.c
@@ -325,13 +325,17 @@ const char *add_gid(gid_t gid)
 
 static void send_one_name(int f, id_t id, const char *name)
 {
-	int len = strlen(name);
-	if (len > 255) /* Impossible? */
+	int len;
+
+	if (!name)
+		name = "";
+	if ((len = strlen(name)) > 255) /* Impossible? */
 		len = 255;
 
 	write_varint30(f, id);
 	write_byte(f, len);
-	write_buf(f, name, len);
+	if (len)
+		write_buf(f, name, len);
 }
 
 static void send_one_list(int f, struct idlist *idlist, int usernames)
@@ -366,12 +370,18 @@ uid_t recv_user_name(int f, uid_t uid)
 {
 	struct idlist *node;
 	int len = read_byte(f);
-	char *name = new_array(char, len+1);
-	read_sbuf(f, name, len);
-	if (numeric_ids < 0) {
-		free(name);
+	char *name;
+
+	if (len) {
+		name = new_array(char, len+1);
+		read_sbuf(f, name, len);
+		if (numeric_ids < 0) {
+			free(name);
+			name = NULL;
+		}
+	} else
 		name = NULL;
-	}
+
 	node = recv_add_id(&uidlist, uidmap, uid, name); /* node keeps name's memory */
 	return node->id2;
 }
@@ -380,12 +390,18 @@ gid_t recv_group_name(int f, gid_t gid, uint16 *flags_ptr)
 {
 	struct idlist *node;
 	int len = read_byte(f);
-	char *name = new_array(char, len+1);
-	read_sbuf(f, name, len);
-	if (numeric_ids < 0) {
-		free(name);
+	char *name;
+
+	if (len) {
+		name = new_array(char, len+1);
+		read_sbuf(f, name, len);
+		if (numeric_ids < 0) {
+			free(name);
+			name = NULL;
+		}
+	} else
 		name = NULL;
-	}
+
 	node = recv_add_id(&gidlist, gidmap, gid, name); /* node keeps name's memory */
 	if (flags_ptr && node->flags & FLAG_SKIP_GROUP)
 		*flags_ptr |= FLAG_SKIP_GROUP;


-- 
The rsync repository.



More information about the rsync-cvs mailing list