Fix for batch mode (was Re: batch mode maintainability)

Dave Dykstra dwd at
Thu Jan 24 04:05:15 EST 2002

On Wed, Jan 23, 2002 at 04:37:53PM +1100, Martin Pool wrote:
> On 17 Jan 2002, Jos Backus <josb at> wrote:
> > I have found the problem: a missed change from dev_t to DEV64_T. See the last
> > hunk for batch.c in the patch below against today's CVS. It also appends a
> > newline to the argvs file and skips adding the source directory to the command
> > line.
> Thanks.
> When you get a chance, could you please look at writing some more
> documentation about batch mode?  It would also be good to try to split
> out the code a little more.   All the if(read_batch) conditionals look
> highly breakable.

So, I hadn't gotten a chance to try your patch, but Martin checked in your
changes into CVS and I pulled them back out of there and tried them out.
It is definitely working better.  I'm still seeing a rsync_argvs file
getting created in my home directory on the remote machine; --read-batch
is also printing out "batch file extension" with two different numbers so
that was my clue.  One time I accidentally tried use --read-batch to
directory that didn't match the destination directory that was present
when --write-batch created the files, and then it core dumped at batch.c
line 487:
			if ((s->sums[i].sum1 != file_sum1) ||
			     (s->sums[i].sum2, file_sum2,
			      csum_length) != 0)) {
				*checksums_match = 0;
and gdb said that s->sums[i] was a bad address.  s->sums[0] was OK, but i
was 487.  So, more care needs to be taken with making sure that the
new destination matches the original destination.

Suggestion: have the rsync_argvs file take a $1 parameter as the destination
rather than the original destination, or maybe ${1:-original_dest} so if
a new destination is not specified it will default to the original one.

Interesting tidbit: it apparently works with -W, because I noticed that
when I make a small change to a large file the rsync_delta* file is large
if my original destination is on the same machine as the source (because in
that case -W is implied) but if my original destination is on a remote
machine the rsync_delta* file is small, and both cases produce the correct
result.  Maybe -W should never be implied when --write-batch is on.

- Dave Dykstra

More information about the rsync mailing list