From: DaanDeMeyer Date: Wed, 24 Dec 2025 08:35:39 +0000 (+0100) Subject: run: Remove hack to keep packed file descriptors intact X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86edbcba5985bab1c3a50d3cfa48470e9995c046;p=thirdparty%2Fmkosi.git run: Remove hack to keep packed file descriptors intact Now that we execute execvp() in the preexec function and therefore skip python's close file descriptors logic, we don't need our hack anymore to tell python the right file descriptors to close so let's drop it. --- diff --git a/mkosi/run.py b/mkosi/run.py index eac2d05c8..986b59127 100644 --- a/mkosi/run.py +++ b/mkosi/run.py @@ -20,7 +20,7 @@ from typing import TYPE_CHECKING, Any, Callable, Generic, NoReturn, Optional, Pr import mkosi.sandbox from mkosi.log import ARG_DEBUG, ARG_DEBUG_SANDBOX, ARG_DEBUG_SHELL, die -from mkosi.sandbox import SD_LISTEN_FDS_START, acquire_privileges, joinpath, umask +from mkosi.sandbox import acquire_privileges, joinpath, umask from mkosi.util import _FILE, PathString, flatten, one_zero, resource_path, unique # These types are only generic during type checking and not at runtime, leading @@ -283,14 +283,7 @@ def spawn( text=True, user=user, group=group, - # Python closes file descriptors after calling the preexec function. Hence we need to tell it - # to keep the packed file descriptors intact instead of the original ones if --pack-fds is - # used. - pass_fds=( - range(SD_LISTEN_FDS_START, SD_LISTEN_FDS_START + len(pass_fds)) - if apply_sandbox_in_preexec and "--pack-fds" in sbx - else pass_fds - ), + pass_fds=pass_fds, env=env if not sbx or not apply_sandbox_in_preexec else None, preexec_fn=_preexec, )