using -v and -q together

Mike Frysinger vapier at gentoo.org
Sat May 13 20:27:02 GMT 2006


seems the behavior of rsync has changed when dealing with output and using 
both -v and -q at the same time ... for example:
$ mkdir test1
$ touch test1/foo
$ rsync-2.6.0 -avq test1 test2
$ rm -r test2
$ rsync-2.6.8 -avq test1 test2
test1/
test1/fo
$ rm -r test2
$ rsync-cvs -avq test1 test2
building file list ... test1/
test1/fo
$ rm -r test2

the new output in 2.6.8 comes from the calls to maybe_log_item() and 
log_item() in send_files() ... one way to fix this would be to update the 
code around that to check the 'quiet' variable:
+++ sender.c
@@
 extern int verbose;
+extern int quiet;
 
@@ send_files()
 		if (!(iflags & ITEM_TRANSFER)) {
+			if (!quiet)
 			maybe_log_item(file,·iflags,·itemizing,·xname);
@@ send_files()
 		if (!do_xfers) { /* log the transfer */
-			if (!am_server && log_format)
+			if (!am_server && log_format && !quiet)
 				log_item(file, &stats, iflags, NULL);

another way might be to update log.c and check the quiet status in there ... 
not quite sure how to go about this one though ...

yet another way might be to just tell people to not use -v and -q together:
+++ options.c
@@
 		case 'v':
+			if (quiet) {
+				snprintf(err_buff, sizeof(err_buf),
+				    "dont use -v and -q\n");
+				return 0;
+			}
 			verbose++;
@@
 		case 'q':
+			if (verbose) {
+				snprintf(err_buff, sizeof(err_buf),
+				    "dont use -v and -q\n");
+				return 0;
+			}
 			if (frommain)

side note ... the cvs version of rsync is even a little more quirky ... it 
outputs 'building file list ...' if -v regardless of -q, but only outputs 
the 'done' if -v and not -q ...
-mike


More information about the rsync mailing list