[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Sat Dec 24 13:38:06 MST 2011


The branch, master has been updated
       via  9510fa9 Allow --max-size=0 and --min-size=0. Fixes bug 7965.
       via  d74512e Complain if the --block-size=N value is too large. Fixes bug 8036.
      from  1a27045 Improve the handling of verbose/debug messages

;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9510fa9ab8f33676224564ab19d7796215eda1bf
Author: Wayne Davison <wayned at samba.org>
Date:   Sat Dec 24 12:33:17 2011 -0800

    Allow --max-size=0 and --min-size=0.
    Fixes bug 7965.

commit d74512eb054666198203cdaaaca29a18ba958725
Author: Wayne Davison <wayned at samba.org>
Date:   Sat Dec 24 12:18:40 2011 -0800

    Complain if the --block-size=N value is too large.
    Fixes bug 8036.

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

Summary of changes:
 generator.c |   14 ++++++++------
 options.c   |   18 ++++++++++++------
 rsync.yo    |    4 ++++
 3 files changed, 24 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/generator.c b/generator.c
index e05d889..c44ba3b 100644
--- a/generator.c
+++ b/generator.c
@@ -1602,7 +1602,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
 		goto cleanup;
 	}
 
-	if (max_size > 0 && F_LENGTH(file) > max_size) {
+	if (max_size >= 0 && F_LENGTH(file) > max_size) {
 		if (INFO_GTE(SKIP, 1)) {
 			if (solo_file)
 				fname = f_name(file, NULL);
@@ -1610,7 +1610,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
 		}
 		goto cleanup;
 	}
-	if (min_size > 0 && F_LENGTH(file) < min_size) {
+	if (min_size >= 0 && F_LENGTH(file) < min_size) {
 		if (INFO_GTE(SKIP, 1)) {
 			if (solo_file)
 				fname = f_name(file, NULL);
@@ -2062,9 +2062,11 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
 #endif
 
 		if (check_redo && (ndx = get_redo_num()) != -1) {
+			OFF_T save_max_size = max_size;
+			OFF_T save_min_size = min_size;
 			csum_length = SUM_LENGTH;
-			max_size = -max_size;
-			min_size = -min_size;
+			max_size = -1;
+			min_size = -1;
 			ignore_existing = -ignore_existing;
 			ignore_non_existing = -ignore_non_existing;
 			update_only = -update_only;
@@ -2088,8 +2090,8 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
 			cur_flist = flist;
 
 			csum_length = SHORT_SUM_LENGTH;
-			max_size = -max_size;
-			min_size = -min_size;
+			max_size = save_max_size;
+			min_size = save_min_size;
 			ignore_existing = -ignore_existing;
 			ignore_non_existing = -ignore_non_existing;
 			update_only = -update_only;
diff --git a/options.c b/options.c
index 9e95c86..9b701d3 100644
--- a/options.c
+++ b/options.c
@@ -114,8 +114,8 @@ int ignore_existing = 0;
 int ignore_non_existing = 0;
 int need_messages_from_generator = 0;
 int max_delete = INT_MIN;
-OFF_T max_size = 0;
-OFF_T min_size = 0;
+OFF_T max_size = -1;
+OFF_T min_size = -1;
 int ignore_errors = 0;
 int modify_window = 0;
 int blocking_io = -1;
@@ -1590,7 +1590,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
 			break;
 
 		case OPT_MAX_SIZE:
-			if ((max_size = parse_size_arg(&max_size_arg, 'b')) <= 0) {
+			if ((max_size = parse_size_arg(&max_size_arg, 'b')) < 0) {
 				snprintf(err_buf, sizeof err_buf,
 					"--max-size value is invalid: %s\n",
 					max_size_arg);
@@ -1599,7 +1599,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
 			break;
 
 		case OPT_MIN_SIZE:
-			if ((min_size = parse_size_arg(&min_size_arg, 'b')) <= 0) {
+			if ((min_size = parse_size_arg(&min_size_arg, 'b')) < 0) {
 				snprintf(err_buf, sizeof err_buf,
 					"--min-size value is invalid: %s\n",
 					min_size_arg);
@@ -1890,6 +1890,12 @@ int parse_arguments(int *argc_p, const char ***argv_p)
 	}
 #endif
 
+	if (block_size > MAX_BLOCK_SIZE) {
+		snprintf(err_buf, sizeof err_buf,
+			 "--block-size=%lu is too large (max: %u)\n", block_size, MAX_BLOCK_SIZE);
+		return 0;
+	}
+
 	if (write_batch && read_batch) {
 		snprintf(err_buf, sizeof err_buf,
 			"--write-batch and --read-batch can not be used together\n");
@@ -2539,11 +2545,11 @@ void server_options(char **args, int *argc_p)
 			args[ac++] = arg;
 		} else if (max_delete == 0)
 			args[ac++] = "--max-delete=-1";
-		if (min_size) {
+		if (min_size >= 0) {
 			args[ac++] = "--min-size";
 			args[ac++] = min_size_arg;
 		}
-		if (max_size) {
+		if (max_size >= 0) {
 			args[ac++] = "--max-size";
 			args[ac++] = max_size_arg;
 		}
diff --git a/rsync.yo b/rsync.yo
index 14b2536..e18fd2c 100644
--- a/rsync.yo
+++ b/rsync.yo
@@ -1448,11 +1448,15 @@ be offset by one byte in the indicated direction.
 Examples: --max-size=1.5mb-1 is 1499999 bytes, and --max-size=2g+1 is
 2147483649 bytes.
 
+Note that rsync versions prior to 3.1.0 did not allow bf(--max-size=0).
+
 dit(bf(--min-size=SIZE)) This tells rsync to avoid transferring any
 file that is smaller than the specified SIZE, which can help in not
 transferring small, junk files.
 See the bf(--max-size) option for a description of SIZE and other information.
 
+Note that rsync versions prior to 3.1.0 did not allow bf(--min-size=0).
+
 dit(bf(-B, --block-size=BLOCKSIZE)) This forces the block size used in
 rsync's delta-transfer algorithm to a fixed value.  It is normally selected based on
 the size of each file being updated.  See the technical report for details.


-- 
The rsync repository.


More information about the rsync-cvs mailing list