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 AA8931382C5 for ; Sun, 29 Apr 2018 21:29:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5ACA1E0B48; Sun, 29 Apr 2018 21:29: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 36685E0B48 for ; Sun, 29 Apr 2018 21:29:22 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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 351F9335C95 for ; Sun, 29 Apr 2018 21:29:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 53E202A4 for ; Sun, 29 Apr 2018 21:29: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: <1525037197.542c6e6c20a1d93a3a2af47c8de50eac3c891d5d.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/_MergeProcess.py X-VCS-Directories: pym/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 542c6e6c20a1d93a3a2af47c8de50eac3c891d5d X-VCS-Branch: master Date: Sun, 29 Apr 2018 21:29: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-Archives-Salt: 9c24e952-235c-40cb-a19c-d1f7f93e740e X-Archives-Hash: 030c1ce322a3ca8738e5eae354a045af commit: 542c6e6c20a1d93a3a2af47c8de50eac3c891d5d Author: Zac Medico gentoo org> AuthorDate: Sun Apr 29 20:48:23 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Apr 29 21:26:37 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=542c6e6c MergeProcess: fix deprecated _set_returncode (bug 654276) Move cleanup code from _set_returncode to _async_waitpid_cb, since _set_returncode expects an os.waitpid return value which is inconveniently different from the returncode that is passed to asyncio.AbstractChildWatcher.add_child_handler callbacks. Bug: https://bugs.gentoo.org/654276 pym/portage/dbapi/_MergeProcess.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_MergeProcess.py index 35591af16..bfbe387e4 100644 --- a/pym/portage/dbapi/_MergeProcess.py +++ b/pym/portage/dbapi/_MergeProcess.py @@ -1,4 +1,4 @@ -# Copyright 2010-2013 Gentoo Foundation +# Copyright 2010-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import io @@ -251,8 +251,12 @@ class MergeProcess(ForkProcess): # in order to avoid a race condition. os._exit(1) - def _set_returncode(self, wait_retval): - ForkProcess._set_returncode(self, wait_retval) + def _async_waitpid_cb(self, *args, **kwargs): + """ + Override _async_waitpid_cb to perform cleanup that is + not necessarily idempotent. + """ + ForkProcess._async_waitpid_cb(self, *args, **kwargs) if self.returncode == portage.const.RETURNCODE_POSTINST_FAILURE: self.postinst_failure = True self.returncode = os.EX_OK