Hi Ludovic, Ludovic Courtès <l...@gnu.org> writes:
> Fixes <https://issues.guix.gnu.org/30948>. > > * guix/build/gnu-build-system.scm (separate-from-pid1): New procedure. > (%standard-phases): Add it. > * guix/build-system/gnu.scm (gnu-build): Add #:separate-from-pid1? and > honor it. > (gnu-cross-build): Likewise. > > Reported-by: Carlo Zancanaro <ca...@zancanaro.id.au> > Change-Id: I6f3bc8d8186d1a571f983a38d5e3fd178ffa2678 > --- > guix/build-system/gnu.scm | 4 ++++ > guix/build/gnu-build-system.scm | 39 ++++++++++++++++++++++++++++++++- > 2 files changed, 42 insertions(+), 1 deletion(-) > > Hi! > > This is a second attempt I’m currently testing as part of an > initially unrelated ‘core-updates’ series: > > https://issues.guix.gnu.org/67824 > > The principle is simple: if the build process runs as PID 1, fork > so that PID 1 does nothing but call ‘waitpid’ in a loop while the > actual build process runs as PID 2. > > This is simple and robust. The code is written in a defensive way > as an extra phase that can be disabled. > > Thoughts? I haven't yet looked at the code, but looking at the bigger picture, wouldn't it be a useful behavior to have for Guile itself? Perhaps not, as there already exists a Guile init manager (GNU Shepherd), but if it's something relatively simple/compact to implement, perhaps it could find its place in Guile itself, just like Bash implements correctly signal handling when used as a PID 1 (if I'm not mistaken). -- Thanks, Maxim