From f5106e3a71de94278d5ea337014038a3c607285e Mon Sep 17 00:00:00 2001 From: xuezhixin Date: Mon, 13 Nov 2023 10:39:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=96=87=E4=BB=B6=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E4=B8=BA=E4=BA=8C=E8=BF=9B=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sysmig_agent/Abisystmcompchk.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py index 3ebee71..14cad1d 100644 --- a/sysmig_agent/Abisystmcompchk.py +++ b/sysmig_agent/Abisystmcompchk.py @@ -320,3 +320,35 @@ def get_system_pkg_name(flag, mig_logger): else: mig_logger.info('The current system is UOS, not support migration, please check !!!') return False + + +class myThread (threading.Thread): + def __init__(self, threadID, name, q, lock, fpw, fpr, q_query, log): + threading.Thread.__init__(self) + self.threadID = threadID + self.name = name + self.q = q + self.lock = lock + self.fpw = fpw + self.fpr = fpr + self.q_query = q_query + self.log = log + def run(self): + self.log.info ("Open the thread" + self.name) + process_data(self.name, self.q, self.lock, self.fpw, self.fpr, self.q_query, self.log) + self.log.info ("Exit the thread" + self.name) + + +def is_binwary_file(filename): + TEXT_BOMS = { + codecs.BOM_UTF16_BE, + codecs.BOM_UTF16_LE, + codecs.BOM_UTF32_BE, + codecs.BOM_UTF32_LE, + codecs.BOM_UTF8, + } + with open(filename, 'rb') as file: + CHUNKSIZE = 8192 + initial_bytes = file.read(CHUNKSIZE) + file.close + return not any(initial_bytes.startswith(bom) for bom in TEXT_BOMS) and b'\0' in initial_bytes -- 2.20.1