Hi What should be the right exit code for vanished file in this scenario. (1) Use inotify or other mechanism to check changed files and then generate a file list. (2) < file get deleted> (3) run rsync with --files-from with the old list. then send_file_list()->link_stat() will return errno 2 on some files and then set exit code to 23. but shall rsync return 24? -- Ming Zhang @#$%^ purging memory... (*!% http://blackmagic02881.wordpress.com/ http://www.linkedin.com/in/blackmagic02881 --------------------------------------------
On Fri, 2007-12-14 at 18:24 -0500, Ming Zhang wrote:> What should be the right exit code for vanished file in this scenario. > > (1) Use inotify or other mechanism to check changed files and then > generate a file list. > > (2) < file get deleted> > > (3) run rsync with --files-from with the old list. > > then send_file_list()->link_stat() will return errno 2 on some files and > then set exit code to 23. > > but shall rsync return 24?This issue has come up before: http://lists.samba.org/archive/rsync/2007-November/019177.html Code 23 is correct according to the current interpretation of --files-from, namely that the user intends to have each and every listed file copied and wants rsync to raise a red flag if one is missing. I agree that different behavior (probably enabled by an option) would be useful when passing --files-from lists from inotify. I'm not sure that even code 24 is in order because the nonexistence of a --files-from entry cannot affect the correctness of a run with --delete in the way that a traditional vanishing can. Matt
On Mon, 2007-12-24 at 01:27 -0500, Matt McCutchen wrote:> On Sun, 2007-12-23 at 15:55 -0500, Ming Zhang wrote: > > if sender read by path again and get ENOENT, then this ENOENT can tell > > rsync enough info. (though current rsync might say partial transfer > > though it is a vanished file... ) > > Treating the file as completely vanished on the basis of the ENOENT and > discarding the fd would be another "correct" behavior, but I agree that > operating on the fd is cleaner. ?I believe the current rsync does give > partial transfer, which is not ideal.so one way or the other, just stick to either one is fine. since the exit code sometime is a personal taste...> > > all file sync/backup software for a live file system can have same > > issue > > here. which state to maintain. rsync can always do a stat on the saved > > path again after the transfer, to detect the change, and then (with an > > option specified), put the path into a residual file list and > > reprocess > > them again. but maybe rsync does no need to go this far and a higher > > layer software base on rsync can do this... > > Yes, such as the inotify+rsync setup you mentioned. > > > Thanks a lot for all the explanation and wish you a happy holiday! > > Thanks! My holiday has been very happy so far!cool, enjoy. thanks for the great rsync stuff which make our life easier and can be happy too at this moment!> > Matt >-- Ming Zhang @#$%^ purging memory... (*!% http://blackmagic02881.wordpress.com/ http://www.linkedin.com/in/blackmagic02881 --------------------------------------------