virt-manager/53245827-urlfetcher-Force-a-flush-after-writing-to-a-file.patch
Charles Arnold 7a4cac2ed8 - Upstream bug fixes (bsc#1027942)
0c223ab2-guest-Dont-set-default-uefi-if-firmware-is-set.patch
  414ffa5e-virt-install-Use-minutes-instead-of-seconds-on-get_time_string.patch
  53245827-urlfetcher-Force-a-flush-after-writing-to-a-file.patch
  3009888a-urlfetcher-Dont-override-fullurl-when-its-explicitly-set.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=482
2019-08-27 20:01:01 +00:00

40 lines
1.4 KiB
Diff

Subject: urlfetcher: Force a flush after writing to a file
From: Fabiano Fidêncio fidencio@redhat.com Mon Aug 5 13:47:25 2019 +0200
Date: Tue Aug 6 17:59:05 2019 -0400:
Git: 5324582747a57c5df1574ed99dbe20d3d0f65747
While downloading really small files, on some file systems, the files
may not be flushed on time for whatever reason they've been downloaded.
This issue was noticed after trying to perform unattended installations
and noticing that some files, particularly really small ones, where just
empty.
While the original issue would be fixed by doing the flush on
_HTTPURLFetcher::_write(), let's also force it on _URLFetcher::_write()
to do the same.
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
diff --git a/virtinst/install/urlfetcher.py b/virtinst/install/urlfetcher.py
index e48c801c..07f8b5ea 100644
--- a/virtinst/install/urlfetcher.py
+++ b/virtinst/install/urlfetcher.py
@@ -156,6 +156,7 @@ class _URLFetcher(object):
fileobj.write(buff)
total += len(buff)
self.meter.update(total)
+ fileobj.flush()
return total
def _grabber(self, url):
@@ -291,6 +292,7 @@ class _HTTPURLFetcher(_URLFetcher):
fileobj.write(data)
total += len(data)
self.meter.update(total)
+ fileobj.flush()
return total