[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Sat Jan 28 13:06:09 MST 2012


The branch, master has been updated
       via  b55115e Fix --only-write-batch hang with --hard-links. Fixes bug 8565.
       via  f5e2b8f Add a slash-stripping version of rsync in support dir.
       via  41c5ba6 flist->in_progress is only needed w/inc_recurese.
       via  0dfd2a6 Make stderr line-buffered w/--msgs2stderr.
       via  6686b93 Add new --outbuf=N|L|B option.
      from  9510fa9 Allow --max-size=0 and --min-size=0. Fixes bug 7965.

;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b55115ec6f127f7def2dfcc907bf6e28d775e53c
Author: Wayne Davison <wayned at samba.org>
Date:   Sat Jan 28 11:51:28 2012 -0800

    Fix --only-write-batch hang with --hard-links.
    Fixes bug 8565.

commit f5e2b8f80308bb390da5656db3bf22774c2f371e
Author: Wayne Davison <wayned at samba.org>
Date:   Sat Jan 28 10:39:40 2012 -0800

    Add a slash-stripping version of rsync in support dir.

commit 41c5ba641fe0e71ba9ebf25c4bb1463b511677ed
Author: Wayne Davison <wayned at samba.org>
Date:   Sat Jan 28 10:39:21 2012 -0800

    flist->in_progress is only needed w/inc_recurese.

commit 0dfd2a64ec7c2ae1cfd9c97ec37b9d17c4c42977
Author: Wayne Davison <wayned at samba.org>
Date:   Sat Jan 28 10:38:31 2012 -0800

    Make stderr line-buffered w/--msgs2stderr.

commit 6686b93a7ae3ad5732c29f173cd34e97f188975f
Author: Wayne Davison <wayned at samba.org>
Date:   Sat Jan 28 10:36:43 2012 -0800

    Add new --outbuf=N|L|B option.

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

Summary of changes:
 configure.ac              |    2 +-
 generator.c               |    3 ++-
 hlink.c                   |    2 +-
 io.c                      |    3 ++-
 options.c                 |   40 ++++++++++++++++++++++++++++++++++++++++
 receiver.c                |    2 ++
 rsync.yo                  |   11 +++++++++++
 support/rsync-slash-strip |   17 +++++++++++++++++
 8 files changed, 76 insertions(+), 4 deletions(-)
 create mode 100755 support/rsync-slash-strip


Changeset truncated at 500 lines:

diff --git a/configure.ac b/configure.ac
index 9e6b555..a73fce6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -601,7 +601,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
     setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
     seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \
     extattr_get_link sigaction sigprocmask setattrlist getgrouplist \
-    initgroups utimensat posix_fallocate attropen)
+    initgroups utimensat posix_fallocate attropen setvbuf)
 
 dnl cygwin iconv.h defines iconv_open as libiconv_open
 if test x"$ac_cv_func_iconv_open" != x"yes"; then
diff --git a/generator.c b/generator.c
index c44ba3b..973e03b 100644
--- a/generator.c
+++ b/generator.c
@@ -81,6 +81,7 @@ extern int link_dest;
 extern int whole_file;
 extern int list_only;
 extern int read_batch;
+extern int write_batch;
 extern int safe_symlinks;
 extern long block_size; /* "long" because popt can't set an int32. */
 extern int unsort_ndx;
@@ -1813,7 +1814,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
   notify_others:
 	if (remove_source_files && !delay_updates && !phase && !dry_run)
 		increment_active_files(ndx, itemizing, code);
-	if (inc_recurse && !dry_run)
+	if (inc_recurse && (!dry_run || write_batch < 0))
 		cur_flist->in_progress++;
 #ifdef SUPPORT_HARD_LINKS
 	if (preserve_hard_links && F_IS_HLINKED(file))
diff --git a/hlink.c b/hlink.c
index 0e61d5a..f192e3a 100644
--- a/hlink.c
+++ b/hlink.c
@@ -496,7 +496,7 @@ void finish_hard_link(struct file_struct *file, const char *fname, int fin_ndx,
 	int prev_statret, ndx, prev_ndx = F_HL_PREV(file);
 
 	if (stp == NULL && prev_ndx >= 0) {
-		if (link_stat(fname, &st, 0) < 0) {
+		if (link_stat(fname, &st, 0) < 0 && !dry_run) {
 			rsyserr(FERROR_XFER, errno, "stat %s failed",
 				full_fname(fname));
 			return;
diff --git a/io.c b/io.c
index a21d81f..8854898 100644
--- a/io.c
+++ b/io.c
@@ -1046,7 +1046,8 @@ static void got_flist_entry_status(enum festatus status, int ndx)
 				if (status == FES_NO_SEND)
 					flist_ndx_push(&hlink_list, -2); /* indicates a failure follows */
 				flist_ndx_push(&hlink_list, ndx);
-				flist->in_progress++;
+				if (inc_recurse)
+					flist->in_progress++;
 			}
 		}
 #endif
diff --git a/options.c b/options.c
index 9b701d3..c556617 100644
--- a/options.c
+++ b/options.c
@@ -303,6 +303,7 @@ static int refused_partial, refused_progress, refused_delete_before;
 static int refused_delete_during;
 static int refused_inplace, refused_no_iconv;
 static BOOL usermap_via_chown, groupmap_via_chown;
+static char *outbuf_mode;
 static char *bwlimit_arg, *max_size_arg, *min_size_arg;
 static char tmp_partialdir[] = ".~tmp~";
 
@@ -789,6 +790,9 @@ void usage(enum logcode F)
   rprintf(F,"     --password-file=FILE    read daemon-access password from FILE\n");
   rprintf(F,"     --list-only             list the files instead of copying them\n");
   rprintf(F,"     --bwlimit=RATE          limit socket I/O bandwidth\n");
+#ifdef HAVE_SETVBUF
+  rprintf(F,"     --outbuf=N|L|B          set output buffering to None, Line, or Block\n");
+#endif
   rprintf(F,"     --write-batch=FILE      write a batched update to FILE\n");
   rprintf(F,"     --only-write-batch=FILE like --write-batch but w/o updating destination\n");
   rprintf(F,"     --read-batch=FILE       read a batched update from FILE\n");
@@ -1025,6 +1029,9 @@ static struct poptOption long_options[] = {
   {"password-file",    0,  POPT_ARG_STRING, &password_file, 0, 0, 0 },
   {"blocking-io",      0,  POPT_ARG_VAL,    &blocking_io, 1, 0, 0 },
   {"no-blocking-io",   0,  POPT_ARG_VAL,    &blocking_io, 0, 0, 0 },
+#ifdef HAVE_SETVBUF
+  {"outbuf",           0,  POPT_ARG_STRING, &outbuf_mode, 0, 0, 0 },
+#endif
   {"remote-option",   'M', POPT_ARG_STRING, 0, 'M', 0, 0 },
   {"protocol",         0,  POPT_ARG_INT,    &protocol_version, 0, 0, 0 },
   {"checksum-seed",    0,  POPT_ARG_INT,    &checksum_seed, 0, 0, 0 },
@@ -1820,6 +1827,39 @@ int parse_arguments(int *argc_p, const char ***argv_p)
 		exit_cleanup(0);
 	}
 
+#ifdef HAVE_SETVBUF
+	if (outbuf_mode && !am_server) {
+		int mode = *(uchar *)outbuf_mode;
+		if (islower(mode))
+			mode = toupper(mode);
+		fflush(stdout); /* Just in case... */
+		switch (mode) {
+		case 'N': /* None */
+		case 'U': /* Unbuffered */
+			mode = _IONBF;
+			break;
+		case 'L': /* Line */
+			mode = _IOLBF;
+			break;
+		case 'B': /* Block */
+		case 'F': /* Full */
+			mode = _IOFBF;
+			break;
+		default:
+			snprintf(err_buf, sizeof err_buf,
+				"Invalid --outbuf setting -- specify N, L, or B.\n");
+			return 0;
+		}
+		setvbuf(stdout, (char *)NULL, mode, 0);
+	}
+
+	if (msgs2stderr) {
+		/* Make stderr line buffered for better sharing of the stream. */
+		fflush(stderr); /* Just in case... */
+		setvbuf(stderr, (char *)NULL, _IOLBF, 0);
+	}
+#endif
+
 	set_output_verbosity(verbose, DEFAULT_PRIORITY);
 
 	if (do_stats) {
diff --git a/receiver.c b/receiver.c
index 3ab893d..ddcb55f 100644
--- a/receiver.c
+++ b/receiver.c
@@ -681,6 +681,8 @@ int recv_files(int f_in, int f_out, char *local_name)
 			log_item(FCLIENT, file, iflags, NULL);
 			if (!am_server)
 				discard_receive_data(f_in, F_LENGTH(file));
+			if (inc_recurse)
+				send_msg_int(MSG_SUCCESS, ndx);
 			continue;
 		}
 
diff --git a/rsync.yo b/rsync.yo
index e18fd2c..a062089 100644
--- a/rsync.yo
+++ b/rsync.yo
@@ -434,6 +434,7 @@ to the detailed description below for a complete description.  verb(
      --port=PORT             specify double-colon alternate port number
      --sockopts=OPTIONS      specify custom TCP options
      --blocking-io           use blocking I/O for the remote shell
+     --outbuf=N|L|B          set out buffering to None, Line, or Block
      --stats                 give some file-transfer stats
  -8, --8-bit-output          leave high-bit chars unescaped in output
  -h, --human-readable        output numbers in a human-readable format
@@ -564,6 +565,9 @@ messages back to the client side, so if you are doing any daemon-transfer
 debugging using this option, you should start up a daemon using bf(--no-detach)
 so that you can see the stderr output on the daemon side.
 
+This option has the side-effect of making stderr output get line-buffered so
+that the merging of the output of 3 programs happens in a more readable manner.
+
 dit(bf(-q, --quiet)) This option decreases the amount of information you
 are given during the transfer, notably suppressing information messages
 from the remote server. This option is useful when invoking rsync from
@@ -2007,6 +2011,13 @@ rsync defaults to using
 blocking I/O, otherwise it defaults to using non-blocking I/O.  (Note that
 ssh prefers non-blocking I/O.)
 
+dit(bf(--outbuf=MODE)) This sets the output buffering mode.  The mode can be
+None (aka Unbuffered), Line, or Block (aka Full).  You may specify as little
+as a single letter for the mode, and use upper or lower case.
+
+The main use of this option is to change Full buffering to Line buffering
+when rsync's output is going to a file or pipe.
+
 dit(bf(-i, --itemize-changes)) Requests a simple itemized list of the
 changes that are being made to each file, including attribute changes.
 This is exactly the same as specifying bf(--out-format='%i %n%L').
diff --git a/support/rsync-slash-strip b/support/rsync-slash-strip
new file mode 100755
index 0000000..43b82bf
--- /dev/null
+++ b/support/rsync-slash-strip
@@ -0,0 +1,17 @@
+#!/bin/bash
+# This script can be used as an rsync command-line filter that strips a single
+# trailing slash from each arg.  That treats "src/" the same as "src", thus
+# you need to use "src/." or "src//" for just the contents of the "src" dir.
+# (Note that command-line dir-excludes would need to use "excl//" too.)
+#
+# To use this, name it something like "rs", put it somewhere in your path, and
+# then use "rs" in place of "rsync" when you are typing your copy commands.
+args=()
+for arg in "${@}"; do
+    if [[ "$arg" == / ]]; then
+	args=("${args[@]}" /)
+    else
+	args=("${args[@]}" "${arg%/}")
+    fi
+done
+exec /usr/bin/rsync "${args[@]}"


-- 
The rsync repository.


More information about the rsync-cvs mailing list