[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Sun Jun 28 03:47:11 UTC 2020


The branch, master has been updated
       via  967e6426 Improve the NSTR differentiation idiom.
       via  61971acb Some more doc & NEWS improvements.
       via  5bd0b6cf Change the CI name
      from  0eec25f7 Some patch-update & vim ft improvements

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


- Log -----------------------------------------------------------------
commit 967e6426b93cf65090a5c987804479ae959d599a
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 27 19:25:03 2020 -0700

    Improve the NSTR differentiation idiom.

commit 61971acbe1e6f1fe239081c3c5e3c91749bc5c23
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 27 18:51:09 2020 -0700

    Some more doc & NEWS improvements.

commit 5bd0b6cf713d0dfa6f9a98d59fc36e74d2983145
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 27 18:40:21 2020 -0700

    Change the CI name

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

Summary of changes:
 .github/workflows/ccpp.yml |   2 +-
 NEWS.md                    |   7 ++--
 checksum.c                 |   2 +-
 compat.c                   |  31 +++++++-------
 rsync.1.md                 | 101 ++++++++++++++++++++++-----------------------
 rsync.h                    |   3 ++
 6 files changed, 73 insertions(+), 73 deletions(-)


Changeset truncated at 500 lines:

diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml
index 0fca1602..63116804 100644
--- a/.github/workflows/ccpp.yml
+++ b/.github/workflows/ccpp.yml
@@ -1,4 +1,4 @@
-name: C CI
+name: build
 
 on:
   push:
diff --git a/NEWS.md b/NEWS.md
index 8b745371..1d813a3f 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -16,9 +16,10 @@ Protocol: 31 (unchanged)
 
 ### ENHANCEMENTS:
 
- - Allow the server side to restrict checksum & compression choices via
-   the same environment variables the client uses.  Allow the env vars
-   to be divided into "client list & server list" by the "`&`" char.
+ - Allow the server side to restrict checksum & compression choices via the
+   same environment variables the client uses.  The env vars can be divided
+   into "client list & server list" by the "`&`" char or the same list can
+   apply to both.
 
  - Simplify how the negotiation environment variables apply when interacting
    with an older rsync version.
diff --git a/checksum.c b/checksum.c
index b3989aa2..6dabfb08 100644
--- a/checksum.c
+++ b/checksum.c
@@ -108,7 +108,7 @@ void parse_checksum_choice(int final_call)
 		} else
 			xfersum_type = checksum_type = parse_csum_name(checksum_choice, -1);
 		if (am_server && checksum_choice)
-			validate_choice_vs_env(xfersum_type, checksum_type);
+			validate_choice_vs_env(NSTR_CHECKSUM, xfersum_type, checksum_type);
 	}
 
 	if (xfersum_type == CSUM_NONE)
diff --git a/compat.c b/compat.c
index 6d260f0d..00b13c87 100644
--- a/compat.c
+++ b/compat.c
@@ -110,9 +110,6 @@ struct name_num_obj valid_compressions = {
 #define CF_INPLACE_PARTIAL_DIR (1<<6)
 #define CF_VARINT_FLIST_FLAGS (1<<7)
 
-#define ENV_CHECKSUM 0
-#define ENV_COMPRESS 1
-
 static const char *client_info;
 
 /* The server makes sure that if either side only supports a pre-release
@@ -178,7 +175,7 @@ void parse_compress_choice(int final_call)
 		}
 		do_compression = nni->num;
 		if (am_server)
-			validate_choice_vs_env(do_compression, -1);
+			validate_choice_vs_env(NSTR_COMPRESS, do_compression, -1);
 	} else if (do_compression)
 		do_compression = CPRES_ZLIB;
 	else
@@ -385,13 +382,13 @@ static void recv_negotiate_str(int f_in, struct name_num_obj *nno, char *tmpbuf,
 	exit_cleanup(RERR_UNSUPPORTED);
 }
 
-static const char *getenv_nstr(int etype)
+static const char *getenv_nstr(int ntype)
 {
-	const char *env_str = getenv(etype == ENV_COMPRESS ? "RSYNC_COMPRESS_LIST" : "RSYNC_CHECKSUM_LIST");
+	const char *env_str = getenv(ntype == NSTR_COMPRESS ? "RSYNC_COMPRESS_LIST" : "RSYNC_CHECKSUM_LIST");
 
 	/* When writing a batch file, we always negotiate an old-style choice. */
 	if (write_batch) 
-		env_str = etype == ENV_COMPRESS ? "zlib" : protocol_version >= 30 ? "md5" : "md4";
+		env_str = ntype == NSTR_COMPRESS ? "zlib" : protocol_version >= 30 ? "md5" : "md4";
 
 	if (am_server && env_str) {
 		char *cp = strchr(env_str, '&');
@@ -402,11 +399,10 @@ static const char *getenv_nstr(int etype)
 	return env_str;
 }
 
-/* If num2 < 0 then the caller is checking compress values, otherwise checksum values. */
-void validate_choice_vs_env(int num1, int num2)
+void validate_choice_vs_env(int ntype, int num1, int num2)
 {
-	struct name_num_obj *nno = num2 < 0 ? &valid_compressions : &valid_checksums;
-	const char *list_str = getenv_nstr(num2 < 0 ? ENV_COMPRESS : ENV_CHECKSUM);
+	struct name_num_obj *nno = ntype == NSTR_COMPRESS ? &valid_compressions : &valid_checksums;
+	const char *list_str = getenv_nstr(ntype);
 	char tmpbuf[MAX_NSTR_STRLEN];
 
 	if (!list_str)
@@ -420,12 +416,13 @@ void validate_choice_vs_env(int num1, int num2)
 	init_nno_saw(nno, 0);
 	parse_nni_str(nno, list_str, tmpbuf, MAX_NSTR_STRLEN);
 
-	if (num2 >= 0) /* If "md4" is in the env list, all the old MD4 choices are OK too. */
+	if (ntype == NSTR_CHECKSUM) /* If "md4" is in the env list, all the old MD4 choices are OK too. */
 		nno->saw[CSUM_MD4_ARCHAIC] = nno->saw[CSUM_MD4_BUSTED] = nno->saw[CSUM_MD4_OLD] = nno->saw[CSUM_MD4];
 
 	if (!nno->saw[num1] || (num2 >= 0 && !nno->saw[num2])) {
 		rprintf(FERROR, "Your --%s-choice value (%s) was refused by the server.\n", 
-			num2 < 0 ? "compress" : "checksum", num2 < 0 ? compress_choice : checksum_choice);
+			ntype == NSTR_COMPRESS ? "compress" : "checksum",
+			ntype == NSTR_COMPRESS ? compress_choice : checksum_choice);
 		exit_cleanup(RERR_UNSUPPORTED);
 	}
 
@@ -480,10 +477,10 @@ int get_default_nno_list(struct name_num_obj *nno, char *to_buf, int to_buf_len,
 	return len;
 }
 
-static void send_negotiate_str(int f_out, struct name_num_obj *nno, int etype)
+static void send_negotiate_str(int f_out, struct name_num_obj *nno, int ntype)
 {
 	char tmpbuf[MAX_NSTR_STRLEN];
-	const char *list_str = getenv_nstr(etype);
+	const char *list_str = getenv_nstr(ntype);
 	int len;
 
 	if (list_str && *list_str) {
@@ -514,10 +511,10 @@ static void negotiate_the_strings(int f_in, int f_out)
 	/* We send all the negotiation strings before we start to read them to help avoid a slow startup. */
 
 	if (!checksum_choice)
-		send_negotiate_str(f_out, &valid_checksums, ENV_CHECKSUM);
+		send_negotiate_str(f_out, &valid_checksums, NSTR_CHECKSUM);
 
 	if (do_compression && !compress_choice)
-		send_negotiate_str(f_out, &valid_compressions, ENV_COMPRESS);
+		send_negotiate_str(f_out, &valid_compressions, NSTR_COMPRESS);
 
 	if (valid_checksums.saw) {
 		char tmpbuf[MAX_NSTR_STRLEN];
diff --git a/rsync.1.md b/rsync.1.md
index e75544e9..07691efc 100644
--- a/rsync.1.md
+++ b/rsync.1.md
@@ -1474,15 +1474,16 @@ your home directory (remove the '=' for that).
 
     The checksum options that you may be able to use are:
 
-    - `auto` (the default)
+    - `auto` (the default automatic choice)
     - `xxh128`
     - `xxh3`
-    - `xxh64` (aka xxhash)
+    - `xxh64` (aka `xxhash`)
     - `md5`
     - `md4`
     - `none`
 
-    Run `rsync -V` to see the default checksum list compiled into your version.
+    Run `rsync -V` to see the default checksum list compiled into your version
+    (which may differ from the above list).
 
     If "none" is specified for the first (or only) name, the `--whole-file`
     option is forced on and no checksum verification is performed on the
@@ -1492,26 +1493,22 @@ your home directory (remove the '=' for that).
     The "auto" option is the default, where rsync bases its algorithm choice on
     a negotiation between the client and the server as follows:
 
-    If both the client and the server are at least version 3.2.0, they will
-    exchange a list of checksum names and choose the first one in the client's
-    list that
-    they have in common.  This typically means that they will choose xxh64 if
-    they both support it and fall back to MD5.  If one side of the transfer is
-    not new enough to support this checksum negotiation, then a value is chosen
-    based on the protocol version (which chooses between MD5 and various
-    flavors of MD4 based on protocol age).
-
-    You can also override the checksum using the RSYNC_CHECKSUM_LIST
-    environment variable by setting it to a space-separated list of checksum
-    names that you consider acceptable.  If no common checksum is found, the
-    client exits with an error.  This method does not allow you to specify the
-    transfer checksum separately from the pre-transfer checksum, and it ignores
-    "auto" and all unknown checksum names.  If the remote rsync is not new
-    enough to handle a checksum negotiation list, its list is assumed to
-    consist of a single "md5" or "md4" item based on the protocol version.  If
-    the environment variable contains a "`&`" character, the string is
-    separated into the client list & server list, either one of which can be
-    empty (giving that side the default list).
+    When both sides of the transfer are at least 3.2.0, rsync chooses the first
+    algorithm in the client's list of choices that is also in the server's list
+    of choices.  If no common checksum choice is found, the client exits with
+    an error.  If the remote rsync is too old to support checksum negotiation,
+    a value is chosen based on the protocol version (which chooses between MD5
+    and various flavors of MD4 based on protocol age).
+
+    The default order can be customized by setting the environment variable
+    RSYNC_CHECKSUM_LIST to a space-separated list of acceptable checksum names.
+    If the environment variable contains a "`&`" character, the string is
+    separated into the "client list & server list".  If the resulting string is
+    empty (or contains only whitespace) the default checksum list is used.
+    This method does not allow you to specify the transfer checksum separately
+    from the pre-transfer checksum, and it discards "auto" and all unknown
+    checksum names.  A list with only invalid names will result in a failed
+    negotiation.
 
     The use of the `--checksum-choice` option overrides this environment list.
 
@@ -1738,16 +1735,16 @@ your home directory (remove the '=' for that).
     data that goes into the file-lists, and thus it doesn't affect deletions.
     It just limits the files that the receiver requests to be transferred.
 
-    The suffix letters are (in upper/lower-case): `B`, `K`, `G`, `T`, and `P`
-    for bytes, kilobytes/kibibytes, megabytes/mebibytes, gigabytes/gibibytes,
+    The accepted suffix letters are: `B`, `K`, `G`, `T`, and `P` for bytes,
+    kilobytes/kibibytes, megabytes/mebibytes, gigabytes/gibibytes,
     terabytes/tebibytes, and petabytes/pebibytes.  If you use a single-char
     suffix or add-on "ib" to it (e.g. "G" or "GiB") then you get units that are
     multiples of 1024.  If you use a two-letter suffix that ends with a "B"
-    (e.g. "kb") then you get units that are multiples of 1000.
+    (e.g. "kb") then you get units that are multiples of 1000.  The suffix
+    letters can be any mix of upper and lower-case that you want to use.
 
-    Finally, if the string ends with either "+1" or "-1", it will be offset by
-    one byte in the indicated direction.  The largest possible value is
-    `8192P-1`.
+    Finally, if the string ends with either "+1" or "-1", it is offset by one
+    byte in the indicated direction.  The largest possible value is `8192P-1`.
 
     Examples: `--max-size=1.5mb-1` is 1499999 bytes, and `--max-size=2g+1` is
     2147483649 bytes.
@@ -1765,24 +1762,24 @@ your home directory (remove the '=' for that).
 0.  `--max-alloc=SIZE`
 
     By default rsync limits an individual malloc/realloc to about 1GB in size.
-    For most people this limit works just fine and prevents a code issue
+    For most people this limit works just fine and prevents a protocol error
     causing rsync to request massive amounts of memory.  However, if you have
-    many millions of files in a transfer, a huge amount of server memory, and
+    many millions of files in a transfer, a large amount of server memory, and
     you don't want to split up your transfer into multiple parts, you can
     increase the per-allocation limit to something larger and rsync will
     consume more memory.
 
     Keep in mind that this is not a limit on the total size of allocated
-    memory.  It is a sanity-check value for individual allocations.
+    memory.  It is a sanity-check value for each individual allocation.
 
     See the `--max-size` option for a description of how SIZE can be specified.
     The default suffix if none is given is bytes.
 
     You can set a default value using the environment variable RSYNC_MAX_ALLOC
     using the same SIZE values as supported by this option.  If the remote
-    rsync doesn't understand the `--max-alloc` option, you can override the
-    setting by specifying `--max-alloc=1g` (because rsync will not send the
-    option to the remote side when the value is the default).
+    rsync doesn't understand the `--max-alloc` option, you can override an
+    environmental value by specifying `--max-alloc=1g`, which will make rsync
+    avoid sending the option to the remote side (because "1G" is the default).
 
 0.  `--block-size=SIZE`, `-B`
 
@@ -2296,18 +2293,21 @@ your home directory (remove the '=' for that).
     Rsync supports multiple compression methods and will choose one for you
     unless you force the choice using the `--compress-choice` option.
 
-    Run `rsync -V` to see the compress list compiled into your version.
+    Run `rsync -V` to see the default compress list compiled into your version.
 
     When both sides of the transfer are at least 3.2.0, rsync chooses the first
     algorithm in the client's list of choices that is also in the server's list
-    of choices.  The default order can be customized by setting the environment
-    variable RSYNC_COMPRESS_LIST to a space-separated list of acceptable
-    compression names.  If no common compress choice is found, the client exits
-    with an error.  If the remote rsync is too old to support checksum
-    negotiation, its list is assumed to be "zlib".  If the environment variable
-    contains a "`&`" character, the string is separated into the client list &
-    server list, either one of which can be empty (giving that side the default
-    list).
+    of choices.  If no common compress choice is found, the client exits with
+    an error.  If the remote rsync is too old to support checksum negotiation,
+    its list is assumed to be "zlib".
+
+    The default order can be customized by setting the environment variable
+    RSYNC_COMPRESS_LIST to a space-separated list of acceptable compression
+    names.  If the environment variable contains a "`&`" character, the string
+    is separated into the "client list & server list".  If the resulting string
+    is empty (or contains only whitespace) the default compress list is used.
+    Any unknown compression names are discarded from the list, but a list with
+    only invalid names will result in a failed negotiation.
 
     There are some older rsync versions that were configured to reject a `-z`
     option and require the use of `-zz` because their compression library was
@@ -2320,8 +2320,10 @@ your home directory (remove the '=' for that).
 
 0.  `--compress-choice=STR`, `--zc=STR`
 
-    This option can be used to override the automatic selection of the
-    compression algorithm that is the default when `--compress` is used.
+    This option can be used to override the automatic negotiation of the
+    compression algorithm that occurs when `--compress` is used.  The option
+    implies `--compress` unless "none" was specified, which instead implies
+    `--no-compress`.
 
     The compression options that you may be able to use are:
 
@@ -2331,7 +2333,8 @@ your home directory (remove the '=' for that).
     - `zlib`
     - `none`
 
-    Run `rsync -V` to see the compress list compiled into your version.
+    Run `rsync -V` to see the default compress list compiled into your version
+    (which may differ from the above list).
 
     Note that if you see an error about an option named `--old-compress` or
     `--new-compress`, this is rsync trying to send the `--compress-choice=zlib`
@@ -2343,10 +2346,6 @@ your home directory (remove the '=' for that).
     with matched data excluded from the compression stream (to try to make it
     more compatible with an external zlib implementation).
 
-    If "none" is specified, that is equivalent to using `--no-compress`.
-
-    This option implies `--compress` unless "none" was specified.
-
 0.  `--compress-level=NUM`, `--zl=NUM`
 
     Explicitly set the compression level to use (see `--compress`, `-z`)
diff --git a/rsync.h b/rsync.h
index 22a3a949..45de2314 100644
--- a/rsync.h
+++ b/rsync.h
@@ -1078,6 +1078,9 @@ typedef struct {
 #define CPRES_LZ4 3
 #define CPRES_ZSTD 4
 
+#define NSTR_CHECKSUM 0
+#define NSTR_COMPRESS 1
+
 struct name_num_item {
 	int num;
 	const char *name, *main_name;


-- 
The rsync repository.



More information about the rsync-cvs mailing list