diff --git a/frameworks/native/backup_ext/include/ext_extension.h b/frameworks/native/backup_ext/include/ext_extension.h index 40ef8944af4513f391e16562f52b9e28c04ec29e..3946c72d0d39b653ef3280bb66c966c460c0e5d4 100644 --- a/frameworks/native/backup_ext/include/ext_extension.h +++ b/frameworks/native/backup_ext/include/ext_extension.h @@ -267,7 +267,7 @@ private: std::string bundleName_; int32_t sendRate_ = BConstants::DEFAULT_FD_SEND_RATE; bool isClearData_ {true}; - bool isDebug_ {false}; + bool isDebug_ {true}; std::map endFileInfos_; std::map> errFileInfos_; bool isRpValid_ {false}; diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index a71e34f80ef0a564ad58a69236911d9db3a8b867..a07ad8b1279c1cecc664a5ab852d98f2e599f2ec 100644 --- a/frameworks/native/backup_ext/src/ext_extension.cpp +++ b/frameworks/native/backup_ext/src/ext_extension.cpp @@ -730,10 +730,9 @@ void BackupExtExtension::DealIncreUnPacketResult(const off_t tarFileSize, const if (err != ERR_OK) { endFileInfos_[tarFileName] = tarFileSize; errFileInfos_[tarFileName] = {err}; - } else { - EndFileInfo tmpEndInfo = std::get(result); - endFileInfos_.merge(tmpEndInfo); } + EndFileInfo tmpEndInfo = std::get(result); + endFileInfos_.merge(tmpEndInfo); } ErrFileInfo tmpErrInfo = std::get(result); errFileInfos_.merge(tmpErrInfo); @@ -865,6 +864,10 @@ ErrCode BackupExtExtension::RestoreTarForSpecialCloneCloud(const ExtManageInfo & } auto [err, fileInfos, errInfos] = UntarFile::GetInstance().UnPacket(tarName, untarPath); if (isDebug_) { + if (err != 0) { + endFileInfos_[tarName] = item.sta.st_size; + errFileInfos_[tarName] = { err }; + } endFileInfos_.merge(fileInfos); errFileInfos_.merge(errInfos); } diff --git a/frameworks/native/backup_ext/src/sub_ext_extension.cpp b/frameworks/native/backup_ext/src/sub_ext_extension.cpp index ae77b3e75a4f85071c412f921d32d4eadc5f4c1e..081fac54861dca8b4405a37ca82c6020506a613d 100644 --- a/frameworks/native/backup_ext/src/sub_ext_extension.cpp +++ b/frameworks/native/backup_ext/src/sub_ext_extension.cpp @@ -130,13 +130,13 @@ void BackupExtExtension::CheckTmpDirFileInfos(bool isSpecialVersion) HILOGE("(Debug) Failed to get stat of %{public}s, errno = %{public}d", GetAnonyPath(it.first).c_str(), errno); errFiles[it.first].push_back(errno); - } else if (it.second != attr.st_size) { + } else if (it.second != attr.st_size && (!S_ISDIR(attr.st_mode))) { HILOGE("(Debug) RecFile:%{public}s size err, recSize: %{public}" PRId64 ", idxSize: %{public}" PRId64 "", GetAnonyPath(it.first).c_str(), attr.st_size, it.second); errFiles[it.first] = std::vector(); } } - HILOGE("(Debug) Temp file check result: Total file: %{public}zu, err file: %{public}zu", idxFileInfos.size(), + HILOGI("(Debug) Temp file check result: Total file: %{public}zu, err file: %{public}zu", idxFileInfos.size(), errFiles.size()); if (!errFiles.empty()) { HILOGE("(Debug) The received file and idx is not same"); @@ -154,7 +154,7 @@ tuple> BackupExtExtension::CheckRestoreFileInfos() HILOGE("(Debug) Failed to lstat, err = %{public}d", errno); errFiles.emplace_back(it.first); errFileInfos_[it.first].push_back(errno); - } else if (curFileStat.st_size != it.second) { + } else if (curFileStat.st_size != it.second && (!S_ISDIR(curFileStat.st_mode))) { HILOGE("(Debug) File size check error, file: %{public}s", GetAnonyPath(it.first).c_str()); errFiles.emplace_back(it.first); errFileInfos_[it.first].push_back(errno); @@ -165,7 +165,7 @@ tuple> BackupExtExtension::CheckRestoreFileInfos() HILOGE("(Debug) errfileInfos file = %{public}s -> %{public}d", GetAnonyPath(it.first).c_str(), codeIt); } } - HILOGE("(Debug) End file check result Total file: %{public}zu, err file: %{public}zu", endFileInfos_.size(), + HILOGI("(Debug) End file check result Total file: %{public}zu, err file: %{public}zu", endFileInfos_.size(), errFileInfos_.size()); if (errFiles.size()) { return { false, errFiles };