>>> Completed (1 of 1) sys-apps/portage-9999::gentoo * GNU info directory index is up-to-date. # emerge -avuDUgj --with-bdeps=y @world Local copy of remote index is up-to-date and will be used. These are the packages that would be merged, in order: Calculating dependencies... done! Dependency resolution took 24.48 s (backtrack: 1/20). [binary U ] dev-python/markupsafe-2.1.5-1::gentoo [2.1.4::gentoo] USE="-debug -test" PYTHON_TARGETS="python3_11 -pypy3 -python3_10 -python3_12" 70 KiB [binary r U ] app-text/poppler-24.02.0-1:0/134::gentoo [24.01.0:0/133::gentoo] USE="boost cairo cxx introspection jpeg jpeg2k lcms nss png qt5 tiff utils -cjk -curl -debug -doc -gpgme -qt6 -test -verify-sig" 2,640 KiB [binary U ] dev-python/poetry-core-1.9.0-1::gentoo [1.8.1::gentoo] USE="-test" PYTHON_TARGETS="python3_11 -pypy3 -python3_10 -python3_12" 320 KiB [binary rR ] app-text/evince-45.0-1:0/evd3.4-evv3.3::gentoo USE="cups introspection spell tiff -djvu -dvi -gnome -gstreamer -gtk-doc -keyring (-nautilus) -postscript -xps" 2,160 KiB Total: 4 packages (3 upgrades, 1 reinstall, 4 binaries), Size of downloads: 5,190 KiB Would you like to merge these packages? [Yes/No] >>> Emerging binary (1 of 4) dev-python/markupsafe-2.1.5::gentoo >>> Installing (1 of 4) dev-python/markupsafe-2.1.5::gentoo >>> Completed (1 of 4) dev-python/markupsafe-2.1.5::gentoo >>> Failed to install dev-python/markupsafe-2.1.5, Log file: >>> '/var/tmp/portage/dev-python/markupsafe-2.1.5/temp/build.log' >>> Jobs: 0 of 4 complete, 1 failed Load avg: 2.55, 2.17, 2.10 >>> Extracting info * Package: dev-python/markupsafe-2.1.5:0 * Repository: gentoo * USE: kernel_linux amd64 python_targets_python3_11 elibc_glibc abi_x86_64 * FEATURES: network-sandbox preserve-libs sandbox userpriv usersandbox >>> Extracting dev-python/markupsafe-2.1.5 Traceback (most recent call last): File "/usr/lib/portage/python3.11/pid-ns-init", line 181, in <module> sys.exit(main(sys.argv)) ^^^^^^^^^^^^^^ File "/usr/lib/portage/python3.11/pid-ns-init", line 136, in main proc = subprocess.Popen(args, executable=binary, **popen_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.11/subprocess.py", line 1950, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 9] Bad file descriptor * The ebuild phase 'instprep' has exited unexpectedly. This type of * behavior is known to be triggered by things such as failed variable * assignments (bug #190128) or bad substitution errors (bug #200313). * Normally, before exiting, bash should have displayed an error message * above. If bash did not produce an error message above, it's possible * that the ebuild has called `exit` when it should have called `die` * instead. This behavior may also be triggered by a corrupt bash binary or * a hardware problem such as memory or cpu malfunction. If the problem is * not reproducible or it appears to occur randomly, then it is likely to * be triggered by a hardware problem. If you suspect a hardware problem * then you should try some basic hardware diagnostics such as memtest. * Please do not report this as a bug unless it is consistently * reproducible and you are sure that your bash binary and hardware are * functioning properly. !!! instprep failed * Messages for package dev-python/markupsafe-2.1.5: * The ebuild phase 'instprep' has exited unexpectedly. This type of * behavior is known to be triggered by things such as failed variable * assignments (bug #190128) or bad substitution errors (bug #200313). * Normally, before exiting, bash should have displayed an error message * above. If bash did not produce an error message above, it's possible * that the ebuild has called `exit` when it should have called `die` * instead. This behavior may also be triggered by a corrupt bash binary or * a hardware problem such as memory or cpu malfunction. If the problem is * not reproducible or it appears to occur randomly, then it is likely to * be triggered by a hardware problem. If you suspect a hardware problem * then you should try some basic hardware diagnostics such as memtest. * Please do not report this as a bug unless it is consistently * reproducible and you are sure that your bash binary and hardware are * functioning properly. * GNU info directory index is up-to-date. * After world updates, it is important to remove obsolete packages with * emerge --depclean. Refer to `man emerge` for more information.
$ emerge --info Portage 3.0.61_p25 (python 3.11.7-final-0, default/linux/amd64/17.1/desktop, gcc-13, glibc-2.38-r10, 6.7.2 x86_64) ================================================================= System uname: Linux-6.7.2-x86_64-AMD_Ryzen_7_4700U_with_Radeon_Graphics-with-glibc2.38 KiB Mem: 15737392 total, 1139760 free KiB Swap: 33554428 total, 33546236 free Timestamp of repository gentoo: Sun, 04 Feb 2024 07:00:01 +0000 Head commit of repository gentoo: 9a3b10c4e499a87fafd6e2df9c9f87469451014b Timestamp of repository trolltoo: Sat, 27 Jan 2024 17:35:16 +0000 Head commit of repository trolltoo: 60a3e46723683bc3f5dfffc66119c7329491f417 sh bash 5.2_p26 ld GNU ld (Gentoo 2.41 p5) 2.41.0 ccache version 4.9 [disabled] app-misc/pax-utils: 1.3.7::gentoo app-shells/bash: 5.2_p26::gentoo dev-build/autoconf: 2.13-r8::gentoo, 2.72-r1::gentoo dev-build/automake: 1.16.5-r2::gentoo dev-build/cmake: 3.28.2::gentoo dev-build/libtool: 2.4.7-r2::gentoo dev-build/make: 4.4.1-r1::gentoo dev-build/meson: 1.3.1-r1::gentoo dev-lang/perl: 5.38.2-r1::gentoo dev-lang/python: 3.11.7::gentoo, 3.12.1_p1::gentoo dev-lang/rust-bin: 1.74.1::gentoo dev-util/ccache: 4.9::gentoo sys-apps/baselayout: 2.14-r1::gentoo sys-apps/openrc: 0.53::gentoo sys-apps/sandbox: 2.38::gentoo sys-devel/binutils: 2.41-r5::gentoo sys-devel/binutils-config: 5.5::gentoo sys-devel/clang: 17.0.6::gentoo sys-devel/gcc: 13.2.1_p20240113-r1::gentoo sys-devel/gcc-config: 2.11::gentoo sys-devel/lld: 17.0.6::gentoo sys-devel/llvm: 17.0.6::gentoo sys-kernel/linux-headers: 6.7::gentoo (virtual/os-headers) sys-libs/glibc: 2.38-r10::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://192.168.1.151/gentoo-portage priority: -1000 volatile: False sync-rsync-verify-metamanifest: no sync-rsync-verify-max-age: 3 sync-rsync-extra-opts: sync-rsync-verify-jobs: 1 meow location: /var/db/repos/meow masters: gentoo volatile: True trolltoo location: /var/db/repos/trolltoo sync-type: git sync-uri: https://github.com/gentoo-mirror/trolltoo.git masters: gentoo volatile: False Binary Repositories: purr sync-uri: http://192.168.5.55:8080 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -march=native" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -pipe -march=native" DISTDIR="/var/cache/distfiles" EMERGE_DEFAULT_OPTS="--verbose-slot-rebuilds=n" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME" FCFLAGS="-O2 -pipe -march=native" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance binpkg-request-signature binpkg-signing buildpkg buildpkg-live config-protect-if-modified distlocks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe -march=native" GENTOO_MIRRORS="[snip] http://gentoo.osuosl.org/ http://mirrors.rit.edu/gentoo/ http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LEX="flex" MAKEOPTS="-j8" PKGDIR="/var/cache/binpkgs" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" SHELL="/bin/bash" USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cli crypt cups dbus dist-kernel dri dts dvd dvdr elogind encode exif flac fortran gdbm gif gpm gtk gui iconv icu ipv6 jpeg lcms libnotify libtirpc mad mng mp3 mp4 mpeg multilib ncurses nls offensive ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio qt5 readline sdl seccomp sixel sound spell split-usr ssl startup-notification svg test-rust tiff truetype udev udisks unicode upower usb vaapi vdpau vorbis vulkan wxwidgets x264 xattr xcb xft xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="amdgpu radeonsi radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=0e4378fd18bcefde4472c7ae65e99578cf47dce6 commit 0e4378fd18bcefde4472c7ae65e99578cf47dce6 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2024-02-04 07:59:26 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2024-02-04 08:00:31 +0000 Revert "doebuild: Add returnproc parameter and deprecate returnpid" This reverts commit 6aeee45d9b88d7dc8c450ba86975e4b017db203c. It triggered a "Bad file descriptor" during the instprep phase as reported in bug 923755. Bug: https://bugs.gentoo.org/923755 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/_emerge/EbuildMetadataPhase.py | 5 ++-- lib/portage/package/ebuild/doebuild.py | 47 ++++++++-------------------------- 2 files changed, 12 insertions(+), 40 deletions(-)
Thanks for the report! Reverted for now.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=052a4076cdf29fde8481646c636190d9db35f0ff commit 052a4076cdf29fde8481646c636190d9db35f0ff Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2024-02-04 08:08:01 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2024-02-04 08:10:12 +0000 Revert "process.spawn: Use multiprocessing.Process for returnproc" This reverts commit 305612d1b04aa06d3d1a1c8b51d046a644742fd5. It triggered a "Bad file descriptor" during the instprep phase as reported in bug 923755. Bug: https://bugs.gentoo.org/923755 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/_emerge/SpawnProcess.py | 4 +- lib/portage/process.py | 72 ++++------------------ lib/portage/tests/ebuild/test_doebuild_fd_pipes.py | 6 +- 3 files changed, 15 insertions(+), 67 deletions(-)
I also saw the error with 305612d1b04aa06d3d1a1c8b51d046a644742fd5, so I reverted that too: commit 305612d1b04aa06d3d1a1c8b51d046a644742fd5 Author: Zac Medico <zmedico@gentoo.org> Date: 2024-02-03 13:27:45 -0800 process.spawn: Use multiprocessing.Process for returnproc Use multiprocessing.Process for returnproc, so that fork will stop being used when python makes "spawn" the default multiprocessing start method. Continue to use _start_fork when returnproc is not enabled, for backward compatibility. Ultimately, it can be removed at the same time as the returnpid parameter. Bug: https://bugs.gentoo.org/916566 Signed-off-by: Zac Medico <zmedico@gentoo.org>
(In reply to Larry the Git Cow from comment #2) > The bug has been referenced in the following commit(s): > > https://gitweb.gentoo.org/proj/portage.git/commit/ > ?id=0e4378fd18bcefde4472c7ae65e99578cf47dce6 > > commit 0e4378fd18bcefde4472c7ae65e99578cf47dce6 > Author: Zac Medico <zmedico@gentoo.org> > AuthorDate: 2024-02-04 07:59:26 +0000 > Commit: Zac Medico <zmedico@gentoo.org> > CommitDate: 2024-02-04 08:00:31 +0000 > > Revert "doebuild: Add returnproc parameter and deprecate returnpid" > > This reverts commit 6aeee45d9b88d7dc8c450ba86975e4b017db203c. > It triggered a "Bad file descriptor" during the instprep > phase as reported in bug 923755. > > Bug: https://bugs.gentoo.org/923755 > Signed-off-by: Zac Medico <zmedico@gentoo.org> > > lib/_emerge/EbuildMetadataPhase.py | 5 ++-- > lib/portage/package/ebuild/doebuild.py | 47 > ++++++++-------------------------- > 2 files changed, 12 insertions(+), 40 deletions(-) It looks like I reverted 6aeee45d9b88d7dc8c450ba86975e4b017db203c prematurely, since I don't see an error with that and not 305612d1b04aa06d3d1a1c8b51d046a644742fd5.
052a4076cdf29fde8481646c636190d9db35f0ff works
(In reply to Greg Kubaryk from comment #7) > 052a4076cdf29fde8481646c636190d9db35f0ff works Great, thanks for the confirmation. (In reply to Greg Kubaryk from comment #0) > >>> Extracting dev-python/markupsafe-2.1.5 > Traceback (most recent call last): > File "/usr/lib/portage/python3.11/pid-ns-init", line 181, in <module> > sys.exit(main(sys.argv)) > ^^^^^^^^^^^^^^ > File "/usr/lib/portage/python3.11/pid-ns-init", line 136, in main > proc = subprocess.Popen(args, executable=binary, **popen_kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/lib/python3.11/subprocess.py", line 1026, in __init__ > self._execute_child(args, executable, preexec_fn, close_fds, > File "/usr/lib/python3.11/subprocess.py", line 1950, in _execute_child > raise child_exception_type(errno_num, err_msg, err_filename) > OSError: [Errno 9] Bad file descriptor It looks like we probably need more os.set_inheritable calls to make 305612d1b04aa06d3d1a1c8b51d046a644742fd5 work correctly, like the lib/portage/tests/ebuild/test_doebuild_fd_pipes.py change in that commit.
Now my portage is broken and I cant rebuild portage or downgrade to release. >>> Completed installing sys-apps/portage-9999 into /var/tmp/portage/sys-apps/portage-9999/image * Final size of build directory: 15668 KiB (15.3 MiB) * Final size of installed tree: 43780 KiB (42.7 MiB) * Verifying compiled files for python3.11 * Verifying compiled files for python3.12 strip: x86_64-pc-linux-gnu-strip --strip-unneeded -N __gentoo_check_ldflags__ -R .comment -R .GCC.command.line -R .note.gnu.gold-version /usr/lib/python3.11/site-packages/portage/util/_whirlpool.cpython-311-x86_64-linux-gnu.so /usr/lib/python3.11/site-packages/portage/util/libc.cpython-311-x86_64-linux-gnu.so /usr/lib/python3.11/site-packages/portage/util/file_copy/reflink_linux.cpython-311-x86_64-linux-gnu.so /usr/lib/python3.12/site-packages/portage/util/libc.cpython-312-x86_64-linux-gnu.so /usr/lib/python3.12/site-packages/portage/util/_whirlpool.cpython-312-x86_64-linux-gnu.so /usr/lib/python3.12/site-packages/portage/util/file_copy/reflink_linux.cpython-312-x86_64-linux-gnu.so Traceback (most recent call last): File "/var/tmp/portage/._portage_reinstall_.tm28cyov/bin/pid-ns-init", line 181, in <module> sys.exit(main(sys.argv)) ^^^^^^^^^^^^^^ File "/var/tmp/portage/._portage_reinstall_.tm28cyov/bin/pid-ns-init", line 136, in main proc = subprocess.Popen(args, executable=binary, **popen_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.12/subprocess.py", line 1950, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 9] Bad file descriptor * The ebuild phase 'instprep' has exited unexpectedly. This type of * behavior is known to be triggered by things such as failed variable * assignments (bug #190128) or bad substitution errors (bug #200313). * Normally, before exiting, bash should have displayed an error message * above. If bash did not produce an error message above, it's possible * that the ebuild has called `exit` when it should have called `die` * instead. This behavior may also be triggered by a corrupt bash binary or * a hardware problem such as memory or cpu malfunction. If the problem is * not reproducible or it appears to occur randomly, then it is likely to * be triggered by a hardware problem. If you suspect a hardware problem * then you should try some basic hardware diagnostics such as memtest. * Please do not report this as a bug unless it is consistently * reproducible and you are sure that your bash binary and hardware are * functioning properly. !!! instprep failed [ebuild UD ] sys-apps/portage-3.0.61-r1::gentoo [9999::gentoo] USE="(ipc) native-extensions rsync-verify xattr -apidoc -build -doc -gentoo-dev (-selinux) -test" PYTHON_TARGETS="python3_11 python3_12 -pypy3 -python3_10" 1.151 KiB Total: 1 package (1 downgrade), Size of downloads: 1.151 KiB Would you like to merge these packages? [Yes/No] >>> Verifying ebuild manifests >>> Running pre-merge checks for sys-apps/portage-3.0.61-r1 * Determining the location of the kernel source code * Found kernel source directory: * /usr/src/linux * Found sources for kernel version: * 6.8.0-rc2 * Checking for suitable kernel configuration options ... [ ok ] Traceback (most recent call last): File "/var/tmp/portage/._portage_reinstall_.u2bm4myz/bin/pid-ns-init", line 181, in <module> sys.exit(main(sys.argv)) ^^^^^^^^^^^^^^ File "/var/tmp/portage/._portage_reinstall_.u2bm4myz/bin/pid-ns-init", line 136, in main proc = subprocess.Popen(args, executable=binary, **popen_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.12/subprocess.py", line 1950, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 9] Bad file descriptor >>> Emerging (1 of 1) sys-apps/portage-3.0.61-r1::gentoo Traceback (most recent call last): File "/var/tmp/portage/._portage_reinstall_.u2bm4myz/bin/pid-ns-init", line 181, in <module> sys.exit(main(sys.argv)) ^^^^^^^^^^^^^^ File "/var/tmp/portage/._portage_reinstall_.u2bm4myz/bin/pid-ns-init", line 136, in main proc = subprocess.Popen(args, executable=binary, **popen_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.12/subprocess.py", line 1950, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 9] Bad file descriptor >>> Failed to emerge sys-apps/portage-3.0.61-r1 How to repair?
(In reply to jospezial from comment #9) > Now my portage is broken and I cant rebuild portage or downgrade to release. > > >>> Completed installing sys-apps/portage-9999 into /var/tmp/portage/sys-apps/portage-9999/image > FEATURES="-ipc-sandbox -pid-sandbox" emerge -v1 portage
(In reply to jospezial from comment #9) > How to repair? Personally, I did: git diff -p -b 6aeee45d9b8.. |sed -e 's^/lib/^/^g' > ~/fixportage.patch cd /usr/lib/python3.11/site-packages patch -p1 < ~/fixportage.patch but it's potentially gonna depend what commit you were at previously ...and Sam's method is way easier
fwiw I'd be prepared to do what kurly did in future, it's just that in this case, there's a nice workaround
I found https://wiki.gentoo.org/wiki/Project:Portage/Fixing_broken_portage based on that I did: cd /var/tmp/portage/sys-apps/portage-9999/work/portage-9999/bin export PYTHONPATH="/var/tmp/portage/sys-apps/portage-9999/work/portage-9999/lib${PYTHONPATH:+:}${PYTHONPATH}" export PATH="/var/tmp/portage/sys-apps/portage-9999/work/portage-9999/bin:${PATH}" emerge -va1 "<portage-9999" That worked. After logout and login into the shell to let it forget the exported PATH variables all is normal again. sys-apps/portage-9999 is also working now.
(In reply to jospezial from comment #13) > I found https://wiki.gentoo.org/wiki/Project:Portage/Fixing_broken_portage Yeah, that's a great approach. I've found that marking fd_pipes as inheritable just after fork solves the problem, but I think I might add a wrapper target function to do this just for _start_proc since it's only really needed when we exec for spawn: --- a/lib/portage/util/_async/ForkProcess.py +++ b/lib/portage/util/_async/ForkProcess.py @@ -244,4 +244,9 @@ class ForkProcess(SpawnProcess): @staticmethod def _bootstrap(child_connection, have_send_handle, fd_pipes, target, args, kwargs): + if fd_pipes: + # Ensure fd_pipes are inherited for bug 923755. + for fd in set(fd_pipes.values()): + os.set_inheritable(fd, True) + # Use default signal handlers in order to avoid problems # killing subprocesses as reported in bug #353239.
This works nicely: --- a/lib/portage/process.py +++ b/lib/portage/process.py @@ -1387,2 +1387,14 @@ def _start_fork( +class _setup_pipes_after_fork: + def __init__(self, target, fd_pipes): + self._target = target + self._fd_pipes = fd_pipes + + def __call__(self, *args, **kwargs): + for fd in set(self._fd_pipes.values()): + os.set_inheritable(fd, True) + _setup_pipes(self._fd_pipes, close_fds=False, inheritable=True) + return self._target(*args, **kwargs) + + def _start_proc( @@ -1407,2 +1419,9 @@ def _start_proc( + # Manage fd_pipes inheritance for spawn/exec (bug 923755), + # which ForkProcess does not handle because its target + # function does not necessarily exec. + if fd_pipes and multiprocessing.get_start_method() == "fork": + target = _setup_pipes_after_fork(target, fd_pipes) + fd_pipes = None + proc = ForkProcess(
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=a69c1b853a47346192950c91b088163490287350 commit a69c1b853a47346192950c91b088163490287350 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2024-02-03 21:27:45 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2024-02-07 00:49:26 +0000 process.spawn: Use multiprocessing.Process for returnproc Use multiprocessing.Process for returnproc, so that fork will stop being used when python makes "spawn" the default multiprocessing start method. Continue to use _start_fork when returnproc is not enabled, for backward compatibility. Ultimately, it can be removed at the same time as the returnpid parameter. The _setup_pipes_after_fork wrapper prevents a "Bad file descriptor" error by making fd_pipes inheritable on exec for bug 923755. ForkProcess does not handle this because its target function does not necessarily exec. Bug: https://bugs.gentoo.org/916566 Bug: https://bugs.gentoo.org/923755 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/_emerge/SpawnProcess.py | 4 +- lib/portage/process.py | 92 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 82 insertions(+), 14 deletions(-)