--Apple-Mail-153-182436349
Content-Type: text/plain;
charset=US-ASCII;
format=flowed;
delsp=yes
Content-Transfer-Encoding: 7bit

For stats, rsync uses the word "file" inconsistently. When reporting
the total "Number of files", it indicates a total number of filesystem
objects which consists of regular files, directories, symlinks,
specials, and devices. When reporting number of "files" transferred,
it refers only to regular files. I use the following patch to sort
out these various file types in --stats. The one thing I'd still like
to add is number of files that are uptodate and number of inodes
relative to number of hard links. Then everything would actually add
up. For what you're looking to do, this patch should work.


Without the patch:
[bombich:~/Desktop/rsync-3.0.2] sudo ./rsync --stats -aH /Volumes/
source/ /Volumes/target/

Number of files: 80
Number of files transferred: 24
Total file size: 18384 bytes
Total transferred file size: 69 bytes
Literal data: 69 bytes
Matched data: 0 bytes
File list size: 3557
File list generation time: 0.002 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 4966
Total bytes received: 743

sent 4966 bytes received 743 bytes 11418.00 bytes/sec
total size is 18384 speedup is 3.22


With the patch:
[bombich:~/Desktop/rsync-3.0.2] sudo ./rsync --stats -aH /Volumes/
source/ /Volumes/target/

Number of files: 80
Number of directories: 30
Number of regular files: 38
Number of symlinks: 9
Number of devices: 2
Number of special files: 1
Number of re-linked hard links: 4
Number of files transferred: 24
Total file size: 18384 bytes
Total transferred file size: 69 bytes
Literal data: 69 bytes
Matched data: 0 bytes
File list size: 3557
File list generation time: 0.002 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 4963
Total bytes received: 740

sent 4963 bytes received 740 bytes 11406.00 bytes/sec
total size is 18384 speedup is 3.22


- Mike

--Apple-Mail-153-182436349
Content-Disposition: attachment;
filename=extended_stats.diff
Content-Type: application/octet-stream; x-unix-mode=0644; x-mac-type=54455854;
name="extended_stats.diff"
Content-Transfer-Encoding: 7bit

diff -Naur -X /Volumes/Home/Users/bombich/Development/Bombich_Software/rsync3/_build/diff_ignore rsync-3.0.2_base/flist.c rsync-3.0.2/flist.c
--- rsync-3.0.2_base/flist.c 2008-04-15 09:07:55.000000000 -0500
+++ rsync-3.0.2/flist.c 2008-04-15 09:14:29.000000000 -0500
@@ -540,8 +540,10 @@

if (first_hlink_ndx >= 0) {
write_varint(f, first_hlink_ndx);
- if (first_hlink_ndx >= first_ndx)
- goto the_end;
+ if (first_hlink_ndx >= first_ndx) {
+ stats.hard_links_not_copied++;
+ goto the_end;
+ }
}

write_varlong30(f, F_LENGTH(file), 3);
@@ -1352,6 +1354,18 @@
if (!file)
return NULL;

+ if (S_ISDIR(file->mode))
+ stats.num_dirs++;
+ else if (S_ISREG(file->mode))
+ stats.num_reg_files++;
+ else if (S_ISLNK(file->mode))
+ stats.num_symlinks++;
+ else if (IS_DEVICE(file->mode))
+ stats.num_devices++;
+ else if (IS_SPECIAL(file->mode))
+ stats.num_special++;
+
+
if (chmod_modes && !S_ISLNK(file->mode))
file->mode = tweak_mode(file->mode, chmod_modes);

@@ -1926,6 +1940,13 @@
else if (inc_recurse && verbose && !am_server)
rprintf(FCLIENT, "sending incremental file list\n");

+ stats.num_dirs = 0;
+ stats.num_reg_files = 0;
+ stats.num_symlinks = 0;
+ stats.num_devices = 0;
+ stats.num_special = 0;
+ stats.hard_links_not_copied = 0;
+
start_write = stats.total_written;
gettimeofday(&start_tv, NULL);

diff -Naur -X /Volumes/Home/Users/bombich/Development/Bombich_Software/rsync3/_build/diff_ignore rsync-3.0.2_base/main.c rsync-3.0.2/main.c
--- rsync-3.0.2_base/main.c 2008-03-30 17:44:46.000000000 -0500
+++ rsync-3.0.2/main.c 2008-04-15 09:14:29.000000000 -0500
@@ -242,6 +242,12 @@
if (do_stats) {
rprintf(FCLIENT, "\n");
rprintf(FINFO,"Number of files: %d\n", stats.num_files);
+ rprintf(FINFO,"Number of directories: %d\n", stats.num_dirs);
+ rprintf(FINFO,"Number of regular files: %d\n", stats.num_reg_files);
+ rprintf(FINFO,"Number of symlinks: %d\n", stats.num_symlinks);
+ rprintf(FINFO,"Number of devices: %d\n", stats.num_devices);
+ rprintf(FINFO,"Number of special files: %d\n", stats.num_special);
+ rprintf(FINFO,"Number of re-linked hard links: %d\n", stats.hard_links_not_copied);
rprintf(FINFO,"Number of files transferred: %d\n",
stats.num_transferred_files);
rprintf(FINFO,"Total file size: %s bytes\n",
diff -Naur -X /Volumes/Home/Users/bombich/Development/Bombich_Software/rsync3/_build/diff_ignore rsync-3.0.2_base/rsync.h rsync-3.0.2/rsync.h
--- rsync-3.0.2_base/rsync.h 2008-04-15 09:07:56.000000000 -0500
+++ rsync-3.0.2/rsync.h 2008-04-15 09:14:29.000000000 -0500
@@ -857,6 +857,12 @@
int64 flist_size;
int num_files;
int num_transferred_files;
+ int num_dirs;
+ int num_reg_files;
+ int num_symlinks;
+ int num_devices;
+ int num_special;
+ int hard_links_not_copied;
};

struct chmod_mode_struct;

--Apple-Mail-153-182436349
Content-Type: text/plain;
charset=US-ASCII;
format=flowed;
delsp=yes
Content-Transfer-Encoding: 7bit




On Apr 15, 2008, at 12:02 AM, Ph. Marek wrote:

> Hello everybody,
>
> I'm using rsync (debian 3.0.2-1) to test my pet projects for
> correctness; but
> now I've come across a bug (?) in rsync - it doesn't count
> transferred links,
> ie. "Number of files transferred:" is wrong.
>
> See:
>
> # mkdir a b
> # ln -s /bin/ls a/link ; touch b/link
> # ls -la a/* b/*
> lrwxrwxrwx 1 flip flip 7 15. Apr 06:53 a/link -> /bin/ls
> -rw-r--r-- 1 flip flip 0 15. Apr 06:53 b/link
>
> Now a test run shows that it'd send it, but doesn't count:
> # rsync -a -v --stats a/ b/ -n
> sending incremental file list
> link -> /bin/ls
>
> Number of files: 2
> Number of files transferred: 0
> Total file size: 7 bytes
> Total transferred file size: 0 bytes
> Literal data: 0 bytes
> Matched data: 0 bytes
> File list size: 51
> File list generation time: 0.005 seconds
> File list transfer time: 0.000 seconds
> Total bytes sent: 63
> Total bytes received: 15
>
> sent 63 bytes received 15 bytes 156.00 bytes/sec
> total size is 7 speedup is 0.09 (DRY RUN)
>
> Neither does a real run:
> # rsync -a -v --stats a/ b/
> sending incremental file list
> link -> /bin/ls
>
> Number of files: 2
> Number of files transferred: 0
> Total file size: 7 bytes
> Total transferred file size: 0 bytes
> Literal data: 0 bytes
> Matched data: 0 bytes
> File list size: 51
> File list generation time: 0.001 seconds
> File list transfer time: 0.000 seconds
> Total bytes sent: 63
> Total bytes received: 15
>
> sent 63 bytes received 15 bytes 156.00 bytes/sec
> total size is 7 speedup is 0.09
>
> But the symlink was sent:
> # ls -la a/* b/*
> lrwxrwxrwx 1 flip flip 7 15. Apr 06:53 a/link -> /bin/ls
> lrwxrwxrwx 1 flip flip 7 15. Apr 06:53 b/link -> /bin/ls
>
>
> Now I'd like to ask whether that's a policy change (ie. will stay
> so), or if
> it's just a bug - in the first case I have to rewrite my test
> scripts, to
> test for changes in some other way.
>
>
> Thank you.
>
>
> Regards,
>
> Phil
> --
> To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
> Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
>



--Apple-Mail-153-182436349
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
--Apple-Mail-153-182436349--