batch diffs

Kalev Soikonen sokos at
Sun Jun 2 12:48:02 EST 2002

  I needed a tool to produce diffs of binary volumes, and to apply them as
patches accordingly. So I tried the 'batch mode' that was added to rsync,
but it invariably segfaulted on reading the batches...

	$ sh foo.rsync_argvs
	foo.rsync_argvs: line 1:  8971 Segmentation fault      rsync -a -v --stats --read-batch=foo ${1:-FOO}
	rsync: error writing 64 unbuffered bytes - exiting: Broken pipe
	rsync error: error in rsync protocol data stream (code 12) at io.c(463)

	$ rsync --version
	rsync  version 2.5.5  protocol version 26
	Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles, 
	              no IPv6, 64-bit system inums, 64-bit internal inums

  Digging around in the sources (uhg), I found that this occurs because...
batch.c line 485 dereferences s->sums[i] which is NULL, because... generator
thinks it can disable_deltas_p() when batches are read.

  I'm not sure about the usefulness of this batch support, but the ability
to create rsync diffs would be awesome. (Without updating the destination,
and why all that checksum data?) Would it not be better to provide separate
utiliti(es) for this purpose and not clutter up rsync code?

-------------- next part --------------
diff -ru rsync-2.5.5.orig/generator.c rsync-2.5.5/generator.c
--- rsync-2.5.5.orig/generator.c	Mon Mar 25 07:54:31 2002
+++ rsync-2.5.5/generator.c	Sun Jun  2 20:25:54 2002
@@ -141,6 +141,7 @@
 	extern int whole_file, no_whole_file;
 	extern int local_server;
 	extern int write_batch;
+	extern int read_batch;
 	assert(whole_file == 0 || whole_file == 1);
@@ -150,7 +151,7 @@
 		return True;
 	else if (no_whole_file)
 		return False;
-	else if (write_batch)
+	else if (write_batch || read_batch)
 		return False;
 		return local_server;

More information about the rsync mailing list