[ see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=415648 ]

When a source file grows during transfer, rsync may show negative time
values such as 0:-1:-34. The following patch replaces then negative
times with ??:??:?? in such cases (as IMHO it's not worth the bother of
getting the filesize again etc. in such cases, but showing garbage info
is wrong as well).

Paul Slootman

Index: progress.c
===================================================================
RCS file: /cvsroot/rsync/progress.c,v
retrieving revision 1.23
diff -u -r1.23 progress.c
--- progress.c  10 Jul 2007 13:55:49 -0000      1.23
+++ progress.c  1 Aug 2007 12:43:33 -0000
@@ -104,9 +104,16 @@
                        stats.num_files);
        } else
                strlcpy(eol, "\r", sizeof eol);
-       rprintf(FCLIENT, "%12s %3d%% %7.2f%s %4d:%02d:%02d%s",
-               human_num(ofs), pct, rate, units,
-               remain_h, remain_m, remain_s, eol);
+       if (remain < 0)
+               /* file size increased on sending side during xfer */
+               /* so prevent negative times like 0:-1:-49         */
+               rprintf(FCLIENT, "%12s %3d%% %7.2f%s   ??:??:??%s",
+                       human_num(ofs), pct, rate, units,
+                       eol);
+       else
+               rprintf(FCLIENT, "%12s %3d%% %7.2f%s %4d:%02d:%02d%s",
+                       human_num(ofs), pct, rate, units,
+                       remain_h, remain_m, remain_s, eol);
 }
 
 void end_progress(OFF_T size)
-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to