mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-20 17:32:15 +00:00
583fa72b44
BuildUtils::sh() runs each build command in its own process group, so SIGKILL on the wrapper leaves that group running. The lock records the wrapper, so the next build proved the wrapper dead and took the lock, and two builds then wrote one checkout and one mock target. cancel_build keeps the lock on purpose when a group survives its cleanup, and that recovery undid the retention. sh() now records the group on every lock this process holds, before it restores the signal mask, so a cancellation cannot land between the fork and the record. It drops the record after the group is reaped. cancel_build drops it only when kill(0, -pgid) answers ESRCH, which is the test it already used to decide it may release; on the retention path the record stays, and a later acquire reads it and refuses the lock. The vendored XCAT::NFSLock carries the rule: an owner is recoverable only when it is provably dead and every attached group is gone. detach refuses while any process is in the group, so the retention does not depend on which call site remembered to run. Depends on xcat-dep/#93, which carries the same change to the original. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>