diff --git a/1168.patch b/1168.patch new file mode 100644 index 0000000..0b4dc6b --- /dev/null +++ b/1168.patch @@ -0,0 +1,69 @@ +From 8f2e96099960cda6a18e55af6587c74c1379519a Mon Sep 17 00:00:00 2001 +From: Marek Blaha +Date: Wed, 8 Aug 2018 10:50:26 +0200 +Subject: [PATCH] [conf] Do not traceback on empty option (RhBug:1613577) + +https://bugzilla.redhat.com/show_bug.cgi?id=1613577 +--- + dnf/conf/config.py | 2 +- + tests/conf/test_parser.py | 14 ++++++++++++-- + tests/etc/empty_option.conf | 2 ++ + 3 files changed, 15 insertions(+), 3 deletions(-) + create mode 100644 tests/etc/empty_option.conf + +diff --git a/dnf/conf/config.py b/dnf/conf/config.py +index 044bdcadc..741eddd2d 100644 +--- a/dnf/conf/config.py ++++ b/dnf/conf/config.py +@@ -286,7 +286,7 @@ def _populate(self, parser, section, filename, priority=PRIO_DEFAULT): + for name in parser.getData()[section]: + value = parser.getSubstitutedValue(section, name) + if not value or value == 'None': +- value = None ++ value = '' + + try: + if not self._config: +diff --git a/tests/conf/test_parser.py b/tests/conf/test_parser.py +index 52bbdd021..304fc674b 100644 +--- a/tests/conf/test_parser.py ++++ b/tests/conf/test_parser.py +@@ -20,14 +20,16 @@ + from __future__ import absolute_import + from __future__ import unicode_literals + ++import dnf.conf + from libdnf.conf import ConfigParser + + import tests.support + + substitute = ConfigParser.substitute + +-class SubstituteTest(tests.support.TestCase): +- def test_read(self): ++ ++class ParserTest(tests.support.TestCase): ++ def test_substitute(self): + substs = {'lies': 'fact'} + # Test a single word without braces + rawstr = '$Substitute some $lies.' +@@ -51,3 +53,11 @@ def test_read(self): + rawstr = '$Substitute some $lies}withoutspace.' + result = '$Substitute some fact}withoutspace.' + self.assertEqual(substitute(rawstr, substs), result) ++ ++ def test_empty_option(self): ++ # Parser is able to read config file with option without value ++ FN = tests.support.resource_path('etc/empty_option.conf') ++ conf = dnf.conf.Conf() ++ conf.config_file_path = FN ++ conf.read() ++ self.assertEqual(conf.installroot, '') +diff --git a/tests/etc/empty_option.conf b/tests/etc/empty_option.conf +new file mode 100644 +index 000000000..37746172a +--- /dev/null ++++ b/tests/etc/empty_option.conf +@@ -0,0 +1,2 @@ ++[main] ++installroot = diff --git a/dnf.spec b/dnf.spec index c0fd10e..94ab6ee 100644 --- a/dnf.spec +++ b/dnf.spec @@ -74,12 +74,16 @@ It supports RPMs, modules and comps groups & environments. Name: dnf Version: 3.2.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: %{pkg_summary} # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPLv2+ and GPLv2 and GPL URL: https://github.com/rpm-software-management/dnf Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +# Fix for https://bugzilla.redhat.com/show_bug.cgi?id=1613577 +# crash that breaks distro composes +# https://github.com/rpm-software-management/dnf/pull/1168 +Patch0: 1168.patch BuildArch: noarch BuildRequires: cmake BuildRequires: gettext @@ -486,6 +490,9 @@ rm -vf %{buildroot}%{_bindir}/dnf-automatic-* %endif %changelog +* Wed Aug 08 2018 Adam Williamson - 3.2.0-2 +- Fix a crash that breaks Rawhide composes (RhBug:1613577) + * Tue Aug 07 2018 Daniel Mach - 3.2.0-1 - [sack] Use module_platform_id option. - [module] Switch module persistor to libdnf implementation.