From 60f8cb4e3f4e52778aff2d92f4bd42f06cb95f90 Mon Sep 17 00:00:00 2001 From: hunili Date: Wed, 21 Aug 2024 09:18:44 +0800 Subject: [PATCH] Filter the dir issue: https://gitee.com/openharmony/filemanagement_app_file_service/issues/IALD8W Signed-off-by: hunili --- frameworks/native/backup_ext/include/ext_extension.h | 2 +- frameworks/native/backup_ext/src/ext_extension.cpp | 9 ++++++--- frameworks/native/backup_ext/src/sub_ext_extension.cpp | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/frameworks/native/backup_ext/include/ext_extension.h b/frameworks/native/backup_ext/include/ext_extension.h index 40ef8944a..3946c72d0 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 a71e34f80..a07ad8b12 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 ae77b3e75..081fac548 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 }; -- Gitee