Summary: | sys-apps/portage: File merging is ultra-slow on FreeBSD | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Michał Górny <mgorny> |
Component: | Core | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | floppym |
Priority: | Normal | Keywords: | InVCS |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 835380, 651804 |
Description
Michał Górny
![]() ![]() ![]() ![]() What does /dev/fd/ look like on FreeBSD? Nevermind, that's been thought of before:
> # /dev/fd does not work on FreeBSD, see bug #478446
> if platform.system() in ('FreeBSD',) and _fd_dir == '/dev/fd':
> _fd_dir = None
We could make close_fds default to False for python3.4 and later, since most file descriptors are not inherited by default: https://www.python.org/dev/peps/pep-0446/ Patch posted for review: https://archives.gentoo.org/gentoo-portage-dev/message/2360a4c40ab4f89d6a51ebc3f9da8f7c https://github.com/gentoo/portage/pull/258 The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=c01fdd27473a76d1c8b6edb1b9dfb2c29645b1c2 commit c01fdd27473a76d1c8b6edb1b9dfb2c29645b1c2 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2018-02-22 02:44:06 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2018-02-22 17:30:27 +0000 emerge/ebuild: sanitize file descriptors on startup In order to ensure that any unintentionally inherited file descriptors will not be inherited by child processes, set the inheritable flag to False on startup, except for those corresponding to stdin, stdout, and stderr. This mitigates potential problems that might result from making the portage.process.spawn close_fds parameter default to False for versions of python with PEP 446 support. Bug: https://bugs.gentoo.org/648432 bin/ebuild | 2 ++ bin/emerge | 1 + pym/portage/process.py | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+) https://gitweb.gentoo.org/proj/portage.git/commit/?id=d3778a92be0ac4a22eb61e3affdc85f99337847a commit d3778a92be0ac4a22eb61e3affdc85f99337847a Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2018-02-21 23:14:44 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2018-02-22 17:30:26 +0000 portage.process.spawn: default close_fds=False (bug 648432) For python3.4 and later, default to close_fds=False, since file descriptors are non-inheritable by default due to PEP 446. This solves a performance problem on systems like FreeBSD, where our get_open_fds function returns all possible file descriptor values (including those that are not open). Bug: https://bugs.gentoo.org/648432 See: https://www.python.org/dev/peps/pep-0446/ pym/portage/process.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)} We also have a patch to use os.chflags: https://archives.gentoo.org/gentoo-portage-dev/message/f8f45bf3529dc4ecc3c885a26e2a28f9 The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=39c797992bcdf8403521d8b61bb3e592135b3307 commit 39c797992bcdf8403521d8b61bb3e592135b3307 Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2018-02-22 15:04:52 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2018-02-22 19:13:43 +0000 FreeBSD: use os.*chflags() instead of calling external tool Use os.chflags() and os.lchflags() built-in functions instead of calling external 'chflags' tool on FreeBSD. This fixes major performance problems Portage has on FreeBSD. Bug: https://bugs.gentoo.org/648432 Reviewed-by: Zac Medico <zmedico@gentoo.org> pym/portage/__init__.py | 50 +++---------------------------------------------- 1 file changed, 3 insertions(+), 47 deletions(-)} Fixed in portage-2.3.40-r1. |