@@ -6520,6 +6520,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
65206520 numfiles = int(len(GetDirList))
65216521 fnumfiles = format(numfiles, 'x').lower()
65226522 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
6523+ try:
6524+ fp.flush()
6525+ if(hasattr(os, "sync")):
6526+ os.fsync(fp.fileno())
6527+ except io.UnsupportedOperation:
6528+ pass
6529+ except AttributeError:
6530+ pass
6531+ except OSError:
6532+ pass
65236533 FullSizeFilesAlt = 0
65246534 for curfname in GetDirList:
65256535 fencoding = "UTF-8"
@@ -6771,6 +6781,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
67716781 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
67726782 AppendFileHeaderWithContent(
67736783 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
6784+ try:
6785+ fp.flush()
6786+ if(hasattr(os, "sync")):
6787+ os.fsync(fp.fileno())
6788+ except io.UnsupportedOperation:
6789+ pass
6790+ except AttributeError:
6791+ pass
6792+ except OSError:
6793+ pass
67746794 return fp
67756795
67766796def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["crc32", "crc32", "crc32", "crc32"], formatspecs=__file_format_dict__, verbose=False):
@@ -6779,8 +6799,6 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
67796799 if(verbose):
67806800 logging.basicConfig(format="%(message)s",
67816801 stream=sys.stdout, level=logging.DEBUG)
6782- formver = formatspecs['format_ver']
6783- fileheaderver = str(int(formver.replace(".", "")))
67846802 curinode = 0
67856803 curfid = 0
67866804 inodelist = []
@@ -6848,6 +6866,16 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
68486866 return False
68496867 numfiles = int(len(tarfp.getmembers()))
68506868 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
6869+ try:
6870+ fp.flush()
6871+ if(hasattr(os, "sync")):
6872+ os.fsync(fp.fileno())
6873+ except io.UnsupportedOperation:
6874+ pass
6875+ except AttributeError:
6876+ pass
6877+ except OSError:
6878+ pass
68516879 for member in sorted(tarfp.getmembers(), key=lambda x: x.name):
68526880 fencoding = "UTF-8"
68536881 if(re.findall("^[.|/]", member.name)):
@@ -6986,6 +7014,16 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
69867014 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
69877015 AppendFileHeaderWithContent(
69887016 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7017+ try:
7018+ fp.flush()
7019+ if(hasattr(os, "sync")):
7020+ os.fsync(fp.fileno())
7021+ except io.UnsupportedOperation:
7022+ pass
7023+ except AttributeError:
7024+ pass
7025+ except OSError:
7026+ pass
69897027 fcontents.close()
69907028 return fp
69917029
@@ -6995,8 +7033,6 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
69957033 if(verbose):
69967034 logging.basicConfig(format="%(message)s",
69977035 stream=sys.stdout, level=logging.DEBUG)
6998- formver = formatspecs['format_ver']
6999- fileheaderver = str(int(formver.replace(".", "")))
70007036 curinode = 0
70017037 curfid = 0
70027038 inodelist = []
@@ -7034,6 +7070,16 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
70347070 VerbosePrintOut("Bad file found!")
70357071 numfiles = int(len(zipfp.infolist()))
70367072 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
7073+ try:
7074+ fp.flush()
7075+ if(hasattr(os, "sync")):
7076+ os.fsync(fp.fileno())
7077+ except io.UnsupportedOperation:
7078+ pass
7079+ except AttributeError:
7080+ pass
7081+ except OSError:
7082+ pass
70377083 for member in sorted(zipfp.infolist(), key=lambda x: x.filename):
70387084 fencoding = "UTF-8"
70397085 if(re.findall("^[.|/]", member.filename)):
@@ -7196,6 +7242,16 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
71967242 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
71977243 AppendFileHeaderWithContent(
71987244 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7245+ try:
7246+ fp.flush()
7247+ if(hasattr(os, "sync")):
7248+ os.fsync(fp.fileno())
7249+ except io.UnsupportedOperation:
7250+ pass
7251+ except AttributeError:
7252+ pass
7253+ except OSError:
7254+ pass
71997255 fcontents.close()
72007256 return fp
72017257
@@ -7210,8 +7266,6 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
72107266 if(verbose):
72117267 logging.basicConfig(format="%(message)s",
72127268 stream=sys.stdout, level=logging.DEBUG)
7213- formver = formatspecs['format_ver']
7214- fileheaderver = str(int(formver.replace(".", "")))
72157269 curinode = 0
72167270 curfid = 0
72177271 inodelist = []
@@ -7228,6 +7282,16 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
72287282 VerbosePrintOut("Bad file found!")
72297283 numfiles = int(len(rarfp.infolist()))
72307284 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
7285+ try:
7286+ fp.flush()
7287+ if(hasattr(os, "sync")):
7288+ os.fsync(fp.fileno())
7289+ except io.UnsupportedOperation:
7290+ pass
7291+ except AttributeError:
7292+ pass
7293+ except OSError:
7294+ pass
72317295 try:
72327296 fp.flush()
72337297 if(hasattr(os, "sync")):
@@ -7432,6 +7496,16 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
74327496 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
74337497 AppendFileHeaderWithContent(
74347498 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7499+ try:
7500+ fp.flush()
7501+ if(hasattr(os, "sync")):
7502+ os.fsync(fp.fileno())
7503+ except io.UnsupportedOperation:
7504+ pass
7505+ except AttributeError:
7506+ pass
7507+ except OSError:
7508+ pass
74357509 fcontents.close()
74367510 return fp
74377511
@@ -7464,6 +7538,16 @@ def AppendFilesWithContentFromSevenZip(infile, fp, extradata=[], jsondata={}, co
74647538 VerbosePrintOut("Bad file found!")
74657539 numfiles = int(len(szpfp.list()))
74667540 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
7541+ try:
7542+ fp.flush()
7543+ if(hasattr(os, "sync")):
7544+ os.fsync(fp.fileno())
7545+ except io.UnsupportedOperation:
7546+ pass
7547+ except AttributeError:
7548+ pass
7549+ except OSError:
7550+ pass
74677551 for member in sorted(szpfp.list(), key=lambda x: x.filename):
74687552 fencoding = "UTF-8"
74697553 if(re.findall("^[.|/]", member.filename)):
@@ -7602,6 +7686,16 @@ def AppendFilesWithContentFromSevenZip(infile, fp, extradata=[], jsondata={}, co
76027686 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
76037687 AppendFileHeaderWithContent(
76047688 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7689+ try:
7690+ fp.flush()
7691+ if(hasattr(os, "sync")):
7692+ os.fsync(fp.fileno())
7693+ except io.UnsupportedOperation:
7694+ pass
7695+ except AttributeError:
7696+ pass
7697+ except OSError:
7698+ pass
76057699 fcontents.close()
76067700 return fp
76077701
0 commit comments