Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] process: Provide libc fallback for sethostname() on PyPy
Date: Sun, 17 May 2020 09:15:42
Message-Id: 8820ed5b-5f29-2147-79b1-1758673cd557@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] process: Provide libc fallback for sethostname() on PyPy by "Michał Górny"
1 On 5/17/20 1:56 AM, Michał Górny wrote:
2 > Signed-off-by: Michał Górny <mgorny@g.o>
3 > ---
4 > lib/portage/process.py | 9 ++++++++-
5 > 1 file changed, 8 insertions(+), 1 deletion(-)
6 >
7 > diff --git a/lib/portage/process.py b/lib/portage/process.py
8 > index 79052b608..ceb454030 100644
9 > --- a/lib/portage/process.py
10 > +++ b/lib/portage/process.py
11 > @@ -715,7 +715,14 @@ def _exec(binary, mycommand, opt_name, fd_pipes,
12 > if unshare_net:
13 > # use 'localhost' to avoid hostname resolution problems
14 > try:
15 > - socket.sethostname('localhost')
16 > + # pypy3 does not implement socket.sethostname()
17 > + new_hostname = b'localhost'
18 > + if hasattr(socket, 'sethostname'):
19 > + socket.sethostname(new_hostname)
20 > + else:
21 > + if libc.sethostname(new_hostname, len(new_hostname)) != 0:
22 > + errno_value = ctypes.get_errno()
23 > + raise OSError(errno_value, os.strerror(errno_value))
24 > except Exception as e:
25 > writemsg("Unable to set hostname: %s (for FEATURES=\"network-sandbox\")\n" % (
26 > e,),
27 >
28
29 Looks good. Please merge.
30 --
31 Thanks,
32 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature