#395 Issue closed: Regression due to commit : code cleanups for incremental patches

Labels: enhancement, cleanup

Florent38 opened issue at 2014-04-22 11:43:

Hi,
Ref commit : https://github.com/rear/rear/commit/ede40979e3b97a07092281e3fbd483fc7643f662

The integrity check didn't work (BACKUP_INTEGRITY_CHECK option).
This commit removes the set of restorearchive var and this variable is used by /usr/share/rear/verify/NETFS/default/55_check_backup_archive.sh

But the code is strange because before using $restorearchive rear uses $backuparchive which is equals to $restorearchive before this commit.

Take a look at /usr/share/rear/verify/NETFS/default/55_check_backup_archive.sh :

if [[ $BACKUP_INTEGRITY_CHECK =~ ^[yY1] && -f ${backuparchive}.md5 ]] ; then
    if [[ ! -f "$(dirname $backuparchive)/backup.splitted" ]]; then
        LogPrint "Checking integrity of $(basename $backuparchive) ..."
        (cd $(dirname $restorearchive) && md5sum -c ${restorearchive}.md5)
        StopIfError "Integrity check failed !! \nIf you want to bypass this check please edit the configuration file (/etc/rear/local.conf) and unset BACKUP_INTEGRITY_CHECK."
    fi
fi

I think we need to add again the line remove by the commit, I mean to set $restorearchive.

restorearchive is used by :

grep -rHn "restorearchive" *
prep/NETFS/default/07_set_backup_archive.sh:14:            for i in $(ls ${BUILD_DIR}/outputfs/${NETFS_PREFIX}/*.tar.gz); do restorearchive=$i;done
prep/NETFS/default/07_set_backup_archive.sh:53:               restorearchive="${BUILD_DIR}/outputfs/${NETFS_PREFIX}/${BACKUP_PROG_ARCHIVE}${BACKUP_PROG_SUFFIX}${BACKUP_PROG_COMPRESS_SUFFIX}"
restore/NETFS/default/40_restore_backup.sh:26:Log "Restoring $BACKUP_PROG archive '$restorearchive'"
restore/NETFS/default/40_restore_backup.sh:27:Print "Restoring from '$restorearchive'"
restore/NETFS/default/40_restore_backup.sh:43:                  LAST="$restorearchive"
restore/NETFS/default/40_restore_backup.sh:44:                  BASE=$(dirname "$restorearchive")/$(tar --test-label -f "$restorearchive")
verify/NETFS/default/07_set_backup_archive.sh:14:            for i in $(ls ${BUILD_DIR}/outputfs/${NETFS_PREFIX}/*.tar.gz); do restorearchive=$i;done
verify/NETFS/default/55_check_backup_archive.sh:11:     backuparchive=$restorearchive
verify/NETFS/default/55_check_backup_archive.sh:22:    du -sh "$restorearchive" | cut -d ' ' -f1 >$TMP_DIR/backuparchive_size
verify/NETFS/default/55_check_backup_archive.sh:32:        (cd $(dirname $restorearchive) && md5sum -c ${restorearchive}.md5)

I did a test with the set of restorearchive in usr/share/rear/verify/NETFS/default/07_set_backup_archive.sh and it's work ! It also fixes "the restoring from empty" :

Restoring from ''
by
Restoring from '/tmp/rear.gYRheoJWSEKHveb/outputfs/node/backup.tar.gz'

if you are agree, I can create a pull request ;)

gdha commented at 2014-04-23 06:45:

Yep - looks a correct statement and needs to be corrected. thanks for the investigation and yes please prepare a pull request.


[Export of Github issue for rear/rear.]