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 C8B691382C5 for ; Sun, 17 May 2020 09:38:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1F3C5E091C; Sun, 17 May 2020 09:38:02 +0000 (UTC) Received: from smtp.gentoo.org (dev.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 0C1EBE091C for ; Sun, 17 May 2020 09:38:02 +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 DBD5634F778 for ; Sun, 17 May 2020 09:38:00 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8B3131F6 for ; Sun, 17 May 2020 09:37:59 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1589708265.c35f39af1ae591c9df50da52e83067428a10f80a.mgorny@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/process.py X-VCS-Directories: lib/portage/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: c35f39af1ae591c9df50da52e83067428a10f80a X-VCS-Branch: master Date: Sun, 17 May 2020 09:37:59 +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: 680bfd46-230c-4f99-90de-219ab56fc32f X-Archives-Hash: 41307cda781dffbcb538359f9099bde9 commit: c35f39af1ae591c9df50da52e83067428a10f80a Author: Michał Górny gentoo org> AuthorDate: Sun May 17 08:55:22 2020 +0000 Commit: Michał Górny gentoo org> CommitDate: Sun May 17 09:37:45 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c35f39af process: Provide libc fallback for sethostname() on PyPy Reviewed-by: Zac Medico gentoo.org> Signed-off-by: Michał Górny gentoo.org> lib/portage/process.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/portage/process.py b/lib/portage/process.py index 79052b608..ceb454030 100644 --- a/lib/portage/process.py +++ b/lib/portage/process.py @@ -715,7 +715,14 @@ def _exec(binary, mycommand, opt_name, fd_pipes, if unshare_net: # use 'localhost' to avoid hostname resolution problems try: - socket.sethostname('localhost') + # pypy3 does not implement socket.sethostname() + new_hostname = b'localhost' + if hasattr(socket, 'sethostname'): + socket.sethostname(new_hostname) + else: + if libc.sethostname(new_hostname, len(new_hostname)) != 0: + errno_value = ctypes.get_errno() + raise OSError(errno_value, os.strerror(errno_value)) except Exception as e: writemsg("Unable to set hostname: %s (for FEATURES=\"network-sandbox\")\n" % ( e,),