Bug 9997 - File listed only whose attributes have changed for single '-v' option
Summary: File listed only whose attributes have changed for single '-v' option
Status: RESOLVED INVALID
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.0.9
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-04 09:17 UTC by Yongzhi Pan
Modified: 2013-07-12 17:54 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yongzhi Pan 2013-07-04 09:17:18 UTC
I have to make rsync outputs only files whose contents have changed, not those whose attributes have changed. I read its manpage and find one '-v' option should be exactly what I want:

At the single -v level of verbosity, this does not mention when a file gets its attributes changed. If you ask for an itemized list of changed attributes (either --itemize-changes or adding "%i" to the --out-format setting), the output (on the client) increases to mention all items that are changed in any way.

But when experimenting, rsync still prints files which only get their attributes changed.

$ touch a
$ rsync -av a b
sending incremental file list
a

sent 76 bytes  received 31 bytes  214.00 bytes/sec
total size is 0  speedup is 0.00
$ touch a
$ rsync -av a b
sending incremental file list
a

sent 76 bytes  received 31 bytes  214.00 bytes/sec
total size is 0  speedup is 0.00

In the second rsync command, rsync should not have printed the filename of a, since only its modification time has changed.

I have to suppress filename output for those whose attributes have changed only, since there are a huge amount of such information which cause my web application very slow.
Comment 1 Kevin Korb 2013-07-04 13:02:26 UTC
If you add --itemize-changes rsync will tell you what it is changing and why.  You can then filter the output however you want.
Comment 2 Yongzhi Pan 2013-07-05 02:18:49 UTC
In the example '-i' would show 't' meaning its modification time has changed.

I want to suppress these file attributes changing info. According to the doc, a single '-v' option should be enough. But it still prints the file list for 'a', only whose attributes have changed.

I may use grep, but it seems the '-v' option may not be working as intended in this scenario.
Comment 3 Kevin Korb 2013-07-05 02:25:22 UTC
If it is showing a timestamp difference then rsync had to process that file.  If you were running with --whole-file then it actually did copy the file.  If you aren't then it verified the contents and copied any parts of the file that were different.  Either way, the output happens before rsync has any idea if there are differences or not.  Also, if you are using advanced backup options like --link-dest then rsync will write out a new file just for a t difference.  Therefore it is absolutely expected that these be listed.
Comment 4 Yongzhi Pan 2013-07-05 04:10:01 UTC
Rsync will process it, but it may not show it in the file list.

The manpage says:

At the single -v level of verbosity, this does not mention when a file gets its
attributes changed.

But in a very simple test, it shows it does mention when a file gets its attributes changed. I think this is not in accordance with what the doc says.
Comment 5 Wayne Davison 2013-07-12 17:54:43 UTC
Lookup the --checksum option and the section in the manpage on rsync's "quick check" algorithm for checking if a file needs to be transferred (e.g. if name+size+mtime match).  If the mtime has changed, rsync has no way of knowing that file's data is unchanged without a pre-transfer checksum comparison (-c), or by doing the transfer and finding that all the checksum blocks actually matched (so obviously the latter is still a file transfer).  It does not treat a 0-length file specially in this regard.