From f3d946e4400f9cc489f85f848fab9b3669d1afd8 Mon Sep 17 00:00:00 2001 From: gitee Date: Thu, 21 Dec 2023 11:42:38 +0800 Subject: [PATCH] fix --- .../src/python/ptdbg_ascend/common/file_check_util.py | 6 ++++-- .../src/python/ptdbg_ascend/compare/acc_compare.py | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/file_check_util.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/file_check_util.py index 4986fe718..c876a019e 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/file_check_util.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/file_check_util.py @@ -85,11 +85,12 @@ class FileChecker: ability(str): FileCheckConst.WRITE_ABLE or FileCheckConst.READ_ABLE to set file has writability or readability file_type(str): The correct file type for file """ - def __init__(self, file_path, path_type, ability=None, file_type=None): + def __init__(self, file_path, path_type, ability=None, file_type=None, is_script=True): self.file_path = file_path self.path_type = self._check_path_type(path_type) self.ability = ability self.file_type = file_type + self.is_script = is_script @staticmethod def _check_path_type(path_type): @@ -109,7 +110,8 @@ class FileChecker: check_path_length(self.file_path) check_path_type(self.file_path, self.path_type) self.check_path_ability() - check_path_owner_consistent(self.file_path) + if self.is_script: + check_path_owner_consistent(self.file_path) check_path_pattern_vaild(self.file_path) check_common_file_size(self.file_path) check_file_suffix(self.file_path, self.file_type) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/compare/acc_compare.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/compare/acc_compare.py index 76626e329..d083676ee 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/compare/acc_compare.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/compare/acc_compare.py @@ -499,9 +499,9 @@ def compare_by_op(op_name, op_name_mapping_dict, input_parma): n_path = os.path.join(input_parma.get("npu_dump_data_dir"), npu_bench_name_list[0] + ".npy") b_path = os.path.join(input_parma.get("bench_dump_data_dir"), npu_bench_name_list[1] + ".npy") n_path_checker = FileChecker(n_path, FileCheckConst.FILE, FileCheckConst.READ_ABLE, - FileCheckConst.NUMPY_SUFFIX) + FileCheckConst.NUMPY_SUFFIX, False) b_path_checker = FileChecker(b_path, FileCheckConst.FILE, FileCheckConst.READ_ABLE, - FileCheckConst.NUMPY_SUFFIX) + FileCheckConst.NUMPY_SUFFIX, False) n_path = n_path_checker.common_check() b_path = b_path_checker.common_check() n_value = np.load(n_path) @@ -582,6 +582,7 @@ def compare(input_parma, output_path, stack_mode=False, auto_analyze=True, def compare_core(input_parma, output_path, stack_mode=False, auto_analyze=True, suffix='', fuzzy_match=False, summary_compare=False): + print_warn_log("Please check whether the input data belongs to you. If not, there may be security risks.") file_name = add_time_as_suffix("compare_result" + suffix) file_path = os.path.join(os.path.realpath(output_path), file_name) check_file_not_exists(file_path) -- Gitee