From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Subject: Re: [gentoo-portage-dev] [PATCH] process: Provide libc fallback for sethostname() on PyPy
Date: Sun, 17 May 2020 02:15:37 -0700 [thread overview]
Message-ID: <8820ed5b-5f29-2147-79b1-1758673cd557@gentoo.org> (raw)
In-Reply-To: <20200517085601.150943-1-mgorny@gentoo.org>
[-- Attachment #1.1: Type: text/plain, Size: 1184 bytes --]
On 5/17/20 1:56 AM, Michał Górny wrote:
> Signed-off-by: Michał Górny <mgorny@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,),
>
Looks good. Please merge.
--
Thanks,
Zac
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]
prev parent reply other threads:[~2020-05-17 9:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-17 8:56 [gentoo-portage-dev] [PATCH] process: Provide libc fallback for sethostname() on PyPy Michał Górny
2020-05-17 9:15 ` Zac Medico [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8820ed5b-5f29-2147-79b1-1758673cd557@gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
--cc=mgorny@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox