Bug 2389 - block/character devices on Solaris yield wacky rsync stats
Summary: block/character devices on Solaris yield wacky rsync stats
Status: CLOSED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.4
Hardware: All Solaris
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-24 16:40 UTC by David Wood
Modified: 2005-04-01 11:25 UTC (History)
0 users

See Also:


Attachments
Proposed syscall.c patch (1.26 KB, patch)
2005-02-24 16:43 UTC, David Wood
no flags Details
A simpler fix (259 bytes, patch)
2005-02-24 19:35 UTC, Wayne Davison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Wood 2005-02-24 16:40:52 UTC
The problem is easy to re-produce:

bsqa1.nyc:/tmp/rsync/test # ls -al foo
crw-r-----   1 root     sys       85,16554 Oct  6  2003 foo
bsqa1.nyc:/tmp/rsync/test # /tmp/rsync/bin/rsync --archive -v /tmp/rsync/test/
master:/tmp/rsync/test/
building file list ... done
./
foo

sent 89 bytes  received 32 bytes  80.67 bytes/sec
total size is 2147483647  speedup is 17747798.74

Notice the absurdly large "total size".  According to the Solaris stat() man page:

     st_size
           For regular files, this is the address of the  end  of
           the file. For block special or character special, this
           is not defined. See also pipe(2).

I'll attach a patch I've been using for a while now; basically, I wrap stat()
and set st_size to zero for block/character devices.  David
Comment 1 David Wood 2005-02-24 16:43:11 UTC
Created attachment 979 [details]
Proposed syscall.c patch
Comment 2 Wayne Davison 2005-02-24 19:35:26 UTC
Created attachment 982 [details]
A simpler fix

I think a better/simpler fix is to tweak the code in flist.c where it adds up
the size of the transfer.  Currently it adds in the size of any non-directory. 
This should be changed to ignore devices at the very least.  However, since the
stat is the file size of the transfer, I think it might be best to ignore
symlinks too.  Here is a patch that ignores everything that is not a regular
file.

Please let me know if this fixes the problem.
Comment 3 Wayne Davison 2005-02-25 16:10:12 UTC
I've checked in a change to CVS that is similar to the one I attched to this bug
report, but still counts symlinks in the total file size (i.e. it should just
omit devices).  I think this should fix this bug.
Comment 4 David Wood 2005-02-27 16:19:07 UTC
Odd, my reply never made it through.  I'll paste my reply in "manually".  David

-----Original Message-----
From: Wood, David 
Sent: Friday, February 25, 2005 4:52 PM
To: 'samba-bugs@samba.org'
Subject: RE: [Bug 2389] block/character devices on Solaris yield wacky rsync stats


> Please let me know if this fixes the problem.

Hi Wayne,

The patch works just fine - thanks!  I had originally used the same patch;
however, I went with the stat wrapper because:

1) I thought including symlink (pipe, etc) sizes in statistics was intentional

2) I figured a purist would be upset if bogus data lingered in the stat structure

3) I'm not familiar enough with rsync internals to ensure that I would find all
possible "bad" uses of st_size.  You're certainly well versed in rsync internals
and can make such a determination ;-).

Anyway, much obliged for the fix.  David