From c0440e6ed82f7a11c4fdf83c97214c4a0211a150 Mon Sep 17 00:00:00 2001 From: Matthew Almond Date: Apr 30 2021 20:33:31 +0000 Subject: PR1761 bugfix --- diff --git a/SOURCES/1761.patch b/SOURCES/1761.patch new file mode 100644 index 0000000..d89ebae --- /dev/null +++ b/SOURCES/1761.patch @@ -0,0 +1,43 @@ +From 06b0081220d7e85134c61e6c86e723eb4a34b535 Mon Sep 17 00:00:00 2001 +From: Matthew Almond +Date: Fri, 30 Apr 2021 13:11:04 -0700 +Subject: [PATCH] Do not assume that a remote rpm is complete if present + +We should not assume that a file present in the hashed directory for a remote +url is complete if present. + +This manifests in two ways: + +1. `Can not load RPM file: ` if the headers are incomplete +2. `Payload SHA256 digest: BAD` error otherwise + +This isn't a common error in the field because most sites use `keepcache=0` in +`dnf.conf`. On the latter error the broken RPM is deleted, and the next run +will retry the download from scratch, and probably succeeding. + +This impacts us because we use `keepcache=1` so once we get an interrupted +download, we can't (automatically) recover. + +The fix here forces us to try to download/resume the file even if present on +disk, because we don't have any higher level metadata like digests to falsify +downloads without network. + +This change makes an explicit decision to try to be more correct instead of +using an incomplete optimization. +--- + dnf/util.py | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/dnf/util.py b/dnf/util.py +index b9dcd47081..9f0eb4abd2 100644 +--- a/dnf/util.py ++++ b/dnf/util.py +@@ -88,8 +88,6 @@ def _urlopen_progress(url, conf, progress=None): + if progress is None: + progress = dnf.callback.NullDownloadProgress() + pload = dnf.repo.RemoteRPMPayload(url, conf, progress) +- if os.path.exists(pload.local_path): +- return pload.local_path + est_remote_size = sum([pload.download_size]) + progress.start(1, est_remote_size) + targets = [pload._librepo_target()] diff --git a/SPECS/dnf.spec b/SPECS/dnf.spec index b6e489e..d8fdb81 100644 --- a/SPECS/dnf.spec +++ b/SPECS/dnf.spec @@ -82,7 +82,7 @@ It supports RPMs, modules and comps groups & environments. Name: dnf Version: 4.4.2 -Release: 11.2%{?dist} +Release: 11.3%{?dist} Summary: %{pkg_summary} # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPLv2+ and GPLv2 and GPL @@ -129,6 +129,8 @@ Patch17: 0017-Set-persistdir-for-fill-sack-from-repos-in-cache-tests-RhBu Patch18: 0018-Allow-stream-switching-if-option-enabled.patch Patch19: 0019-Update-translations.patch +Patch9998: https://github.com/rpm-software-management/dnf/pull/1761.patch +Provides: dnf(pr1761) Requires: libdnf(pr1164) Patch9999: https://github.com/rpm-software-management/dnf/pull/1743.patch Provides: dnf(pr1743) @@ -552,6 +554,9 @@ ln -sr %{buildroot}%{confdir}/vars %{buildroot}%{_sysconfdir}/yum/vars %endif %changelog +* Fri Apr 30 2021 Matthew Almond - 4.4.2-11.3 +- PR1761 bugfix + * Wed Mar 24 2021 Matthew Almond - 4.4.2-11.2 - Back out change on conflicts_dnf_plugins_core_version