2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-21 01:42:15 +00:00

fix(xcat-core): a build lock records process group 1 and refuses every later build

xcat_pr_test fails in release_repository.t with "retained for surviving
build workers in process group 1". The schedule stub in that test
returns 1 from Parallel::ForkManager::start. start_build_worker()
accepted ESRCH from setpgid() and recorded group 1 on the build lock.
Group 1 is always alive, so the next buildrpms.pl run in the same lock
directory is refused.

ESRCH means the pid is not a child of this process. The gated child, if
there is one, has not run, so start_build_worker() now records nothing
and reports failure. It also no longer writes to a gate that no child
reads.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-30 10:02:19 -03:00
parent 96819b24aa
commit 11b0e08ab2
+3 -2
View File
@@ -793,8 +793,9 @@ sub start_build_worker {
}
close($gate_r);
# Both sides set the group, so the record never names a pid that is not yet a group leader.
# ESRCH means the child has already gone away.
my $ok = (POSIX::setpgid($pid, $pid) || $!{EACCES} || $!{ESRCH}) ? 1 : 0;
# ESRCH means the pid is not a child of this process. A record of that group can keep the
# lock forever, and the gated child has not run, so record nothing.
my $ok = (POSIX::setpgid($pid, $pid) || $!{EACCES}) ? 1 : 0;
$ok = attach_build_workers($pid) if $ok;
$ok = 0 if $ok && (syswrite($gate_w, 'g') // 0) != 1;
close($gate_w);