From: Wayne Davison Date: Thu, 28 Jul 2005 01:34:39 +0000 (+0000) Subject: Improved the error reporting in options.c and the documentation X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/commitdiff_plain/a2b0f4c8688559f6268cbd7e5ea1a92b4b4da4bd Improved the error reporting in options.c and the documentation in the manpage. --- diff --git a/append.diff b/append.diff index a9b2304..9e4769f 100644 --- a/append.diff +++ b/append.diff @@ -1,7 +1,7 @@ This patch adds the --append option, which works like a "resume" mode in an ftp client, appending new data onto the end of the files it updates. ---- orig/generator.c 2005-05-22 20:53:34 +--- orig/generator.c 2005-07-27 23:31:12 +++ generator.c 2005-03-03 02:59:17 @@ -54,6 +54,7 @@ extern int delay_updates; extern int update_only; @@ -11,7 +11,7 @@ an ftp client, appending new data onto the end of the files it updates. extern int make_backups; extern int csum_length; extern int ignore_times; -@@ -468,35 +469,42 @@ static void generate_and_send_sums(int f +@@ -470,35 +471,42 @@ static void generate_and_send_sums(int f OFF_T offset = 0; sum_sizes_sqroot(&sum, len); @@ -61,7 +61,7 @@ an ftp client, appending new data onto the end of the files it updates. } if (mapbuf) -@@ -1005,6 +1013,9 @@ static void recv_generator(char *fname, +@@ -1007,6 +1015,9 @@ static void recv_generator(char *fname, return; } @@ -71,7 +71,7 @@ an ftp client, appending new data onto the end of the files it updates. if (!compare_dest && fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH) ; else if (fnamecmp_type == FNAMECMP_FUZZY) -@@ -1178,7 +1189,7 @@ void generate_files(int f_out, struct fi +@@ -1180,7 +1191,7 @@ void generate_files(int f_out, struct fi do_delete_pass(flist); do_progress = 0; @@ -80,7 +80,7 @@ an ftp client, appending new data onto the end of the files it updates. whole_file = 0; if (verbose >= 2) { rprintf(FINFO, "delta-transmission %s\n", -@@ -1235,6 +1246,8 @@ void generate_files(int f_out, struct fi +@@ -1239,6 +1250,8 @@ void generate_files(int f_out, struct fi only_existing = max_size = opt_ignore_existing = 0; update_only = always_checksum = size_only = 0; ignore_times = 1; @@ -130,8 +130,8 @@ an ftp client, appending new data onto the end of the files it updates. matched(f, s, buf, j, -2); matched(f, s, buf, len, -1); } ---- orig/options.c 2005-05-19 08:52:42 -+++ options.c 2005-03-11 11:21:34 +--- orig/options.c 2005-07-27 23:31:12 ++++ options.c 2005-07-28 01:28:22 @@ -38,6 +38,7 @@ int make_backups = 0; **/ int whole_file = -1; @@ -173,11 +173,16 @@ an ftp client, appending new data onto the end of the files it updates. break; } if (!is_wild) -@@ -1126,6 +1132,14 @@ int parse_arguments(int *argc, const cha +@@ -1128,6 +1134,19 @@ int parse_arguments(int *argc, const cha bwlimit_writemax = 512; } + if (append_mode) { ++ if (whole_file > 0) { ++ snprintf(err_buf, sizeof err_buf, ++ "--append cannot be used with --whole-file\n"); ++ return 0; ++ } + if (refused_inplace) { + create_refuse_error(refused_inplace); + return 0; @@ -188,7 +193,27 @@ an ftp client, appending new data onto the end of the files it updates. if (delay_updates && !partial_dir) partial_dir = partialdir_for_delayupdate; -@@ -1438,7 +1452,9 @@ void server_options(char **args,int *arg +@@ -1135,7 +1154,8 @@ int parse_arguments(int *argc, const cha + #ifdef HAVE_FTRUNCATE + if (partial_dir) { + snprintf(err_buf, sizeof err_buf, +- "--inplace cannot be used with --%s\n", ++ "--%s cannot be used with --%s\n", ++ append_mode ? "append" : "inplace", + delay_updates ? "delay-updates" : "partial-dir"); + return 0; + } +@@ -1148,7 +1168,8 @@ int parse_arguments(int *argc, const cha + keep_partial = 0; + #else + snprintf(err_buf, sizeof err_buf, +- "--inplace is not supported on this %s\n", ++ "--%s is not supported on this %s\n", ++ append_mode ? "append" : "inplace", + am_server ? "server" : "client"); + return 0; + #endif +@@ -1440,7 +1461,9 @@ void server_options(char **args,int *arg if (opt_ignore_existing && am_sender) args[ac++] = "--ignore-existing"; @@ -246,9 +271,9 @@ an ftp client, appending new data onto the end of the files it updates. continue; } ---- orig/rsync.yo 2005-05-22 20:53:34 -+++ rsync.yo 2005-02-11 20:36:38 -@@ -309,6 +309,7 @@ to the detailed description below for a +--- orig/rsync.yo 2005-07-07 23:11:09 ++++ rsync.yo 2005-07-28 01:28:24 +@@ -298,6 +298,7 @@ to the detailed description below for a --suffix=SUFFIX backup suffix (default ~ w/o --backup-dir) -u, --update skip files that are newer on the receiver --inplace update destination files in-place @@ -256,17 +281,17 @@ an ftp client, appending new data onto the end of the files it updates. -d, --dirs transfer directories without recursing -l, --links copy symlinks as symlinks -L, --copy-links transform symlink into referent file/dir -@@ -568,6 +569,14 @@ should not use this option to update fil +@@ -557,6 +558,14 @@ should not use this option to update fil rsync will be unable to update a file in-place that is not writable by the receiving user. +dit(bf(--append)) This causes rsync to update a file by appending data onto +the end of the file, which presumes that the data that already exists on +the receiving side is identical with the start of the file on the sending -+side. If that is not true, the file will fail the checksum check, and a -+normal bf(--inplace) update will correct the mismatch. Any file on the -+receiving side that is longer than a file on the sending side is skipped. -+Implies bf(--inplace). ++side. If that is not true, the file will fail the checksum test, and the ++resend will do a normal bf(--inplace) update to correct the mismatch. Any ++file on the receiving side that is longer than a file on the sending side ++is skipped. Implies bf(--inplace). + dit(bf(-d, --dirs)) Tell the sending side to include any directories that are encountered. Unlike bf(--recursive), a directory's contents are not copied