From: Wayne Davison Date: Sun, 2 Jan 2022 22:46:27 +0000 (-0800) Subject: Tweak stderr handling for older BackupPC versions X-Git-Tag: v3.2.4pre1~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4adfdaaf12db26c348b4d6150119b377f9b622c8;p=thirdparty%2Frsync.git Tweak stderr handling for older BackupPC versions This makes the default for a protocol-28 server process be --stderr=client instead of --stderr=errors. See rsync's github issue #95. --- diff --git a/NEWS.md b/NEWS.md index 6635ccab..05215c08 100644 --- a/NEWS.md +++ b/NEWS.md @@ -130,6 +130,9 @@ - Work around a glibc bug where lchmod() breaks in a chroot w/o /proc mounted. + - Try to support a client that sent a remote rsync a wacko stderr file handle + (such as an older File::RsyncP perl library used by BackupPC). + - Some manpage improvements. ### PACKAGING RELATED: diff --git a/compat.c b/compat.c index 0a882cda..e84cc8c0 100644 --- a/compat.c +++ b/compat.c @@ -52,6 +52,8 @@ extern int need_messages_from_generator; extern int delete_mode, delete_before, delete_during, delete_after; extern int do_compression; extern int do_compression_level; +extern int saw_stderr_opt; +extern int msgs2stderr; extern char *shell_cmd; extern char *partial_dir; extern char *files_from; @@ -622,6 +624,9 @@ void setup_protocol(int f_out,int f_in) if (read_batch) check_batch_flags(); + if (!saw_stderr_opt && protocol_version <= 28 && am_server) + msgs2stderr = 0; /* The client side may not have stderr setup for us. */ + #ifndef SUPPORT_PREALLOCATION if (preallocate_files && !am_sender) { rprintf(FERROR, "preallocation is not supported on this %s\n", diff --git a/options.c b/options.c index eb5744a1..eb16c4f6 100644 --- a/options.c +++ b/options.c @@ -91,6 +91,7 @@ int implied_dirs = 1; int missing_args = 0; /* 0 = FERROR_XFER, 1 = ignore, 2 = delete */ int numeric_ids = 0; int msgs2stderr = 2; /* Default: send errors to stderr for local & remote-shell transfers */ +int saw_stderr_opt = 0; int allow_8bit_chars = 0; int force_delete = 0; int io_timeout = 0; @@ -1882,6 +1883,7 @@ int parse_arguments(int *argc_p, const char ***argv_p) "--stderr mode \"%s\" is not one of errors, all, or client\n", arg); return 0; } + saw_stderr_opt = 1; break; } @@ -1900,6 +1902,9 @@ int parse_arguments(int *argc_p, const char ***argv_p) } } + if (msgs2stderr != 2) + saw_stderr_opt = 1; + if (version_opt_cnt) { print_rsync_version(FINFO); exit_cleanup(0);