@@ -6521,6 +6521,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
65216521 numfiles = int(len(GetDirList))
65226522 fnumfiles = format(numfiles, 'x').lower()
65236523 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
6524+ try:
6525+ fp.flush()
6526+ if(hasattr(os, "sync")):
6527+ os.fsync(fp.fileno())
6528+ except io.UnsupportedOperation:
6529+ pass
6530+ except AttributeError:
6531+ pass
6532+ except OSError:
6533+ pass
65246534 FullSizeFilesAlt = 0
65256535 for curfname in GetDirList:
65266536 fencoding = "UTF-8"
@@ -6772,6 +6782,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
67726782 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
67736783 AppendFileHeaderWithContent(
67746784 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
6785+ try:
6786+ fp.flush()
6787+ if(hasattr(os, "sync")):
6788+ os.fsync(fp.fileno())
6789+ except io.UnsupportedOperation:
6790+ pass
6791+ except AttributeError:
6792+ pass
6793+ except OSError:
6794+ pass
67756795 return fp
67766796
67776797def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["crc32", "crc32", "crc32", "crc32"], formatspecs=__file_format_dict__, verbose=False):
@@ -6780,8 +6800,6 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
67806800 if(verbose):
67816801 logging.basicConfig(format="%(message)s",
67826802 stream=sys.stdout, level=logging.DEBUG)
6783- formver = formatspecs['format_ver']
6784- fileheaderver = str(int(formver.replace(".", "")))
67856803 curinode = 0
67866804 curfid = 0
67876805 inodelist = []
@@ -6849,6 +6867,16 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
68496867 return False
68506868 numfiles = int(len(tarfp.getmembers()))
68516869 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
6870+ try:
6871+ fp.flush()
6872+ if(hasattr(os, "sync")):
6873+ os.fsync(fp.fileno())
6874+ except io.UnsupportedOperation:
6875+ pass
6876+ except AttributeError:
6877+ pass
6878+ except OSError:
6879+ pass
68526880 for member in sorted(tarfp.getmembers(), key=lambda x: x.name):
68536881 fencoding = "UTF-8"
68546882 if(re.findall("^[.|/]", member.name)):
@@ -6987,6 +7015,16 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
69877015 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
69887016 AppendFileHeaderWithContent(
69897017 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7018+ try:
7019+ fp.flush()
7020+ if(hasattr(os, "sync")):
7021+ os.fsync(fp.fileno())
7022+ except io.UnsupportedOperation:
7023+ pass
7024+ except AttributeError:
7025+ pass
7026+ except OSError:
7027+ pass
69907028 fcontents.close()
69917029 return fp
69927030
@@ -6996,8 +7034,6 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
69967034 if(verbose):
69977035 logging.basicConfig(format="%(message)s",
69987036 stream=sys.stdout, level=logging.DEBUG)
6999- formver = formatspecs['format_ver']
7000- fileheaderver = str(int(formver.replace(".", "")))
70017037 curinode = 0
70027038 curfid = 0
70037039 inodelist = []
@@ -7035,6 +7071,16 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
70357071 VerbosePrintOut("Bad file found!")
70367072 numfiles = int(len(zipfp.infolist()))
70377073 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
7074+ try:
7075+ fp.flush()
7076+ if(hasattr(os, "sync")):
7077+ os.fsync(fp.fileno())
7078+ except io.UnsupportedOperation:
7079+ pass
7080+ except AttributeError:
7081+ pass
7082+ except OSError:
7083+ pass
70387084 for member in sorted(zipfp.infolist(), key=lambda x: x.filename):
70397085 fencoding = "UTF-8"
70407086 if(re.findall("^[.|/]", member.filename)):
@@ -7197,6 +7243,16 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
71977243 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
71987244 AppendFileHeaderWithContent(
71997245 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7246+ try:
7247+ fp.flush()
7248+ if(hasattr(os, "sync")):
7249+ os.fsync(fp.fileno())
7250+ except io.UnsupportedOperation:
7251+ pass
7252+ except AttributeError:
7253+ pass
7254+ except OSError:
7255+ pass
72007256 fcontents.close()
72017257 return fp
72027258
@@ -7211,8 +7267,6 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
72117267 if(verbose):
72127268 logging.basicConfig(format="%(message)s",
72137269 stream=sys.stdout, level=logging.DEBUG)
7214- formver = formatspecs['format_ver']
7215- fileheaderver = str(int(formver.replace(".", "")))
72167270 curinode = 0
72177271 curfid = 0
72187272 inodelist = []
@@ -7229,6 +7283,16 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
72297283 VerbosePrintOut("Bad file found!")
72307284 numfiles = int(len(rarfp.infolist()))
72317285 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
7286+ try:
7287+ fp.flush()
7288+ if(hasattr(os, "sync")):
7289+ os.fsync(fp.fileno())
7290+ except io.UnsupportedOperation:
7291+ pass
7292+ except AttributeError:
7293+ pass
7294+ except OSError:
7295+ pass
72327296 try:
72337297 fp.flush()
72347298 if(hasattr(os, "sync")):
@@ -7433,6 +7497,16 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
74337497 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
74347498 AppendFileHeaderWithContent(
74357499 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7500+ try:
7501+ fp.flush()
7502+ if(hasattr(os, "sync")):
7503+ os.fsync(fp.fileno())
7504+ except io.UnsupportedOperation:
7505+ pass
7506+ except AttributeError:
7507+ pass
7508+ except OSError:
7509+ pass
74367510 fcontents.close()
74377511 return fp
74387512
@@ -7465,6 +7539,16 @@ def AppendFilesWithContentFromSevenZip(infile, fp, extradata=[], jsondata={}, co
74657539 VerbosePrintOut("Bad file found!")
74667540 numfiles = int(len(szpfp.list()))
74677541 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
7542+ try:
7543+ fp.flush()
7544+ if(hasattr(os, "sync")):
7545+ os.fsync(fp.fileno())
7546+ except io.UnsupportedOperation:
7547+ pass
7548+ except AttributeError:
7549+ pass
7550+ except OSError:
7551+ pass
74687552 for member in sorted(szpfp.list(), key=lambda x: x.filename):
74697553 fencoding = "UTF-8"
74707554 if(re.findall("^[.|/]", member.filename)):
@@ -7603,6 +7687,16 @@ def AppendFilesWithContentFromSevenZip(infile, fp, extradata=[], jsondata={}, co
76037687 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
76047688 AppendFileHeaderWithContent(
76057689 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7690+ try:
7691+ fp.flush()
7692+ if(hasattr(os, "sync")):
7693+ os.fsync(fp.fileno())
7694+ except io.UnsupportedOperation:
7695+ pass
7696+ except AttributeError:
7697+ pass
7698+ except OSError:
7699+ pass
76067700 fcontents.close()
76077701 return fp
76087702
0 commit comments