summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@parabola.nu>2024-02-20 18:05:04 -0700
committerLuke T. Shumaker <lukeshu@parabola.nu>2024-02-20 22:09:26 -0700
commitd89a0bc943525865b964f981a2bdcd3a7771dc2d (patch)
treed70935daeedf5131369a11ec75c85968956aa5b4
parentb4e4d4a9423fed78c97ed7f36da3f1f61d64f836 (diff)
fix: libremakepkg: Fix distcc TCP support
When leaving the fakeroot environment, the build fails with something like kill: sending signal to 694 failed: No such process /usr/bin/fakeroot: line 178: 686 User defined signal 1 FAKEROOTKEY=$FAKEROOTKEY LD_LIBRARY_PATH="$PATHS" LD_PRELOAD="$FAKEROOT_LIB" "$@" What's happening is that: 1. the main makepkg process launches the `distcc-tool ideaemon`, which binds to the TCP ports 2. then, the inferior in-fakeroot makepkg process tries to launch its own `distcc-tool idaemon`, which immediately fails in the background because it can't bind to those TCP ports. 3. Then, when the inferior in-fakeroot makepkg process exits it tries to clean up after itself by `kill`ing the idaemon pid. This fails because that pid died long ago. I'm not entirely sure what broke it--I think either makepkg didn't used to re-load makepkg.conf when entering the fakeroot environment, or Bash `jobs -p` didn't used to list jobs that had terminated but hadn't been `wait`ed for? IDK. Actually, the Bash one seems more likely. Anyway, fix this by only launching the idaemon from the parent makepkg process.
-rw-r--r--src/chroot-tools/hooks-distcc.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/chroot-tools/hooks-distcc.sh b/src/chroot-tools/hooks-distcc.sh
index b19c223..414696e 100644
--- a/src/chroot-tools/hooks-distcc.sh
+++ b/src/chroot-tools/hooks-distcc.sh
@@ -1,5 +1,5 @@
#!/hint/bash -euE -o pipefail
-# Copyright (C) 2013, 2017-2018 Luke Shumaker <lukeshu@parabola.nu>
+# Copyright (C) 2013, 2017-2018, 2024 Luke Shumaker <lukeshu@parabola.nu>
#
# License: GNU GPLv2+
#
@@ -75,9 +75,11 @@ distcc_start_odaemon() {
rewritten_DISTCC_HOSTS=$("$_distcc_tool" rewrite "${DISTCC_HOSTS:-}")
install -Dm644 /dev/stdin "$home/.config/pacman/makepkg.conf" <<-eot
- trap 'jobs -p | xargs -r kill --' EXIT
- /bin/distcc-tool idaemon ${DISTCC_HOSTS@Q} </dev/null &>/dev/null &
- DISTCC_HOSTS=${rewritten_DISTCC_HOSTS@Q}
+ if [[ \${INFAKEROOT:-} == 0 ]]; then
+ trap 'jobs -p | xargs -r kill --' EXIT
+ /bin/distcc-tool idaemon ${DISTCC_HOSTS@Q} </dev/null &>/dev/null &
+ DISTCC_HOSTS=${rewritten_DISTCC_HOSTS@Q}
+ fi
eot
install -Dm644 /dev/stdin "$home/.ssh/config" <<-'eot'