[patch] paranoid checksum checking

Chris Shoemaker c.shoemaker at cox.net
Tue Jul 26 17:39:15 GMT 2005


On Tue, Jul 26, 2005 at 06:19:08PM +0100, Nick Burrett wrote:
> The attached patch provides an additional check for the checksumming 
> mode to ensure that a file that is actually written out to disk can be 
> read back and has the same MD4 sum as the file on at the originating 
> location.

I'm not so sure there's a strong correlation between the group of
people who want the normal '--checksum' behavior and the people who
want forced read-back verification.  I can think of many cases where
the user would want each without the other.

I propose that this behavior shouldn't be grouped with "--checksum"
Instead, perhaps make it a '--verify' or '--re-verify' option.  Also,
this patch needs a corresponding change to rsync.yo.

-chris

> 
> Regards,
> 
> 
> Nick.

> *** rsync-2.6.6pre1/receiver.c	2005-04-14 02:42:13.000000000 +0100
> --- rsync-new/receiver.c	2005-07-26 18:06:56.000000000 +0100
> *************** extern int module_id;
> *** 46,51 ****
> --- 46,52 ----
>   extern int ignore_errors;
>   extern int orig_umask;
>   extern int keep_partial;
> + extern int always_checksum;
>   extern int checksum_seed;
>   extern int inplace;
>   extern int delay_updates;
> *************** int recv_files(int f_in, struct file_lis
> *** 649,654 ****
> --- 650,669 ----
>   			exit_cleanup(RERR_FILEIO);
>   		}
>   
> +                 /* Check that the file written to local disk has the same
> +                    checksum as the file in the originating location.  This
> +                    is a further paranoia check, just to make sure that
> +                    we really have successfully transferred the file.  */
> +                 if (recv_ok && ! am_server && always_checksum) {
> +                         char csum[MD4_SUM_LENGTH + 1];
> +                         file_checksum (fnametmp, csum, file->length);
> +                         if (memcmp(csum, file->u.sum, MD4_SUM_LENGTH) != 0) {
> +                                 rprintf (FERROR, "%s checksum does not match remote checksum\n",
> +                                          full_fname (fnametmp));
> +                                 recv_ok = 0;
> +                         }
> +                 }
> + 
>   		if ((recv_ok && (!delay_updates || !partialptr)) || inplace) {
>   			finish_transfer(fname, fnametmp, file, recv_ok, 1);
>   			if (partialptr != fname && fnamecmp == partialptr) {

> -- 
> To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
> Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


More information about the rsync mailing list