From 5033dd8b94456e0201f2f466c1264c6fca116271 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Wed, 3 Dec 2014 17:53:24 +0100 Subject: [PATCH] ignore curses failures during termination (#1035503) --- iotop-0.6-noendcurses.patch | 44 +++++++++++++++++++++++++++++++++++++ iotop.spec | 9 +++++++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 iotop-0.6-noendcurses.patch diff --git a/iotop-0.6-noendcurses.patch b/iotop-0.6-noendcurses.patch new file mode 100644 index 0000000..fb889ef --- /dev/null +++ b/iotop-0.6-noendcurses.patch @@ -0,0 +1,44 @@ +diff -up iotop-0.6/iotop/ui.py.noendcurses iotop-0.6/iotop/ui.py +--- iotop-0.6/iotop/ui.py.noendcurses 2014-12-03 17:50:38.941430261 +0100 ++++ iotop-0.6/iotop/ui.py 2014-12-03 17:51:40.108064465 +0100 +@@ -488,10 +488,14 @@ class IOTopUI(object): + self.win.refresh() + + def run_iotop_window(win, options): ++ global terminating ++ terminating = False + if options.batch: + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + else: + def clean_exit(*args, **kwargs): ++ global terminating ++ terminating = True + sys.exit(0) + signal.signal(signal.SIGINT, clean_exit) + signal.signal(signal.SIGTERM, clean_exit) +@@ -499,6 +503,7 @@ def run_iotop_window(win, options): + process_list = ProcessList(taskstats_connection, options) + ui = IOTopUI(win, process_list, options) + ui.run() ++ terminating = True + + def run_iotop(options): + try: +@@ -520,6 +525,17 @@ Please do not file bugs on iotop about t + sys.exit(1) + else: + raise ++ except curses.error as e: ++ stre = str(e) ++ if terminating and stre.find('ERR')>=0 and ( ++ stre.find('nocbreak()')>=0 or stre.find('endwin()')>=0 ++ ): ++ pass ++ # endwin and nocbreak can cause error (and raise hard to catch ++ # exception) if iotop was running in the terminal and that ++ # terminal got closed while iotop was still running ++ else: ++ raise + + # + # Profiling diff --git a/iotop.spec b/iotop.spec index 889c2a1..6c58058 100644 --- a/iotop.spec +++ b/iotop.spec @@ -1,7 +1,7 @@ %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Name: iotop Version: 0.6 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Top like utility for I/O Group: Applications/System @@ -9,6 +9,9 @@ License: GPLv2+ URL: http://guichaz.free.fr/iotop/ Source0: http://guichaz.free.fr/iotop/files/%{name}-%{version}.tar.bz2 +# rhbz#1035503 +Patch1: iotop-0.6-noendcurses.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -17,6 +20,7 @@ Requires: python %prep %setup +%patch1 -p1 -b .noendcurses %build %{__python} setup.py build @@ -45,6 +49,9 @@ rm -rf $RPM_BUILD_ROOT %{python_sitelib}/* %changelog +* Wed Dec 03 2014 Michal Hlavinka - 0.6-4 +- ignore curses failures during termination (#1035503) + * Sat Jun 07 2014 Fedora Release Engineering - 0.6-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild