diff --git a/CHANGES b/CHANGES index 6fbb5f746..a27fd5346 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,7 @@ Version 1.3.4-dev (development of upcoming release) 6: New snapshot taken but with errors. * Feature: The `rsync` exit code is now contained in the snapshot log (part of #489). Example: [E] Error: 'rsync' ended with exit code -9 (negative values are signal numbers, see 'kill -l') +* Fix bug: Treat rsync exit code 24 as INFO instead of ERROR (#1506) * Breaking change: Minimal Python version 3.8 required (#1358). * Removed: Handling and checking of user group "fuse" (#1472). * Feature: Exclude /swapfile by default (#1053) diff --git a/common/snapshots.py b/common/snapshots.py index d566c42c0..c108b8f6e 100644 --- a/common/snapshots.py +++ b/common/snapshots.py @@ -127,7 +127,7 @@ def takeSnapshotMessage(self): return(mid, message) - #TODO: make own class for takeSnapshotMessage + # TODO: make own class for takeSnapshotMessage def setTakeSnapshotMessage(self, type_id, message, timeout = -1): """Update the status message of the active snapshot creation job @@ -137,8 +137,9 @@ def setTakeSnapshotMessage(self, type_id, message, timeout = -1): Args: type_id: Simplified severity level of the status message: + 0: INFO 1: ERROR - other values: INFO + other values: defaults to INFO (may change in the future) message: status message string timeout: Requested maximum processing duration in plug-ins. Default: -1 (no limit) @@ -1241,11 +1242,27 @@ def takeSnapshot(self, sid, now, include_folders): has_errors = False # TODO Fix inconsistent usage: Collects return value, # but errors are also checked via params[0] - if rsync_exit_code != 0: # indicates an error + # dict of exit codes (as keys) that are treated as INFO only by BiT + # (not as ERROR). The values are message strings for the snapshot log. + rsync_non_error_exit_codes = { + 0: _("Success"), + 24: _("Partial transfer due to vanished source files (see 'man rsync')") + } + + rsync_exit_code_msg = _("'rsync' ended with exit code {exit_code}").format(exit_code=rsync_exit_code) + + if rsync_exit_code in rsync_non_error_exit_codes: + self.setTakeSnapshotMessage(0, + rsync_exit_code_msg + ": {msg}".format( + msg=rsync_non_error_exit_codes[rsync_exit_code])) + elif rsync_exit_code > 0: # indicates a rsync error + params[0] = True # HACK to fix #489 (params[0] and has_errors should be merged) + self.setTakeSnapshotMessage(1, + rsync_exit_code_msg + ": " + _("See 'man rsync' for more details")) + elif rsync_exit_code < 0: # indicates a rsync error caused by a signal params[0] = True # HACK to fix #489 (params[0] and has_errors should be merged) self.setTakeSnapshotMessage(1, - _("Error: 'rsync' ended with exit code {exit_code} (negative values are signal numbers, see 'kill -l')".format( - exit_code=rsync_exit_code))) + rsync_exit_code_msg + ": " + _("Negative rsync exit codes are signal numbers, see 'kill -l' and 'man kill'")) # params[0] -> error? if params[0]: