The Samba-Bugzilla – Attachment 8967 Details for
Bug 9948
Patch to provide progress display in log file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
rsync-3.0.9-log-progress.patch
rsync-3.0.9-log-progress.patch (text/plain), 5.76 KB, created by
Devin Nate
on 2013-06-13 22:17:51 UTC
(
hide
)
Description:
rsync-3.0.9-log-progress.patch
Filename:
MIME Type:
Creator:
Devin Nate
Created:
2013-06-13 22:17:51 UTC
Size:
5.76 KB
patch
obsolete
>--- options.c.orig 2013-06-09 12:09:48.295465400 -0600 >+++ options.c 2013-06-09 12:20:43.858863300 -0600 >@@ -99,6 +99,7 @@ > int am_daemon = 0; > int do_stats = 0; > int do_progress = 0; >+int log_progress = 0; > int connect_timeout = 0; > int keep_partial = 0; > int safe_symlinks = 0; >@@ -417,6 +418,7 @@ > rprintf(F," -8, --8-bit-output leave high-bit chars unescaped in output\n"); > rprintf(F," -h, --human-readable output numbers in a human-readable format\n"); > rprintf(F," --progress show progress during transfer\n"); >+ rprintf(F," --log-progress log progress on client during transfer, disables showing progress\n"); > rprintf(F," -P same as --partial --progress\n"); > rprintf(F," -i, --itemize-changes output a change-summary for all updates\n"); > rprintf(F," --out-format=FORMAT output updates using the specified FORMAT\n"); >@@ -591,6 +593,7 @@ > {0, 'P', POPT_ARG_NONE, 0, 'P', 0, 0 }, > {"progress", 0, POPT_ARG_VAL, &do_progress, 1, 0, 0 }, > {"no-progress", 0, POPT_ARG_VAL, &do_progress, 0, 0, 0 }, >+ {"log-progress", 0, POPT_ARG_VAL, &log_progress, 1, 0, 0 }, > {"partial", 0, POPT_ARG_VAL, &keep_partial, 1, 0, 0 }, > {"no-partial", 0, POPT_ARG_VAL, &keep_partial, 0, 0, 0 }, > {"partial-dir", 0, POPT_ARG_STRING, &partial_dir, 0, 0, 0 }, >@@ -1546,6 +1549,9 @@ > log_before_transfer = !am_server; > } > >+ if (log_progress && !do_progress) >+ do_progress = 1; >+ > if (do_progress && !verbose && !log_before_transfer && !am_server) > verbose = 1; > >--- progress.c.orig 2013-06-09 12:09:33.445531100 -0600 >+++ progress.c 2013-06-09 15:02:35.554127100 -0600 >@@ -24,6 +24,7 @@ > > extern int am_server; > extern int need_unsorted_flist; >+extern int log_progress; > extern struct stats stats; > extern struct file_list *cur_flist; > >@@ -41,6 +42,7 @@ > }; > > int progress_is_active = 0; >+time_t last_time_logged_progress = 0; > > static struct progress_history ph_start; > static struct progress_history ph_list[PROGRESS_HISTORY_SECS]; >@@ -69,6 +71,7 @@ > int pct = ofs == size ? 100 : (int) (100.0 * ofs / size); > unsigned long diff; > double rate, remain; >+ time_t now_epoch; > > if (is_last) { > /* Compute stats based on the starting info. */ >@@ -107,15 +110,32 @@ > } > > if (is_last) { >- snprintf(eol, sizeof eol, " (xfer#%d, to-check=%d/%d)\n", >+ snprintf(eol, sizeof eol, " (Complete, transfer %d/%d)\n", current_file_index + 1, stats.num_files); >+ /* snprintf(eol, sizeof eol, " (xfer#%d, to-check=%d/%d)\n", > stats.num_transferred_files, > stats.num_files - current_file_index - 1, >- stats.num_files); >- } else >- strlcpy(eol, "\r", sizeof eol); >+ stats.num_files); */ >+ } else { >+ if (log_progress) >+ strlcpy(eol, "\n", sizeof eol); >+ else >+ strlcpy(eol, "\r", sizeof eol); >+ } > progress_is_active = 0; >- rprintf(FCLIENT, "%12s %3d%% %7.2f%s %s%s", >- human_num(ofs), pct, rate, units, rembuf, eol); >+ >+ if (log_progress) { >+ now_epoch = time(NULL); >+ if (is_last || now_epoch - last_time_logged_progress >= 60) { >+ last_time_logged_progress = now_epoch; >+ rprintf(FLOG, "%12s %3d%% %7.2f%s %s%s", >+ human_num(ofs), pct, rate, units, rembuf, eol); >+ } >+ if (is_last) >+ last_time_logged_progress = 0; >+ } else { >+ rprintf(FCLIENT, "%12s %3d%% %7.2f%s %s%s", >+ human_num(ofs), pct, rate, units, rembuf, eol); >+ } > if (!is_last) > progress_is_active = 1; > } >--- receiver.c.orig 2013-06-09 14:11:03.519906800 -0600 >+++ receiver.c 2013-06-09 14:10:32.526807800 -0600 >@@ -454,7 +454,7 @@ > struct file_struct *file; > struct stats initial_stats; > int itemizing = am_server ? logfile_format_has_i : stdout_format_has_i; >- enum logcode log_code = log_before_transfer ? FLOG : FINFO; >+ /* enum logcode log_code = log_before_transfer ? FLOG : FINFO; */ > int max_phase = protocol_version >= 29 ? 2 : 1; > int dflt_perms = (ACCESSPERMS & ~orig_umask); > #ifdef SUPPORT_ACLS >@@ -733,16 +733,18 @@ > } > > /* log the transfer */ >- if (log_before_transfer) >+ if (log_before_transfer) { > log_item(FCLIENT, file, &initial_stats, iflags, NULL); >- else if (!am_server && verbose && do_progress) >+ log_item(FLOG, file, &initial_stats, iflags, NULL); >+ } else if (!am_server && verbose && do_progress) > rprintf(FINFO, "%s\n", fname); > > /* recv file data */ > recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size, > fname, fd2, F_LENGTH(file)); > >- log_item(log_code, file, &initial_stats, iflags, NULL); >+ if (!log_before_transfer) >+ log_item(FINFO, file, &initial_stats, iflags, NULL); > > if (fd1 != -1) > close(fd1); >--- sender.c.orig 2013-06-09 14:03:11.471140000 -0600 >+++ sender.c 2013-06-09 14:09:32.988338800 -0600 >@@ -171,7 +171,7 @@ > int phase = 0, max_phase = protocol_version >= 29 ? 2 : 1; > struct stats initial_stats; > int itemizing = am_server ? logfile_format_has_i : stdout_format_has_i; >- enum logcode log_code = log_before_transfer ? FLOG : FINFO; >+ /* enum logcode log_code = log_before_transfer ? FLOG : FINFO; */ > int f_xfer = write_batch < 0 ? batch_fd : f_out; > int save_io_error = io_error; > int ndx, j; >@@ -327,9 +327,10 @@ > if (verbose > 2) > rprintf(FINFO, "calling match_sums %s%s%s\n", path,slash,fname); > >- if (log_before_transfer) >+ if (log_before_transfer) { > log_item(FCLIENT, file, &initial_stats, iflags, NULL); >- else if (!am_server && verbose && do_progress) >+ log_item(FLOG, file, &initial_stats, iflags, NULL); >+ } else if (!am_server && verbose && do_progress) > rprintf(FCLIENT, "%s\n", fname); > > set_compression(fname); >@@ -338,7 +339,8 @@ > if (do_progress) > end_progress(st.st_size); > >- log_item(log_code, file, &initial_stats, iflags, NULL); >+ if (!log_before_transfer) >+ log_item(FINFO, file, &initial_stats, iflags, NULL); > > if (mbuf) { > j = unmap_file(mbuf);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 9948
: 8967