From c93e4b0ce1a8dbe3ae4e4402e94a4d98e95ce08c Mon Sep 17 00:00:00 2001 From: Michal Luscon Date: Fri, 27 Nov 2015 11:01:17 +0100 Subject: [PATCH] Update dnf to 1.1.4-2 --- dnf.spec | 7 ++++++- stdin-fix.patch | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 stdin-fix.patch diff --git a/dnf.spec b/dnf.spec index 5bf31bf..a022796 100644 --- a/dnf.spec +++ b/dnf.spec @@ -11,12 +11,13 @@ Name: dnf Version: 1.1.4 -Release: 1%{?snapshot}%{?dist} +Release: 2%{?snapshot}%{?dist} Summary: Package manager forked from Yum, using libsolv as a dependency resolver # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPLv2+ and GPLv2 and GPL URL: https://github.com/rpm-software-management/dnf Source0: https://github.com/rpm-software-management/dnf/archive/%{name}-%{version}.tar.gz +Patch0: stdin-fix.patch BuildArch: noarch BuildRequires: cmake BuildRequires: gettext @@ -137,6 +138,7 @@ Alternative CLI to "dnf upgrade" suitable for automatic, regular execution. %prep %setup -q -n dnf-%{version} +%patch0 -p1 rm -rf py3 mkdir ../py3 cp -a . ../py3/ @@ -268,6 +270,9 @@ exit 0 %systemd_postun_with_restart dnf-automatic.timer %changelog +* Fri Nov 27 2015 Michal Luscon 1.1.4-2 +- cli: don't crash if y/n and sys.stdin is None (RhBug:1278382) (Adam Williamson) + * Mon Nov 16 2015 Michal Luscon 1.1.4-1 - AUTHORS: updated (Jan Silhan) - query: add compatibility methods (Michal Luscon) diff --git a/stdin-fix.patch b/stdin-fix.patch new file mode 100644 index 0000000..2db4c82 --- /dev/null +++ b/stdin-fix.patch @@ -0,0 +1,42 @@ +From b7c55d013542ce9e4c7775737bf454d9b10df977 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Tue, 17 Nov 2015 15:04:19 -0800 +Subject: [PATCH] cli: don't crash if y/n and sys.stdin is None (RhBug:1278382) + +Per https://bugzilla.redhat.com/show_bug.cgi?id=1278382 , if +sys.stdin is somehow None (which currently seems to be the case +when a dnf command is run in virt-builder) and a dnf command +leads to a y/n question, dnf will crash. This should fix it. +--- + AUTHORS | 1 + + dnf/cli/cli.py | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/AUTHORS b/AUTHORS +index 8e0d3be..ba95371 100644 +--- a/AUTHORS ++++ b/AUTHORS +@@ -56,6 +56,7 @@ DNF AUTHORS + DNF CONTRIBUTORS + ---------------- + Adam Salih ++ Adam Williamson + Albert Uchytil + Alberto Ruiz + Baurzhan Muftakhidinov +diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py +index 0918736..80cfa48 100644 +--- a/dnf/cli/cli.py ++++ b/dnf/cli/cli.py +@@ -248,7 +248,7 @@ class BaseCli(dnf.Base): + + elif result == 1: + ay = self.conf.assumeyes and not self.conf.assumeno +- if not sys.stdin.isatty() and not ay: ++ if (not sys.stdin or not sys.stdin.isatty()) and not ay: + raise dnf.exceptions.Error(_('Refusing to automatically import keys when running ' \ + 'unattended.\nUse "-y" to override.')) + +-- +2.4.3 +