From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 07AB8138350 for ; Sat, 7 Mar 2020 20:14:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 18CD9E0844; Sat, 7 Mar 2020 20:14:22 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DFD9FE0844 for ; Sat, 7 Mar 2020 20:14:21 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6638134F199 for ; Sat, 7 Mar 2020 20:14:20 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D27D3103 for ; Sat, 7 Mar 2020 20:14:18 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1583610846.50da2e16599202b9ecb3d4494f214a0d30b073d7.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: lib/_emerge/AbstractPollTask.py lib/_emerge/CompositeTask.py lib/_emerge/FifoIpcDaemon.py lib/_emerge/SubProcess.py X-VCS-Directories: lib/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 50da2e16599202b9ecb3d4494f214a0d30b073d7 X-VCS-Branch: master Date: Sat, 7 Mar 2020 20:14:18 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 3b1d7bce-5e46-43f3-8a9e-2f82b524b66c X-Archives-Hash: 195ac6ad4883c4509227e1b21bd3080a commit: 50da2e16599202b9ecb3d4494f214a0d30b073d7 Author: Zac Medico gentoo org> AuthorDate: Sat Mar 7 19:41:49 2020 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Mar 7 19:54:06 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=50da2e16 AsynchronousTask: simplify isAlive (bug 711688) Simplify all AsynchronousTask subclasses to use the default isAlive implementation, which returns True if self.returncode is not None. This fixes cases where the method would erroneously return False, leading to issues like bug 711688, where the CompositeTask isAlive implementation returned False for a BinpkgPrefetcher instance that was still in the process of starting via its async_start method. Fixes: d66e9ec0b105 ("AsynchronousTask: add coroutine async_start method") Bug: https://bugs.gentoo.org/711688 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/AbstractPollTask.py | 3 --- lib/_emerge/CompositeTask.py | 3 --- lib/_emerge/FifoIpcDaemon.py | 3 --- lib/_emerge/SubProcess.py | 6 +----- 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/lib/_emerge/AbstractPollTask.py b/lib/_emerge/AbstractPollTask.py index 4157794c6..7e9f2b536 100644 --- a/lib/_emerge/AbstractPollTask.py +++ b/lib/_emerge/AbstractPollTask.py @@ -16,9 +16,6 @@ class AbstractPollTask(AsynchronousTask): _bufsize = 4096 - def isAlive(self): - return bool(self._registered) - def _read_array(self, f): """ NOTE: array.fromfile() is used here only for testing purposes, diff --git a/lib/_emerge/CompositeTask.py b/lib/_emerge/CompositeTask.py index 319f9f995..1d199d19b 100644 --- a/lib/_emerge/CompositeTask.py +++ b/lib/_emerge/CompositeTask.py @@ -12,9 +12,6 @@ class CompositeTask(AsynchronousTask): _TASK_QUEUED = -1 - def isAlive(self): - return self._current_task is not None - def _cancel(self): if self._current_task is not None: if self._current_task is self._TASK_QUEUED: diff --git a/lib/_emerge/FifoIpcDaemon.py b/lib/_emerge/FifoIpcDaemon.py index 0cbaa13c7..2ec69d1cb 100644 --- a/lib/_emerge/FifoIpcDaemon.py +++ b/lib/_emerge/FifoIpcDaemon.py @@ -70,9 +70,6 @@ class FifoIpcDaemon(AbstractPollTask): self._files.pipe_in, self._input_handler) - def isAlive(self): - return self._registered - def _cancel(self): if self.returncode is None: self.returncode = 1 diff --git a/lib/_emerge/SubProcess.py b/lib/_emerge/SubProcess.py index 1ddfe57fd..e834cb7d3 100644 --- a/lib/_emerge/SubProcess.py +++ b/lib/_emerge/SubProcess.py @@ -24,7 +24,7 @@ class SubProcess(AbstractPollTask): return self.returncode def _cancel(self): - if self.isAlive(): + if self.isAlive() and self.pid is not None: try: os.kill(self.pid, signal.SIGTERM) except OSError as e: @@ -37,10 +37,6 @@ class SubProcess(AbstractPollTask): elif e.errno != errno.ESRCH: raise - def isAlive(self): - return self.pid is not None and \ - self.returncode is None - def _async_wait(self): if self.returncode is None: raise asyncio.InvalidStateError('Result is not ready for %s' % (self,))