Skip to content

Commit

Permalink
Added the --info=FLAGS an --debug=FLAGS options, which allows
Browse files Browse the repository at this point in the history
fine-grained output control (in addition to the coarse -v).
  • Loading branch information
Wayne Davison committed Jul 14, 2008
1 parent d8d1389 commit 951e826
Show file tree
Hide file tree
Showing 29 changed files with 756 additions and 268 deletions.
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ Changes since 3.0.3:
- Changed the way --progress overwrites its prior output in order to make
it nearly impossible for the progress to get overwritten by an error.

- Improved the keep-alive in-loop check in the generator to work properly
in incremental recursion mode.

ENHANCEMENTS:

- Added the --remote-option=OPT (-M OPT) command-line option that is useful
for things like sending a remote --log-file=FILE or --fake-super option.

- Added the --info=FLAGS and --debug=FLAGS options to allow finer-grained
control over what is output. Added an extra type of --progress output
using --info=progress2.

- Rsync will not send an -e option to the server if the user specifies the
--protocol=29 option. This lets rsync3 use an overly-restrictive server.

Expand Down
2 changes: 1 addition & 1 deletion acls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ int default_perms_for_dir(const char *dir)
/* Apply the permission-bit entries of the default ACL, if any. */
if (racl.user_obj != NO_ENTRY) {
perms = rsync_acl_get_perms(&racl);
if (verbose > 2)
if (DEBUG_GTE(ACL, 1))
rprintf(FINFO, "got ACL-based default perms %o for directory %s\n", perms, dir);
}

Expand Down
11 changes: 5 additions & 6 deletions backup.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "rsync.h"

extern int verbose;
extern int am_root;
extern int preserve_acls;
extern int preserve_xattrs;
Expand Down Expand Up @@ -62,7 +61,7 @@ static int make_simple_backup(const char *fname)

while (1) {
if (do_rename(fname, fnamebak) == 0) {
if (verbose > 1) {
if (INFO_GTE(BACKUP, 1)) {
rprintf(FINFO, "backed up %s to %s\n",
fname, fnamebak);
}
Expand Down Expand Up @@ -260,7 +259,7 @@ static int keep_backup(const char *fname)
}
} else
save_errno = 0;
if (verbose > 2 && save_errno == 0) {
if (DEBUG_GTE(BACKUP, 1) && save_errno == 0) {
rprintf(FINFO, "make_backup: DEVICE %s successful.\n",
fname);
}
Expand All @@ -285,7 +284,7 @@ static int keep_backup(const char *fname)
}

ret_code = do_rmdir(fname);
if (verbose > 2) {
if (DEBUG_GTE(BACKUP, 1)) {
rprintf(FINFO, "make_backup: RMDIR %s returns %i\n",
full_fname(fname), ret_code);
}
Expand All @@ -296,7 +295,7 @@ static int keep_backup(const char *fname)
if (!kept && preserve_links && S_ISLNK(file->mode)) {
const char *sl = F_SYMLINK(file);
if (safe_symlinks && unsafe_symlink(sl, buf)) {
if (verbose) {
if (INFO_GTE(SYMSAFE, 1)) {
rprintf(FINFO, "ignoring unsafe symlink %s -> %s\n",
full_fname(buf), sl);
}
Expand Down Expand Up @@ -345,7 +344,7 @@ static int keep_backup(const char *fname)
preserve_xattrs = save_preserve_xattrs;
unmake_file(file);

if (verbose > 1) {
if (INFO_GTE(BACKUP, 1)) {
rprintf(FINFO, "backed up %s to %s\n",
fname, buf);
}
Expand Down
2 changes: 1 addition & 1 deletion batch.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void check_batch_flags(void)
set ? "Please" : "Do not");
exit_cleanup(RERR_SYNTAX);
}
if (verbose) {
if (INFO_GTE(MISC, 1)) {
rprintf(FINFO,
"%sing the %s option to match the batchfile.\n",
set ? "Sett" : "Clear", flag_name[i]);
Expand Down
12 changes: 6 additions & 6 deletions cleanup.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extern int am_daemon;
extern int io_error;
extern int keep_partial;
extern int got_xfer_error;
extern int progress_is_active;
extern int output_needs_newline;
extern char *partial_dir;
extern char *logfile_name;

Expand Down Expand Up @@ -116,12 +116,12 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)

exit_code = unmodified_code = code;

if (progress_is_active) {
if (output_needs_newline) {
fputc('\n', stdout);
progress_is_active = 0;
output_needs_newline = 0;
}

if (verbose > 3) {
if (DEBUG_GTE(EXIT, 2)) {
rprintf(FINFO,
"_exit_cleanup(code=%d, file=%s, line=%d): entered\n",
code, file, line);
Expand Down Expand Up @@ -184,13 +184,13 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
code = exit_code = RERR_PARTIAL;
}

if (code || am_daemon || (logfile_name && (am_server || !verbose)))
if (code || am_daemon || (logfile_name && (am_server || !INFO_GTE(STATS, 1))))
log_exit(code, file, line);

/* FALLTHROUGH */
#include "case_N.h"

if (verbose > 2) {
if (DEBUG_GTE(EXIT, 1)) {
rprintf(FINFO,
"_exit_cleanup(code=%d, file=%s, line=%d): "
"about to call exit(%d)\n",
Expand Down
8 changes: 3 additions & 5 deletions clientserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "ifuncs.h"

extern int quiet;
extern int verbose;
extern int dry_run;
extern int output_motd;
extern int list_only;
Expand Down Expand Up @@ -267,7 +266,7 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char

sargs[sargc] = NULL;

if (verbose > 1)
if (DEBUG_GTE(CMD, 1))
print_child_argv("sending daemon args:", sargs);

io_printf(f_out, "%.*s\n", modlen, modname);
Expand Down Expand Up @@ -747,7 +746,7 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
read_args(f_in, name, line, sizeof line, rl_nulls, &argv, &argc, &request);
orig_argv = argv;

verbose = 0; /* future verbosity is controlled by client options */
reset_output_levels(); /* future verbosity is controlled by client options */
ret = parse_arguments(&argc, (const char ***) &argv);
if (protect_args && ret) {
orig_early_argv = orig_argv;
Expand Down Expand Up @@ -798,8 +797,7 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)

#ifndef DEBUG
/* don't allow the logs to be flooded too fast */
if (verbose > lp_max_verbosity(i))
verbose = lp_max_verbosity(i);
limit_output_verbosity(lp_max_verbosity(i));
#endif

if (protocol_version < 23
Expand Down
3 changes: 1 addition & 2 deletions compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ int remote_protocol = 0;
int file_extra_cnt = 0; /* count of file-list extras that everyone gets */
int inc_recurse = 0;

extern int verbose;
extern int am_server;
extern int am_sender;
extern int local_server;
Expand Down Expand Up @@ -157,7 +156,7 @@ void setup_protocol(int f_out,int f_in)
exit_cleanup(RERR_PROTOCOL);
}

if (verbose > 3) {
if (DEBUG_GTE(PROTO, 1)) {
rprintf(FINFO, "(%s) Protocol versions: remote=%d, negotiated=%d\n",
am_server? "Server" : "Client", remote_protocol, protocol_version);
}
Expand Down
13 changes: 6 additions & 7 deletions exclude.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include "rsync.h"

extern int verbose;
extern int am_server;
extern int am_sender;
extern int eol_nulls;
Expand Down Expand Up @@ -123,7 +122,7 @@ static void add_rule(struct filter_list_struct *listp, const char *pat,
const char *cp;
unsigned int pre_len, suf_len, slash_cnt = 0;

if (verbose > 2) {
if (DEBUG_GTE(FILTER, 2)) {
rprintf(FINFO, "[%s] add_rule(%s%.*s%s)%s\n",
who_am_i(), get_rule_prefix(mflags, pat, 0, NULL),
(int)pat_len, pat,
Expand Down Expand Up @@ -455,7 +454,7 @@ void *push_local_filters(const char *dir, unsigned int dirlen)
struct filter_struct *ex = mergelist_parents[i];
struct filter_list_struct *lp = ex->u.mergelist;

if (verbose > 2) {
if (DEBUG_GTE(FILTER, 2)) {
rprintf(FINFO, "[%s] pushing filter list%s\n",
who_am_i(), lp->debug_type);
}
Expand Down Expand Up @@ -495,7 +494,7 @@ void pop_local_filters(void *mem)
struct filter_struct *ex = mergelist_parents[i];
struct filter_list_struct *lp = ex->u.mergelist;

if (verbose > 2) {
if (DEBUG_GTE(FILTER, 2)) {
rprintf(FINFO, "[%s] popping filter list%s\n",
who_am_i(), lp->debug_type);
}
Expand Down Expand Up @@ -629,7 +628,7 @@ static void report_filter_result(enum logcode code, char const *name,
* then it is stripped out by add_rule(). So as a special
* case we add it back in here. */

if (verbose >= 2) {
if (DEBUG_GTE(FILTER, 1)) {
static char *actions[2][2]
= { {"show", "hid"}, {"risk", "protect"} };
const char *w = who_am_i();
Expand Down Expand Up @@ -973,7 +972,7 @@ void parse_rule(struct filter_list_struct *listp, const char *pattern,
}

if (new_mflags & MATCHFLG_CLEAR_LIST) {
if (verbose > 2) {
if (DEBUG_GTE(FILTER, 2)) {
rprintf(FINFO,
"[%s] clearing filter list%s\n",
who_am_i(), listp->debug_type);
Expand Down Expand Up @@ -1047,7 +1046,7 @@ void parse_filter_file(struct filter_list_struct *listp, const char *fname,
} else
fp = stdin;

if (verbose > 2) {
if (DEBUG_GTE(FILTER, 2)) {
rprintf(FINFO, "[%s] parse_filter_file(%s,%x,%x)%s\n",
who_am_i(), fname, mflags, xflags,
fp ? "" : " [not found]");
Expand Down
Loading

0 comments on commit 951e826

Please sign in to comment.