From cd8851ce577f2de29d1c1ee2fea3d0051f12c48f Mon Sep 17 00:00:00 2001 From: libo429 Date: Mon, 1 Apr 2024 21:06:57 +0800 Subject: [PATCH] untar path fail & add log Signed-off-by: libo429 --- frameworks/native/backup_ext/src/tar_file.cpp | 1 + frameworks/native/backup_ext/src/untar_file.cpp | 6 +++++- utils/src/b_json/b_report_entity.cpp | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/frameworks/native/backup_ext/src/tar_file.cpp b/frameworks/native/backup_ext/src/tar_file.cpp index 3a52d9dcb..8b8216e9a 100644 --- a/frameworks/native/backup_ext/src/tar_file.cpp +++ b/frameworks/native/backup_ext/src/tar_file.cpp @@ -169,6 +169,7 @@ bool TarFile::I2OcsConvert(const struct stat &st, TarHeader &hdr, string &fileNa bool TarFile::AddFile(string &fileName, const struct stat &st, bool isSplit) { + HILOGI("tar file %{public}s", fileName.c_str()); currentFileName_ = fileName; TarHeader hdr; diff --git a/frameworks/native/backup_ext/src/untar_file.cpp b/frameworks/native/backup_ext/src/untar_file.cpp index f48a809fa..5c72a11a4 100644 --- a/frameworks/native/backup_ext/src/untar_file.cpp +++ b/frameworks/native/backup_ext/src/untar_file.cpp @@ -156,7 +156,7 @@ void UntarFile::HandleTarBuffer(const string &buff, const string &name, FileStat info.longName.clear(); } if (realName.length() > 0 && realName[0] == '/') { - info.fullPath = realName.substr(0, realName.length() - 1); + info.fullPath = realName.substr(1, realName.length() - 1); return; } info.fullPath = realName; @@ -275,6 +275,7 @@ int UntarFile::ParseIncrementalTarFile(const string &rootPath) void UntarFile::ParseFileByTypeFlag(char typeFlag, bool &isSkip, FileStatInfo &info) { + HILOGI("untar file: %{public}s, rootPath: %{public}s", info.fullPath.c_str(), rootPath_.c_str()); switch (typeFlag) { case REGTYPE: case AREGTYPE: @@ -285,6 +286,7 @@ void UntarFile::ParseFileByTypeFlag(char typeFlag, bool &isSkip, FileStatInfo &i isSkip = false; break; case DIRTYPE: + info.fullPath = GenRealPath(rootPath_, info.fullPath); CreateDir(info.fullPath, info.mode); isSkip = false; break; @@ -305,6 +307,7 @@ void UntarFile::ParseFileByTypeFlag(char typeFlag, bool &isSkip, FileStatInfo &i int UntarFile::ParseIncrementalFileByTypeFlag(char typeFlag, bool &isSkip, FileStatInfo &info) { + HILOGI("untar file: %{public}s, rootPath: %{public}s", info.fullPath.c_str(), rootPath_.c_str()); string tmpFullPath = info.fullPath; RTrimNull(tmpFullPath); switch (typeFlag) { @@ -325,6 +328,7 @@ int UntarFile::ParseIncrementalFileByTypeFlag(char typeFlag, bool &isSkip, FileS isSkip = false; break; case DIRTYPE: + info.fullPath = GenRealPath(rootPath_, info.fullPath); CreateDir(info.fullPath, info.mode); isSkip = false; break; diff --git a/utils/src/b_json/b_report_entity.cpp b/utils/src/b_json/b_report_entity.cpp index 02fbb3c68..b43625d0d 100644 --- a/utils/src/b_json/b_report_entity.cpp +++ b/utils/src/b_json/b_report_entity.cpp @@ -81,6 +81,7 @@ static ErrCode ParseReportInfo(struct ReportFileInfo &fileStat, } path = (path.length() > 0 && path[0] == '/') ? path.substr(1, path.length() - 1) : path; fileStat.filePath = path.substr(0, path.length() - 1); + HILOGI("Briefings file %{public}s", fileStat.filePath.c_str()); if (keys.find(INFO_MODE) != keys.end()) { fileStat.mode = residue[keys.find(INFO_MODE)->second]; } -- Gitee