| Summary: | app-emulation/qemu: qemu-alpha linux-user breaks emerge with python3.6+ inside alpha chroot | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Barnabás Virágh <cyborgyn> |
| Component: | Current packages | Assignee: | Matthias Maier <tamiko> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | jstein, slyfox, virtualization |
| Priority: | Normal | ||
| Version: | unspecified | ||
| Hardware: | AMD64 | ||
| OS: | Linux | ||
| URL: | https://lists.nongnu.org/archive/html/qemu-devel/2020-04/msg02545.html | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Attachments: |
Python3 Exception from emerge
emerge --info qemu on HOST system 0001-linux-user-syscall.c-add-target-to-host-mapping-for-.patch |
||
|
Description
Barnabás Virágh
2020-04-15 12:28:41 UTC
Created attachment 633068 [details]
Python3 Exception from emerge
Created attachment 633070 [details]
emerge --info qemu on HOST system
Posting logs as is:
Traceback (most recent call last):
File "/usr/lib/python-exec/python3.7/emerge", line 53, in <module>
retval = emerge_main()
File "/usr/lib/python3.7/site-packages/_emerge/main.py", line 1309, in emerge_main
return run_action(emerge_config)
File "/usr/lib/python3.7/site-packages/_emerge/actions.py", line 3371, in run_action
retval = action_build(emerge_config, spinner=spinner)
File "/usr/lib/python3.7/site-packages/_emerge/actions.py", line 358, in action_build
settings, trees, myopts, myparams, myaction, myfiles, spinner)
File "/usr/lib/python3.7/site-packages/_emerge/depgraph.py", line 9912, in backtrack_depgraph
myaction, myfiles, spinner)
File "/usr/lib/python3.7/site-packages/_emerge/depgraph.py", line 9948, in _backtrack_depgraph
backtrack_parameters=backtrack_parameters)
File "/usr/lib/python3.7/site-packages/_emerge/depgraph.py", line 623, in __init__
self._event_loop = asyncio._safe_loop()
File "/usr/lib/python3.7/site-packages/portage/util/futures/_asyncio/__init__.py", line 269, in _safe_loop
return _global_event_loop()
File "/usr/lib/python3.7/site-packages/portage/util/_eventloop/global_event_loop.py", line 38, in global_event_loop
instance = constructor()._asyncio_wrapper
File "/usr/lib/python3.7/site-packages/portage/util/_eventloop/asyncio_event_loop.py", line 32, in __init__
loop = loop or _real_asyncio.get_event_loop()
File "/usr/lib/python3.7/asyncio/events.py", line 640, in get_event_loop
self.set_event_loop(self.new_event_loop())
File "/usr/lib/python3.7/asyncio/events.py", line 660, in new_event_loop
return self._loop_factory()
File "/usr/lib/python3.7/asyncio/unix_events.py", line 51, in __init__
super().__init__(selector)
File "/usr/lib/python3.7/asyncio/selector_events.py", line 57, in __init__
selector = selectors.DefaultSelector()
File "/usr/lib/python3.7/selectors.py", line 349, in __init__
self._selector = self._selector_cls()
OSError: [Errno 22] Invalid argument
> self._selector = self._selector_cls()
> OSError: [Errno 22] Invalid argument
Probably missing/incomplete syscall wiring for alpha. Let's track it down and write a small example that exhibits a problem.
(In reply to Sergei Trofimovich from comment #4) > > self._selector = self._selector_cls() > > OSError: [Errno 22] Invalid argument > > Probably missing/incomplete syscall wiring for alpha. Let's track it down > and write a small example that exhibits a problem. Probably epoll: $ fgrep -R _selector_cls /usr/lib/python3.7 /usr/lib/python3.7/selectors.py: _selector_cls = select.poll /usr/lib/python3.7/selectors.py: _selector_cls = select.epoll /usr/lib/python3.7/selectors.py: _selector_cls = select.devpoll Checking on amd64:
$ strace -f python3 -c 'import selectors; selectors.DefaultSelector()' |& fgrep poll
epoll_create1(EPOLL_CLOEXEC) = 3
Checking on qemu-alpha:
$ cat a.c
#include <sys/epoll.h>
int main() {
epoll_create1(EPOLL_CLOEXEC);
}
$ alpha-unknown-linux-gnu-gcc a.c -o a
$ /usr/bin/qemu-alpha -strace -L /usr/alpha-unknown-linux-gnu/ ./a
epoll_create1(2097152,274886379576,274886379592,274889063496,274877908880,274886458400) = -1 errno=22 (Invalid argument)
4162665 exit_group(0)
Looks simple.
My guess it's because EPOLL_CLOEXEC constant differs from target to target: $ fgrep EPOLL_CLOEXEC glibc.git/ sysdeps/unix/sysv/linux/alpha/bits/epoll.h: EPOLL_CLOEXEC = 010000000 sysdeps/unix/sysv/linux/alpha/bits/epoll.h:#define EPOLL_CLOEXEC EPOLL_CLOEXEC sysdeps/unix/sysv/linux/bits/epoll.h: EPOLL_CLOEXEC = 02000000 sysdeps/unix/sysv/linux/bits/epoll.h:#define EPOLL_CLOEXEC EPOLL_CLOEXEC sysdeps/unix/sysv/linux/hppa/bits/epoll.h: EPOLL_CLOEXEC = 010000000 sysdeps/unix/sysv/linux/hppa/bits/epoll.h:#define EPOLL_CLOEXEC EPOLL_CLOEXEC sysdeps/unix/sysv/linux/mips/bits/epoll.h: EPOLL_CLOEXEC = 02000000 sysdeps/unix/sysv/linux/mips/bits/epoll.h:#define EPOLL_CLOEXEC EPOLL_CLOEXEC sysdeps/unix/sysv/linux/sparc/bits/epoll.h: EPOLL_CLOEXEC = 0x400000 sysdeps/unix/sysv/linux/sparc/bits/epoll.h:#define EPOLL_CLOEXEC EPOLL_CLOEXEC sysdeps/unix/sysv/linux/test-errno-linux.c: fails |= test_wrp (EINVAL, epoll_create1, EPOLL_CLOEXEC + 1); sysdeps/unix/sysv/linux/x86/bits/epoll.h: EPOLL_CLOEXEC = 02000000 sysdeps/unix/sysv/linux/x86/bits/epoll.h:#define EPOLL_CLOEXEC EPOLL_CLOEXEC Created attachment 633106 [details, diff]
0001-linux-user-syscall.c-add-target-to-host-mapping-for-.patch
Barnabás, can you try a 0001-linux-user-syscall.c-add-target-to-host-mapping-for-.patch patch to see if python can survive a bit more?
Meanwhile proposed upstream as https://lists.nongnu.org/archive/html/qemu-devel/2020-04/msg02545.html This seems to solve the problem. Nice catch! Works nicely now, thank you! As I see, as a side effect, ppc & sparc targets are also repaired, which are my next planned targets to experiment with. :) ppc -> hppa The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a1b0a5e226c561f876d84210048b1fe3c95f2bb commit 3a1b0a5e226c561f876d84210048b1fe3c95f2bb Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-04-16 22:15:28 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-04-16 22:15:55 +0000 app-emulation/qemu: fix epoll_create1 handling, bug #717548 Recent python started using epoll_create1() which had a bug of missing translation for flags from target to host. Pull upstreamed patch. Reported-by: Barnabás Virágh Closes: https://bugs.gentoo.org/717548 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> .../qemu/files/qemu-4.2.0-epoll_create1.patch | 39 + app-emulation/qemu/qemu-4.2.0-r4.ebuild | 838 +++++++++++++++++++++ 2 files changed, 877 insertions(+) |