Blame SOURCES/rear-bz1930662.patch

9fdd73
diff --git a/usr/share/rear/backup/RSYNC/default/200_check_rsync_relative_option.sh b/usr/share/rear/backup/RSYNC/default/200_check_rsync_relative_option.sh
9fdd73
index 27e348ad..60330007 100644
9fdd73
--- a/usr/share/rear/backup/RSYNC/default/200_check_rsync_relative_option.sh
9fdd73
+++ b/usr/share/rear/backup/RSYNC/default/200_check_rsync_relative_option.sh
9fdd73
@@ -5,6 +5,6 @@
9fdd73
 # for the default values see the standard definition in conf/default.conf file
9fdd73
 
9fdd73
 if ! grep -q relative <<< $(echo ${BACKUP_RSYNC_OPTIONS[@]}); then
9fdd73
-    BACKUP_RSYNC_OPTIONS=( ${BACKUP_RSYNC_OPTIONS[@]} --relative )
9fdd73
+    BACKUP_RSYNC_OPTIONS+=( --relative )
9fdd73
     Log "Added option '--relative' to the BACKUP_RSYNC_OPTIONS array during $WORKFLOW workflow"
9fdd73
 fi
9fdd73
diff --git a/usr/share/rear/backup/RSYNC/default/500_make_rsync_backup.sh b/usr/share/rear/backup/RSYNC/default/500_make_rsync_backup.sh
9fdd73
index 002bfa96..ed6097d3 100644
9fdd73
--- a/usr/share/rear/backup/RSYNC/default/500_make_rsync_backup.sh
9fdd73
+++ b/usr/share/rear/backup/RSYNC/default/500_make_rsync_backup.sh
9fdd73
@@ -37,7 +37,7 @@ ProgressStart "Running archive operation"
9fdd73
 			;;
9fdd73
 
9fdd73
 		(*)
9fdd73
-			# no other backup programs foreseen then rsync so far
9fdd73
+			# no other backup programs foreseen than rsync so far
9fdd73
 			:
9fdd73
 			;;
9fdd73
 
9fdd73
@@ -117,13 +117,12 @@ _rc="$(cat $TMP_DIR/retval)"
9fdd73
 
9fdd73
 sleep 1
9fdd73
 # everyone should see this warning, even if not verbose
9fdd73
-test "$_rc" -gt 0 && VERBOSE=1 LogPrint "WARNING !
9fdd73
+test "$_rc" -gt 0 && Error "
9fdd73
 There was an error (${rsync_err_msg[$_rc]}) during archive creation.
9fdd73
 Please check the archive and see '$RUNTIME_LOGFILE' for more information.
9fdd73
 
9fdd73
-Since errors are often related to files that cannot be saved by
9fdd73
-$BACKUP_PROG, we will continue the $WORKFLOW process. However, you MUST
9fdd73
-verify the backup yourself before trusting it !
9fdd73
+If the error is related to files that cannot and should not be saved by
9fdd73
+$BACKUP_PROG, they should be excluded from the backup.
9fdd73
 
9fdd73
 "
9fdd73
 
9fdd73
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
9fdd73
index 6e98b427..0c9bf37d 100644
9fdd73
--- a/usr/share/rear/conf/default.conf
9fdd73
+++ b/usr/share/rear/conf/default.conf
9fdd73
@@ -922,7 +922,8 @@ BACKUP_ONLY_EXCLUDE="no"
9fdd73
 MANUAL_INCLUDE=NO
9fdd73
 # Disable SELinux policy during backup with NETFS or RSYNC (default yes)
9fdd73
 BACKUP_SELINUX_DISABLE=1
9fdd73
-# Enable integrity check of the backup archive (only with BACKUP=NETFS and BACKUP_PROG=tar)
9fdd73
+# Enable integrity check of the backup archive (full check only with BACKUP=NETFS and BACKUP_PROG=tar,
9fdd73
+# with BACKUP=rsync or BACKUP_PROG=rsync it only checks whether rsync completed the restore successfully)
9fdd73
 BACKUP_INTEGRITY_CHECK=
9fdd73
 # Define BACKUP_TYPE.
9fdd73
 # By default BACKUP_TYPE is empty which means "rear mkbackup" will create a full backup.
9fdd73
diff --git a/usr/share/rear/output/RSYNC/default/900_copy_result_files.sh b/usr/share/rear/output/RSYNC/default/900_copy_result_files.sh
9fdd73
index a3731fd9..f2a5782c 100644
9fdd73
--- a/usr/share/rear/output/RSYNC/default/900_copy_result_files.sh
9fdd73
+++ b/usr/share/rear/output/RSYNC/default/900_copy_result_files.sh
9fdd73
@@ -37,4 +37,4 @@ esac
9fdd73
 
9fdd73
 # cleanup the temporary space (need it for the log file during backup)
9fdd73
 rm -rf "${TMP_DIR}/rsync/${RSYNC_PREFIX}/"
9fdd73
-LogIfError "Could not cleanup temoprary rsync space: ${TMP_DIR}/rsync/${RSYNC_PREFIX}/"
9fdd73
+LogIfError "Could not cleanup temporary rsync space: ${TMP_DIR}/rsync/${RSYNC_PREFIX}/"
9fdd73
diff --git a/usr/share/rear/prep/RSYNC/default/150_check_rsync_protocol_version.sh b/usr/share/rear/prep/RSYNC/default/150_check_rsync_protocol_version.sh
9fdd73
index 1a2ffb8f..1e23eea2 100644
9fdd73
--- a/usr/share/rear/prep/RSYNC/default/150_check_rsync_protocol_version.sh
9fdd73
+++ b/usr/share/rear/prep/RSYNC/default/150_check_rsync_protocol_version.sh
9fdd73
@@ -30,7 +30,7 @@ else
9fdd73
 
9fdd73
 fi
9fdd73
 
9fdd73
-if [ "${RSYNC_USER}" != "root" ]; then
9fdd73
+if [ "${RSYNC_USER}" != "root" -a $RSYNC_PROTO = "ssh" ]; then
9fdd73
     if [ $RSYNC_PROTOCOL_VERSION -gt 29 ]; then
9fdd73
         if grep -q "no xattrs" "$TMP_DIR/rsync_protocol"; then
9fdd73
             # no xattrs available in remote rsync, so --fake-super is not possible
9fdd73
diff --git a/usr/share/rear/restore/RSYNC/default/400_restore_rsync_backup.sh b/usr/share/rear/restore/RSYNC/default/400_restore_rsync_backup.sh
9fdd73
index 2a0bf15e..3c2ea9b1 100644
9fdd73
--- a/usr/share/rear/restore/RSYNC/default/400_restore_rsync_backup.sh
9fdd73
+++ b/usr/share/rear/restore/RSYNC/default/400_restore_rsync_backup.sh
9fdd73
@@ -33,9 +33,10 @@ ProgressStart "Restore operation"
9fdd73
 			;;
9fdd73
 
9fdd73
 		(*)
9fdd73
-			# no other backup programs foreseen then rsync so far
9fdd73
+			# no other backup programs foreseen than rsync so far
9fdd73
 			:
9fdd73
 			;;
9fdd73
+
9fdd73
 	esac
9fdd73
 	echo $? >$TMP_DIR/retval
9fdd73
 ) >"${TMP_DIR}/${BACKUP_PROG_ARCHIVE}-restore.log" &
9fdd73
@@ -65,6 +66,7 @@ case "$(basename $BACKUP_PROG)" in
9fdd73
 			ProgressStep
9fdd73
 		done
9fdd73
 		;;
9fdd73
+
9fdd73
 esac
9fdd73
 ProgressStop
9fdd73
 
9fdd73
@@ -72,15 +74,21 @@ transfertime="$((SECONDS-starttime))"
9fdd73
 
9fdd73
 # harvest return code from background job. The kill -0 $BackupPID loop above should
9fdd73
 # have made sure that this wait won't do any real "waiting" :-)
9fdd73
-wait $BackupPID
9fdd73
-_rc=$?
9fdd73
+wait $BackupPID || LogPrintError "Restore job returned a nonzero exit code $?"
9fdd73
+# harvest the actual return code of rsync. Finishing the pipeline with an error code above is actually unlikely,
9fdd73
+# because rsync is not the last command in it. But error returns from rsync are common and must be handled.
9fdd73
+_rc="$(cat $TMP_DIR/retval)"
9fdd73
 
9fdd73
 sleep 1
9fdd73
-test "$_rc" -gt 0 && LogPrint "WARNING !
9fdd73
+if test "$_rc" -gt 0 ; then
9fdd73
+    # TODO: Shouldn't we tell the user to check ${TMP_DIR}/${BACKUP_PROG_ARCHIVE}-restore.log as well?
9fdd73
+    LogPrintError "WARNING !
9fdd73
 There was an error (${rsync_err_msg[$_rc]}) while restoring the archive.
9fdd73
 Please check '$RUNTIME_LOGFILE' for more information. You should also
9fdd73
 manually check the restored system to see whether it is complete.
9fdd73
 "
9fdd73
+    is_true "$BACKUP_INTEGRITY_CHECK" && Error "Integrity check failed, restore aborted because BACKUP_INTEGRITY_CHECK is enabled"
9fdd73
+fi
9fdd73
 
9fdd73
 _message="$(tail -14 ${TMP_DIR}/${BACKUP_PROG_ARCHIVE}-restore.log)"
9fdd73
 
9fdd73
@@ -89,3 +97,5 @@ if [ $_rc -eq 0 -a "$_message" ] ; then
9fdd73
 elif [ "$size" ]; then
9fdd73
         LogPrint "Restored $((size/1024/1024)) MiB in $((transfertime)) seconds [avg $((size/1024/transfertime)) KiB/sec]"
9fdd73
 fi
9fdd73
+
9fdd73
+return $backup_prog_rc
9fdd73
diff --git a/usr/share/rear/verify/RSYNC/GNU/Linux/600_check_rsync_xattr.sh b/usr/share/rear/verify/RSYNC/GNU/Linux/600_check_rsync_xattr.sh
9fdd73
index 3622884a..336163fb 100644
9fdd73
--- a/usr/share/rear/verify/RSYNC/GNU/Linux/600_check_rsync_xattr.sh
9fdd73
+++ b/usr/share/rear/verify/RSYNC/GNU/Linux/600_check_rsync_xattr.sh
9fdd73
@@ -4,7 +4,7 @@
9fdd73
 
9fdd73
 	# if --xattrs is already set; no need to do it again
9fdd73
 	if ! grep -q xattrs <<< $(echo ${BACKUP_RSYNC_OPTIONS[@]}); then
9fdd73
-		RSYNC_OPTIONS=( "${BACKUP_RSYNC_OPTIONS[@]}" --xattrs )
9fdd73
+		BACKUP_RSYNC_OPTIONS+=( --xattrs )
9fdd73
 	fi
9fdd73
 
9fdd73
 }