Commit 834bfd08 by 文周繁

fix: 修复部分程序无法用utf-8解码和asan程序未上传时报错的问题

parent ee44c51b
...@@ -50,7 +50,7 @@ def exec_command(crashes_collection, usage, command, seed_id: ObjectId): ...@@ -50,7 +50,7 @@ def exec_command(crashes_collection, usage, command, seed_id: ObjectId):
error_cause = '' error_cause = ''
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
_, errs = process.communicate() _, errs = process.communicate()
errs = str(errs, "utf-8") errs = str(errs, "utf-8", errors='ignore')
if usage == "valgrind": if usage == "valgrind":
err_data = '' err_data = ''
search_at_count = 0 search_at_count = 0
...@@ -152,16 +152,17 @@ def main(argv): ...@@ -152,16 +152,17 @@ def main(argv):
fs = GridFS(default_db, fs_name) fs = GridFS(default_db, fs_name)
# 根据ObjectId查找文件 # 根据ObjectId查找文件
print(software["asan_file"]) print(software["asan_file"])
asan_file_data = fs.get(software["asan_file"]) if software["asan_file"] is not None:
if asan_file_data: asan_file_data = fs.get(software["asan_file"])
# 确保下载目录存在 if asan_file_data:
os.makedirs(os.path.dirname(asan_file_path), exist_ok=True) # 确保下载目录存在
# 读取文件内容并保存到本地 os.makedirs(os.path.dirname(asan_file_path), exist_ok=True)
with open(asan_file_path, "wb") as f: # 读取文件内容并保存到本地
f.write(asan_file_data.read()) with open(asan_file_path, "wb") as f:
os.system(f"chmod +x {asan_file_path}") f.write(asan_file_data.read())
print("asan_file download successfully") os.system(f"chmod +x {asan_file_path}")
generation_command(crashes_collection, asan_file_path, parameter, crashes_file_paths, "") print("asan_file download successfully")
generation_command(crashes_collection, asan_file_path, parameter, crashes_file_paths, "")
finally: finally:
task_collection.update_one({"_id": ObjectId(task_id)}, {"$set": {"verification": "VERIFIED"}}) task_collection.update_one({"_id": ObjectId(task_id)}, {"$set": {"verification": "VERIFIED"}})
host_node = host_node_collection.find_one({"_id": ObjectId(host_node_id)}) host_node = host_node_collection.find_one({"_id": ObjectId(host_node_id)})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment