@@ -6513,6 +6513,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
65136513 numfiles = int(len(GetDirList))
65146514 fnumfiles = format(numfiles, 'x').lower()
65156515 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
6516+ try:
6517+ fp.flush()
6518+ if(hasattr(os, "sync")):
6519+ os.fsync(fp.fileno())
6520+ except io.UnsupportedOperation:
6521+ pass
6522+ except AttributeError:
6523+ pass
6524+ except OSError:
6525+ pass
65166526 FullSizeFilesAlt = 0
65176527 for curfname in GetDirList:
65186528 fencoding = "UTF-8"
@@ -6764,6 +6774,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
67646774 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
67656775 AppendFileHeaderWithContent(
67666776 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
6777+ try:
6778+ fp.flush()
6779+ if(hasattr(os, "sync")):
6780+ os.fsync(fp.fileno())
6781+ except io.UnsupportedOperation:
6782+ pass
6783+ except AttributeError:
6784+ pass
6785+ except OSError:
6786+ pass
67676787 return fp
67686788
67696789def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["crc32", "crc32", "crc32", "crc32"], formatspecs=__file_format_dict__, verbose=False):
@@ -6772,8 +6792,6 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
67726792 if(verbose):
67736793 logging.basicConfig(format="%(message)s",
67746794 stream=sys.stdout, level=logging.DEBUG)
6775- formver = formatspecs['format_ver']
6776- fileheaderver = str(int(formver.replace(".", "")))
67776795 curinode = 0
67786796 curfid = 0
67796797 inodelist = []
@@ -6841,6 +6859,16 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
68416859 return False
68426860 numfiles = int(len(tarfp.getmembers()))
68436861 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
6862+ try:
6863+ fp.flush()
6864+ if(hasattr(os, "sync")):
6865+ os.fsync(fp.fileno())
6866+ except io.UnsupportedOperation:
6867+ pass
6868+ except AttributeError:
6869+ pass
6870+ except OSError:
6871+ pass
68446872 for member in sorted(tarfp.getmembers(), key=lambda x: x.name):
68456873 fencoding = "UTF-8"
68466874 if(re.findall("^[.|/]", member.name)):
@@ -6979,6 +7007,16 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
69797007 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
69807008 AppendFileHeaderWithContent(
69817009 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7010+ try:
7011+ fp.flush()
7012+ if(hasattr(os, "sync")):
7013+ os.fsync(fp.fileno())
7014+ except io.UnsupportedOperation:
7015+ pass
7016+ except AttributeError:
7017+ pass
7018+ except OSError:
7019+ pass
69827020 fcontents.close()
69837021 return fp
69847022
@@ -6988,8 +7026,6 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
69887026 if(verbose):
69897027 logging.basicConfig(format="%(message)s",
69907028 stream=sys.stdout, level=logging.DEBUG)
6991- formver = formatspecs['format_ver']
6992- fileheaderver = str(int(formver.replace(".", "")))
69937029 curinode = 0
69947030 curfid = 0
69957031 inodelist = []
@@ -7027,6 +7063,16 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
70277063 VerbosePrintOut("Bad file found!")
70287064 numfiles = int(len(zipfp.infolist()))
70297065 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
7066+ try:
7067+ fp.flush()
7068+ if(hasattr(os, "sync")):
7069+ os.fsync(fp.fileno())
7070+ except io.UnsupportedOperation:
7071+ pass
7072+ except AttributeError:
7073+ pass
7074+ except OSError:
7075+ pass
70307076 for member in sorted(zipfp.infolist(), key=lambda x: x.filename):
70317077 fencoding = "UTF-8"
70327078 if(re.findall("^[.|/]", member.filename)):
@@ -7189,6 +7235,16 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
71897235 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
71907236 AppendFileHeaderWithContent(
71917237 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7238+ try:
7239+ fp.flush()
7240+ if(hasattr(os, "sync")):
7241+ os.fsync(fp.fileno())
7242+ except io.UnsupportedOperation:
7243+ pass
7244+ except AttributeError:
7245+ pass
7246+ except OSError:
7247+ pass
71927248 fcontents.close()
71937249 return fp
71947250
@@ -7203,8 +7259,6 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
72037259 if(verbose):
72047260 logging.basicConfig(format="%(message)s",
72057261 stream=sys.stdout, level=logging.DEBUG)
7206- formver = formatspecs['format_ver']
7207- fileheaderver = str(int(formver.replace(".", "")))
72087262 curinode = 0
72097263 curfid = 0
72107264 inodelist = []
@@ -7221,6 +7275,16 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
72217275 VerbosePrintOut("Bad file found!")
72227276 numfiles = int(len(rarfp.infolist()))
72237277 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
7278+ try:
7279+ fp.flush()
7280+ if(hasattr(os, "sync")):
7281+ os.fsync(fp.fileno())
7282+ except io.UnsupportedOperation:
7283+ pass
7284+ except AttributeError:
7285+ pass
7286+ except OSError:
7287+ pass
72247288 try:
72257289 fp.flush()
72267290 if(hasattr(os, "sync")):
@@ -7425,6 +7489,16 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
74257489 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
74267490 AppendFileHeaderWithContent(
74277491 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7492+ try:
7493+ fp.flush()
7494+ if(hasattr(os, "sync")):
7495+ os.fsync(fp.fileno())
7496+ except io.UnsupportedOperation:
7497+ pass
7498+ except AttributeError:
7499+ pass
7500+ except OSError:
7501+ pass
74287502 fcontents.close()
74297503 return fp
74307504
@@ -7457,6 +7531,16 @@ def AppendFilesWithContentFromSevenZip(infile, fp, extradata=[], jsondata={}, co
74577531 VerbosePrintOut("Bad file found!")
74587532 numfiles = int(len(szpfp.list()))
74597533 AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
7534+ try:
7535+ fp.flush()
7536+ if(hasattr(os, "sync")):
7537+ os.fsync(fp.fileno())
7538+ except io.UnsupportedOperation:
7539+ pass
7540+ except AttributeError:
7541+ pass
7542+ except OSError:
7543+ pass
74607544 for member in sorted(szpfp.list(), key=lambda x: x.filename):
74617545 fencoding = "UTF-8"
74627546 if(re.findall("^[.|/]", member.filename)):
@@ -7595,6 +7679,16 @@ def AppendFilesWithContentFromSevenZip(infile, fp, extradata=[], jsondata={}, co
75957679 fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
75967680 AppendFileHeaderWithContent(
75977681 fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[1], checksumtype[2], checksumtype[3]], formatspecs)
7682+ try:
7683+ fp.flush()
7684+ if(hasattr(os, "sync")):
7685+ os.fsync(fp.fileno())
7686+ except io.UnsupportedOperation:
7687+ pass
7688+ except AttributeError:
7689+ pass
7690+ except OSError:
7691+ pass
75987692 fcontents.close()
75997693 return fp
76007694
0 commit comments