mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-29 00:30:59 +00:00
88441f6ec3
A build tree can live on an NFS re-export. The kernel refuses locks on one -- "Clients are not allowed to get file locks or delegations from a reexport server" -- so every flock() there answers errno 524, and a build that takes one dies before it starts. buildrpms.pl's per-target lock and BuildUtils.pm's take_build_lock, which builddebs.pl calls for the Ubuntu core build, are both atomic mkdir claims now. Each records its owner and names it when it refuses. A directory is not released by a filehandle closing, which is how both locks were freed before. buildrpms.pl releases from END, and again in abort_builds because that handler re-raises the signal with DEFAULT and END blocks do not run then -- a killed build would otherwise strand the lock for every later one. BuildUtils returns a small object whose DESTROY releases it, preserving the caller's "hold the returned value" contract. Both releases are guarded by owning pid: both scripts fork, and the flock they replace could not be released by a child. builddebs_lock.t closed the returned value to prove the lock is released, which is "Not a GLOB reference" against the new contract. It now lets the value go out of scope. What it asserts is unchanged: a second build of the same checkout is refused, and the next one succeeds once the first releases. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>