2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2026-11-30 06:12:16 +00:00
Commit Graph

1201 Commits

Author SHA1 Message Date
Daniel Hilst 2fa0e8b1c8 fix(nfslock): a dead owner does not mean the work it started has stopped
The ownership identity is one process, and what a lock protects outlives
it. A build wrapper starts each command in its own process group, so
SIGKILL on the wrapper leaves that group running. acquire proved the owner
dead and took the lock, and two builds then wrote one checkout. The build
wrapper's own cancellation path keeps the lock when a group survives
cleanup, and this recovery undid that retention: it read a dead owner and
took the lock the retention had kept.

A holder now ATTACHES each process group it starts and DETACHES it once
the group is gone. attach records lock.d/workers/<pgid>.<leader pstart>.
An owner is recoverable only when it is provably dead AND every attached
group is gone, so the retention is a fact recovery reads rather than a
directory it has to guess about.

A group is gone only when kill(0, -pgid) answers ESRCH, which is the test
the cancellation path already uses before it releases. The two now agree.
Reaping the LEADER is not enough, because its children inherit the group,
so the test is on the group and not on the leader's pid. detach applies the
same test and refuses while any process is in the group.

Reuse windows. The entry name carries the leader's start time, so removing
a record by name cannot remove that of a later group which reused the pgid.
The group test itself cannot tell a recycled pgid from the original group
and reads live for both, which costs a wait rather than admitting a second
writer. Neither can tell a worker that left its group by calling setpgid
itself; the cancellation path has the same limit, and the two agree.

An exclusive claim on the root does not override a live group. The claim
asserts no build is running, and a live group is evidence that one is.

release drops the records of groups that are gone and keeps the rest, so a
worker killed before its reap cannot make a lock unreleasable, and a live
one stops the release because rmdir refuses a non-empty directory.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 14:43:01 -03:00
Daniel Hilst 429d993d54 test(xcat-dep): nothing shows that a dead owner's workers still hold the lock
The ownership identity is one process. What a lock protects outlives it: a
build wrapper starts each command in its OWN process group, so SIGKILL on
the wrapper leaves that group running. An owner proven dead therefore says
nothing about the work it started, and recovery admits a second writer. No
check covered it, because every holder the existing checks kill has no
worker under it.

attach, detach and live_workers arrive here with the checks that drive
them. A caller records each process group it starts, and a group is gone
only when kill(0, -pgid) answers ESRCH, which is the test the build
wrapper's own cancellation path already uses before it releases.

BOTH halves are asserted, and the second is the one that keeps the first
honest: a lock that recovers nothing at all satisfies "the second build
stays blocked" perfectly. So the worker exits and the same lock must then
be recovered.

Three more checks pin what "the group" means. A group outlives its leader,
because children inherit it, so a check reaps the leader and asserts the
group still counts as live. detach must refuse while any process is in the
group, which makes the retention a property of what is on disk rather than
of which call site remembered to run. And an exclusive claim on the root
does not override a live group: the claim asserts no build is running, and
a live group is evidence one is.

Against the unfixed predicate 8 of the 75 checks fail.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 14:42:17 -03:00
Daniel Hilst af2a271fdd fix(nfslock): reclaiming a borrow by path can put two processes in one lock
_reap_borrow validated a borrow's metadata and then removed the borrow by
path. rmdir names a path and not the inode that was validated, so a
contender stopped between the two steps removes whatever is at the path
when it resumes. Measured: it validated inode 157 and removed inode
33554970, a borrow a live taker held. Both contenders then took the lock,
and the ordered pair of children in the test reports 11 where it must
report 01.

The borrow is now numbered. lock.borrow is generation 0 and lock.borrow.N
is generation N, the taker is whoever holds the highest generation, and a
transition whose taker is provably dead is ended by creating the NEXT
generation rather than by removing the one that was validated. mkdir is
exclusive, so one contender wins a generation, and a process removes only
a generation it created and still holds. No process can delete another
process's claim, which is the property the old shape could not have.

The rule that reclaimed a borrow with no metadata, when two attempts found
it unchanged, is withdrawn. Its argument covered a healthy participant, not
one that pauses: a live taker can wait any length of time between its mkdir
and its first write, and superseding it puts two processes in the
transition. A generation with no valid metadata now blocks, and
sweep_stranded removes it under an exclusive claim on the root, which is
the disposition a lock.d with no metadata already has.

acquire set identity before writing the replacement lock metadata. A write
that left partial metadata and threw therefore gave DESTROY a lock to
release, and release retried for ever because lock.d existed and its
metadata could not be validated. identity is now set only after that write
succeeds, so a failed acquire leaves the destructor nothing to act on, and
release stops after R retries.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 13:35:38 -03:00
Daniel Hilst 5018b90829 test(xcat-dep): nothing shows that reclaiming a borrow keeps one taker
_reap_borrow validates a borrow and then removes it by path. rmdir names a
path, not the inode that was validated, so a contender stopped between
those two steps removes whatever is at the path when it resumes. That can
be a live taker's borrow, and two processes then take over one lock. No
check covered it, because the existing ones drive one process at a time.

The new checks fork Perl children and stop them at named points in the
protocol, through an _at hook this commit adds to the module. The
interleaving is a pipe barrier and not a delay, so a fast machine cannot
hide the defect, and every child is reaped with its stdio detached. A
contender that validated the borrow is released only after another one
holds it, which is the order that reaches the defect: released together,
the two race one mkdir, which is exclusive either way.

A second check covers a live taker that has not written its metadata yet.
An earlier revision reclaimed a borrow that two attempts found unchanged,
and that rule cannot cover this case, because a live participant can pause
for any length of time between two writes.

Two more cover the destructor. An acquire whose commit write fails must
return that write error and leave nothing for DESTROY to clean up, and
release must stop after R retries rather than wait for metadata that
cannot be validated. The sleep stub is capped, so a retry loop that lost
its bound fails a named check instead of hanging the suite.

Against the unfixed protocol 17 of the 56 checks fail, the ordered pair
reporting that both contenders took the lock.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 13:35:25 -03:00
Daniel Hilst 899f4fe250 test(xcat-dep): seven checks match a lock refusal that no longer reads that way
The refusal said "Trying to unlock <path> failed after N retries", which is
the reverse of what acquire was doing, and the previous commit changed it
to "Cannot lock <path>: still held after N retries by <owner>". Seven
checks in t/genesis_openembedded_consumer.t and native/openeuler-srpm.t
match the old text, so the CI failed on five of them; the two in
native/openeuler-srpm.t are in a block the earlier run did not reach.

One of the seven is an unlike(). It passed for the wrong reason, because
the pattern it refuses to see cannot appear any more, so it also names the
lock it must not report.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 10:37:16 -03:00
Daniel Hilst 56e28d4dbb fix(nfslock): a borrow with no metadata strands its lock for ever
The borrow now carries metadata, so a taker that dies holding one is
recovered. A borrow with NO metadata is not: _reap_borrow returns
"invalid", acquire skips steps 4 to 7 for as long as the borrow exists, and
the dead owner is never evicted. That is the state the earlier protocol
left, because it wrote nothing into the borrow, and the state a death
between mkdir and the first write leaves today. Every later acquire waits
out its retries and tells the operator to remove the lock by hand.

No participant holds a metadata-less borrow for longer than two file reads,
and two attempts of one acquire are at least T seconds apart, so a
metadata-less borrow that both attempts find unchanged is held by nobody.
_reap_borrow removes that one. A borrow whose metadata file exists but does
not validate may be a half-finished write and is still left alone.

A lock.d with no metadata is a separate case. The build lock in xcat-core
wrote none and held lock.d for the whole build, so no fact on disk tells
that holder from a dead one, and acquire must keep refusing it.
sweep_stranded removes it, and only with exclusive => 1, where the caller
has already claimed the root and no build can be running.

The refusal said "Trying to unlock <path> failed", which is the reverse of
what it was doing, and gave a caller nothing to distinguish an exhausted
retry budget from a mkdir that failed outright. It now reads "Cannot lock
<path>: still held after N retries by <owner>".

The Copies header called the xcat-dep path "this file, the original",
which is false in the two copies that vendor it, and it did not say where
sweep_stranded is called from.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 10:19:48 -03:00
Daniel Hilst b944a19782 test(xcat-dep): nothing proves a borrow with no metadata is ever reclaimed
t/nfslock_borrow_recovery.t asserts that a borrow with no metadata is NOT
reclaimed, and t/nfslock.t stages one to prove a lock under another
borrower is left alone. Both describe the permanent strand: the earlier
protocol wrote no metadata into the borrow, so a taker killed there made
the lock unacquirable for ever and no check objected.

The protocol holds a metadata-less borrow for the time of two file reads,
so one that two attempts find unchanged is held by nobody. The checks now
assert that it is reclaimed, that a borrow touched between the attempts is
not, and that a borrow whose metadata file exists but does not validate is
not either - a half-finished write is still a partial read.

A lock.d with no metadata is a different case and stays refused. Checks for
it name the one condition under which the sweeper removes it, the caller's
exclusive claim on the root.

t/nfslock.t's live-borrower fixture now gives the borrow a live taker,
which is what the lock must not be taken from.

release returns early unless this process took the lock, so a forked child
cannot free its parent's. No check covered that, and one now does.

The workflow ran t/nfslock.t and not t/nfslock_borrow_recovery.t, so the
new file was never run by the CI at all. It is on the list now.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 10:18:35 -03:00
Daniel Hilst ba87367a7b fix(xcat-dep): a taker that dies holding lock.borrow blocks the lock for ever
Step 3 of the NFS lock protocol is mkdir(lock.borrow) and nothing recovers that
directory. A take-over killed between step 3 and step 7 leaves it behind, so
every later acquire fails step 3, skips steps 4 to 7, never evicts the dead
owner, and ends by telling the operator to remove the lock by hand. Assumption
5 made this impossible by fiat; Jenkins SIGTERM and the OOM-killer make it
routine.

The borrow now carries the same metadata as the lock, written before the death
check, which is where a signal lands. A borrow whose metadata proves its taker
dead is removed and the acquire retries; one that names a live process, or that
cannot be validated, is left alone. So the rule that recovers a dead owner now
recovers a dead taker, and staleness is still never inferred from metadata that
cannot be validated. release takes the same two steps at step 9, where a killed
taker blocked the release instead.

A guard also never released at scope exit, because the module had no DESTROY.
The lock was then held to the end of the process and no take-over could recover
it either, its owner being alive. Every caller here keeps its guards in an array
for that reason, which hid the leak. release now returns early unless this
acquisition holds the lock, because acquire blesses the object before it holds
anything and an acquire that dies would otherwise enter the wait loop in
release and never leave it.

sweep_stranded moves here from the xcat-core-ci-cd copy, which had it alone, so
the hole it covers stayed open in this copy and in xcat-core's. Its matcher read
'.lock' and '.lock.borrow', which covered mockbuild-all.pl's cell locks and
missed cluster-test.pl's .build.lock.d and sbuild-all.pl's
.sbuild-all.<arch>.nfslock. It now matches all three spellings. A borrow the
earlier protocol left carries no metadata, so the sweeper remains the only way
to clear those.

The header records that three repos vendor this file and that the copies must
stay identical.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 07:29:16 -03:00
Daniel Hilst 82b3c04a73 test(xcat-dep): nothing proves a lock recovers from a taker that died holding lock.borrow
Assumption 5 of the protocol says a process cannot die while it holds
lock.borrow. Under the CI it does: Jenkins sends SIGTERM and the OOM-killer
sends SIGKILL. Step 3 is mkdir(lock.borrow), so a borrow left by a killed
take-over skips steps 4 to 7 for every later acquire. The lock then names a
dead owner that is never evicted, and acquire ends by telling the operator to
remove the lock by hand. A dead OWNER recovered in milliseconds while a dead
TAKER never did, and no test covered the second case.

These checks stage a lock whose owner is dead beside a borrow whose taker is
dead, and assert the lock is recovered. Three more hold the boundary: a borrow
whose taker is alive is left alone, a borrow with no metadata is not assumed
stale, and the borrow a take-over creates carries metadata that names it.

A second group covers sweep_stranded against the lock names this project uses,
including a live owner and another machine that must survive the sweep. A third
asserts that a guard releases when it goes out of scope.

Two red proofs are the narrow forms, not a missing subroutine: with
sweep_stranded present and its matcher reading '.lock' alone, the checks for
.lock.d, .lock.d.borrow and .nfslock fail; with DESTROY removed, the two
scope checks fail while their control passes.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 07:29:16 -03:00
Daniel Hilst c8e3c6b3d7 Merge pull request #91 from VersatusHPC/feature/uftp-openeuler
feat(uftp): build uftp for the openEuler targets
2026-10-21 15:50:07 -03:00
Daniel Hilst df7266095e Merge pull request #90 from VersatusHPC/feature/uftp
feat(uftp): package UFTP 5.0.4 for EL and Ubuntu
2026-10-21 15:07:16 -03:00
Vinícius Ferrão 4e5c72bbb5 test(uftp): require uftp in every openEuler target
Every openEuler section of packages-manifest.conf must list uftp. The
ppc64le section is no longer exempt from the package parity check with
the EL10 ppc64le section, so its native input catalog must declare an
owner for uftp.

native/uftp-openeuler.t runs mockbuild-all.pl --dry-run and checks that
an openEuler target plans the uftp builder in its own mock config, and
only when its manifest section lists uftp. CI runs it with the other
native tests.
2026-10-21 11:39:14 -03:00
Vinícius Ferrão 48dac0217a feat(uftp): build uftp for the openEuler targets
The openEuler targets did not build uftp, and openEuler does not ship
UFTP, so xCAT could not distribute openEuler stateless images over UFTP.

The native openEuler profile of mockbuild-all.pl now runs the uftp
builder, and every openEuler section of packages-manifest.conf lists
uftp=5.0.4. The ppc64le target resolves its manifest through the native
input catalog, so the catalog declares uftp as an owner that builds as
UID 1000, like ipmitool-xcat, and the catalog loader accepts that owner.

The spec needs gcc, make and openssl-devel, which the OS repository of
every openEuler release has. That is the only repository of the ppc64le
target. The 20.03 and 22.03 builds link OpenSSL 1.1.1.
2026-10-21 11:39:14 -03:00
Vinícius Ferrão 178fb7bc97 docs(uftp): describe how to move the fixes to a new UFTP release
BUILD.md did not say how to carry uftp/00*.patch to a new UFTP release.
Describe how to rebase the patches onto the new release in git, drop the
fixes that it carries, replace the patches and their deb links, and
update the files that name the version.
2026-10-21 11:34:50 -03:00
Vinícius Ferrão 6bb7eb4a28 test(uftp): require uftp in every Ubuntu target and match its changelog
Every target section of debs-manifest.conf must list uftp, and its pin
must match uftp/debian/changelog. CI compiles uftp/sbuild.pl and runs
perlcritic on it.
2026-10-21 11:34:50 -03:00
Vinícius Ferrão 2d160623d4 feat(uftp): build the uftp deb for every Ubuntu target
Ubuntu ships UFTP 4.10, which does not work with a UFTP 5 sender or
receiver. sbuild-all.pl now builds uftp 5.0.4-1 from the same archive
and fixes for focal, jammy, noble and resolute, on amd64, ppc64el and
riscv64, and debs-manifest.conf pins it for every target.

The deb installs no service. It replaces the Ubuntu uftp package, and
removes the init script and the logrotate file of that package, which
would start uftpd at boot. The smoke runs key generation in the target
chroot and checks that uftpd is UFTP 5.0.4 with the xCAT build mark.
2026-10-21 11:34:50 -03:00
Vinícius Ferrão 6743296d4d test(uftp): require uftp in every EL target and test the UFTP fixes
Fail when an EL section of packages-manifest.conf lacks uftp, which
BUILD.md documents for every EL target. CI now compiles
uftp/mockbuild.pl, parses uftp.spec and runs perlcritic on the builder.

native/uftp-fixes.t builds the sender, the receiver and the proxy from
the archive and the patches with AddressSanitizer, and gives the
functions that handle each fixed message the message that broke them. It
checks that each client list of the proxy fits in its packet buffer, and
that the proxy forwards the NAKs of plain, TFMCC and short client STATUS
messages in a whole NAK list. It sends the receiver files with short,
repeated and lost blocks, file names that try to leave the destination
directory, and names of that directory itself, then checks the files on
disk. It also covers a file with more sections than the protocol holds,
a seek of the sender past block 2^31, a group with more than 10000
entries, and the STATUS of the receiver for a full section. It ends a
group after another group replaced its file or changed its path, and a
restarted group after it changed the path of its unused file. It backs
up files below a symbolic link in the backup directory, and along a
backup path longer than 300 bytes. The built programs must carry the
xCAT build mark. CI runs it with the native tests and installs the
compiler and the OpenSSL headers for it.
2026-10-21 11:34:49 -03:00
Vinícius Ferrão 45aecc07cf feat(uftp): package UFTP 5.0.4 for UFTP image distribution
UFTP multicast distribution of stateless images needs the uftp sender
on the management node and the uftpd receiver in the image. RHEL and
EPEL do not ship UFTP, so xcat-dep builds it.

uftp/ holds the upstream 5.0.4 release archive, its SHA-256 in
SHA256SUMS, and a spec that patches it and builds it with the
distribution OpenSSL and build flags. The package installs the four
binaries in /usr/bin, where the upstream makefile puts them, and
enables no service. uftp/mockbuild.pl checks the archive and builds the
package with mock, like the other builders.

Sender:

- A STATUS for a section past the end of the file is rejected. It made
  the sender write past its NAK list.
- An encrypted message from a client without encryption state is
  rejected. It made the sender follow a null pointer.
- A file with more sections than the 16 bit section count holds stops
  the sender with an error. The count wrapped to 0, and the sender
  divided by it.
- The sender seeks past block 2^31, which the section count allows
  with large blocks. It retried that block without end.

Receiver:

- A FILESEG for a block that the file does not have is rejected. It
  made the receiver read and write past its NAK list.
- Each received block stays inside the disk cache. A normal transfer
  overran the cache when a short last block fell at its end.
- A last FILESEG of the wrong length is rejected. The receiver wrote
  bytes from past the disk cache into the file.
- A DONE for a section past the end of the file is rejected. It made
  the receiver read and write past its section lists.
- An ANNOUNCE with a block size that the sender does not accept is
  rejected. A block size of 0 made the receiver divide by zero.
- A name with ".." in any component is rejected. Only the first ".."
  was checked.
- An absolute name must be below a whole -D directory. With -D /dest,
  the name /dest-other/x matched.
- A path through a symbolic link is rejected. A link that the sender
  created let a later file go outside the destination directory.
- A FILEINFO with more sections than the 16 bit section count holds is
  rejected. The count wrapped to 0, and the receiver divided by it.
- The list of files that the receiver moves at the end of a group
  grows as needed. It overflowed after 10000 entries.
- Cleanup checks the path of a file again before it changes the file.
  Without -T, a FILEINFO of another group could put a symbolic link in
  the path, and cleanup then deleted a file outside the destination.
- The NAK list holds a whole section. A STATUS for a full section read
  and sent one byte past the list, which every file above 2 MiB
  reaches with 512 byte blocks.
- Cleanup leaves a file alone when another group replaced it. Without
  -T, an aborted group deleted the completed file of the other group.
- Cleanup checks the path of the unused file of a restarted group
  before it deletes that file. With -T, a symbolic link in that path
  made cleanup delete a file outside the temp directory.
- A backup with -A checks its path for a symbolic link. A link that an
  earlier backup moved into the backup directory sent a later backup
  outside it.
- A name of the destination directory itself, such as "." or
  "/dest/.", is rejected. A delete request for it emptied the
  destination directory.

Proxy:

- The client lists stay inside the packet buffer. With an RSA-2048 key
  and -b 8800, the KEYINFO key list overran it.
- An ANNOUNCE with a block size that the sender does not accept is
  rejected. A block size above the packet size made the proxy read
  past its buffers.
- The STATUS that the proxy sends for a full section carries the whole
  NAK list. It was one byte short, so the sender rejected it and never
  resent the blocks that clients behind the proxy lost.
- The NAKs of a client STATUS are read after its whole header, up to
  the end of the message. With -C tfmcc, the proxy read the TFMCC
  extension as NAKs. For a short section, it read old data from its
  buffer.

Each program carries "(xCAT build 1)" in its version string, so that
xCAT can refuse a UFTP build without these fixes.

mockbuild-all.pl runs the builder for every EL target, riscv64
included, and every EL section of packages-manifest.conf lists
uftp=5.0.4. xCAT does not require uftp, so it stays out of the required
set, like conserver-xcat.

The package is EL-only for now. There is no deb, and the uftp 4.10 that
Ubuntu ships is not supported: the sender and the receiver must both
run UFTP 5.

The archive is the SourceForge release file. Its MD5 matches the one
SourceForge publishes.
2026-10-19 20:37:40 -03:00
Vinícius Ferrão 37ad5cdf21 test(openeuler): exempt uftp from the ppc64le package parity check
The openEuler ppc64le target must list every package of the EL10
ppc64le target, except the ones that no xCAT core rpm requires. uftp
joins those: xCAT does not require it, and the openEuler targets do not
build it. No section lists uftp yet, so the check is unchanged.
2026-10-18 00:39:32 -03:00
Daniel Hilst 3a8017eee6 Merge pull request #89 from VersatusHPC/fix/genesis-oe-source-dir-rename
fix(xcat-dep): the OpenEmbedded Genesis build cannot find the builder in xcat-core master
2026-10-16 11:03:44 -03:00
Daniel Hilst dd684c1d4b Merge pull request #87 from VersatusHPC/fix/openeuler-ppc64le-net-dns
fix(xcat-dep): openEuler ppc64le ships Net::DNS 1.40 with known CVEs
2026-10-16 11:03:25 -03:00
Daniel Hilst 562ee07d73 Merge master into fix/openeuler-ppc64le-net-dns
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-14 11:08:27 -03:00
Daniel Hilst 59b5e4847a Merge pull request #88 from VersatusHPC/fix/aarch64-cross-build
fix(xcat-dep): an aarch64 build on an x86_64 host deploys to the x86_64 cell
2026-10-14 11:04:40 -03:00
Daniel Hilst e6f2e8a794 fix(xcat-dep): the mock result owner ignores sudo and fresh parents
mock_chroot_uid ran mock's loader as root. mock itself loads its
configuration as the user that sudo names, so with no chrootuid it
builds as SUDO_UID. The helper reported uid 0, and mock_result_dirs
gave the result directories to root.

As root, the loader now builds the uid manager with mock's own
setup_uid_manager() and loads the configuration through
run_in_subprocess_without_privileges(), as mock main() does.

make_traversable_path gives mode 0755 to the directories that it
creates, because make_path applies the umask. mock_result_dirs and
mockbuild-perl-packages.pl use it for the work and package directories.
Directories that already exist keep their mode.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-14 05:40:14 -03:00
Daniel Hilst 1d742828e9 test(xcat-dep): the mock result owner ignores sudo and fresh parents
mock loads its configuration as the user that sudo names, so a
configuration without chrootuid builds as SUDO_UID. mock_chroot_uid
runs the loader as root and reports uid 0, and mock_result_dirs then
gives the result directories to root.

Under umask 077, mock_result_dirs creates the work and package
directories as 0700. The build user cannot reach the result
directories below them.

Add a sudo-caller case to the native mock test, and a fresh-tree case
under umask 077 to the result-directory test. Move writable_as into
t/lib so both tests share it.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-14 05:39:36 -03:00
Daniel Hilst 93b5995e66 fix(xcat-dep): CI does not run the OpenEmbedded source directory test
The Run package tests step lists each test file, and it did not list
t/genesis_oe_source_dir.t. A green run did not exercise the
regression for the renamed xCAT-genesis-base directory.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-14 05:37:06 -03:00
Daniel Hilst 20110fc17d test(xcat-dep): nothing asserts which repository cell lock a target takes
The reported failure is a lock, not an architecture: xcat-dep-build-el10-aarch64
took /repos/yum/xcat-dep/rh10/.x86_64.lock on xcat-master and held it, and
xcat-dep-build-el10-x86_64 of the same run waited out 100 retries and exited
before it built anything. Builds 92 and 93 failed that way, and build 94 passed
only because it won the race. No test covers the path that is locked.

target_cell() built the cell inline from target_profile(), and cell_lock_path()
lived in mockbuild-all.pl, so neither could be called from a test. The cell and
the lock are now epel_cell_path() and cell_lock_path() in MockBuildUtils, and
target_cell() calls them. The behaviour does not change.

t/aarch64_cross_build.t resolves both EL10 targets on an x86_64 host and asserts
that their cells and their locks differ. With the architecture taken from the
host again, three of its assertions fail, among them "the two EL10 targets of
one host take different cell locks".

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-13 11:14:37 -03:00
Daniel Hilst c0af7aeffb fix(xcat-dep): the OpenEmbedded Genesis build cannot find the builder in xcat-core master
Every OpenEmbedded Genesis build fails against xcat-core master:

    xcat-core source is missing xCAT-genesis-builder/oe/build

xcat-core 2a7364476 renamed xCAT-genesis-builder to xCAT-genesis-base and
updated the readers inside xcat-core. genesis-openembedded/build names the old
directory in four places, so it rejects the checkout before it builds anything.
The build jobs for EL and for Ubuntu both exit 2 on it.

A dep build serves two kinds of checkout at once. A released core still carries
the old name, and master carries the new one, so neither name can replace the
other. XCAT::GenesisRelease::oe_source_dir takes whichever directory holds a
complete pair of build and export scripts, prefers the new name when a checkout
has both, and names every path it looked for when a checkout has neither. The
script resolves the directory once and uses it for the architecture probe, the
build and the export.

Half a directory is not a directory. The build runs both scripts, so a prefix
that carries only one is skipped here instead of failing later at the second
run_command, with a message that names the wrong thing.

t/genesis_oe_source_dir.t covers both names, a checkout with both, a checkout
with neither, an incomplete pair and a caller that needs one script. Against the
directory list before this change, four of its ten assertions fail.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-13 11:12:03 -03:00
Daniel Hilst 6c9e905373 Merge master into fix/openeuler-ppc64le-net-dns
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-09 10:40:43 -03:00
Daniel Hilst 380fccd625 fix(xcat-dep): the CI arm64 grub modules come from an unverified archive
The workflow step that puts the arm64-efi GRUB modules on the runner read a
directory listing over plain HTTP, took the last name in lexical order, and
unpacked the whole deb into / as root. Nothing authenticated the artifact, and
the name chosen was neither tied to the runner's suite nor to the installed
grub-mkimage.

install-grub-arm64-modules.sh now reads grub-efi-arm64-bin through apt in a
private state tree: apt verifies the InRelease signature of the suite that
/etc/os-release names, and the deb hash against that signed index. The host dpkg
architecture and the host sources are not changed. The script stops when the
deb and the host grub-mkimage report different GRUB upstream versions, unpacks
under TMPDIR, and copies only the files of usr/lib/grub/arm64-efi. The
documentation and the prebuilt images under monolithic/ stay out.

t/install-grub-arm64-modules.bats drives the script with apt-get, dpkg-deb and
the image builder as shell functions. Four removals were each caught by the
assertion that names them: the version gate, the file-only copy, the apt
authentication options, and the missing-module-directory check.

Measured in an ubuntu:24.04 container with the workflow's own steps:
t/aarch64_target.t reports 4 skips before the step and 0 after it, with all 38
checks passing, and t/aarch64_cross_build.t passes 27 with 0 skips.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-09 06:35:52 -03:00
Daniel Hilst 7b450d7c08 test(xcat-dep): the aarch64 regression skips its image checks in CI
t/aarch64_target.t was added with the aarch64 build target and no workflow step
ran it. Adding the step alone is not enough: the four checks that run the spec's
own grub2-mkimage command skip unless the arm64-efi grub modules are installed
and the tool is on PATH, and both were missing on the runner.

Debian and Ubuntu name the tool grub-mkimage, so looking only for the EL name
skips exactly where the suite runs. The test now resolves either name and
substitutes it into the spec's command.

grub-efi-arm64-bin is Architecture: arm64 and cannot be installed on the amd64
runner, but the modules in it are target code, so the workflow extracts the deb
from ports.ubuntu.com instead of enabling a foreign architecture, and fails when
the extraction yields no modules.

Measured in an ubuntu:24.04 container with the workflow's own steps: the
upstream test reports 4 skips, `# skip grub2-mkimage or the arm64-efi grub
modules are not installed`, and this one reports 0 with all four image checks
passing. The workflow also runs t/aarch64_cross_build.t.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-09 06:35:52 -03:00
Daniel Hilst 506da9cb9f fix(xcat-dep): an aarch64 build on an x86_64 host deploys to the x86_64 cell
target_profile() took the rpm architecture of an EPEL target from the build
host, so alma+epel-10-aarch64 built on an x86_64 host reported arch=x86_64.
target_cell() then resolved to rh10/x86_64, and the deploy would have replaced
the x86_64 cell of the published repository with aarch64 rpms. The same answer
reported forcearch=0, which left the emulated build with the native step
timeout.

The architecture now comes from the target name, which is what names the rpms,
and a target whose architecture differs from the host is a cross-build. mock
already applies --forcearch to such a target, so nothing else has to change for
the build itself to work.

epel_target_profile() in MockBuildUtils carries the decision, and
t/aarch64_cross_build.t calls it. The test pins the answer for every target that
builds today, so the change cannot move one of them, and its two aarch64
assertions fail against the previous behaviour.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-09 06:35:51 -03:00
Daniel Hilst 774b592df7 Merge pull request #84 from VersatusHPC/fix/openeuler-ppc64le-manifest-ipxe
fix(xcat-dep): openEuler ppc64le has no ipxe-xcat and xCAT cannot install
2026-10-08 11:20:37 -03:00
Daniel Hilst cdd48c4426 Merge pull request #86 from VersatusHPC/fix/goconserver-goamd64-v1
fix(xcat-dep): goconserver is built for x86-64-v3 and SIGILLs on an older node
2026-10-08 11:20:15 -03:00
Daniel Hilst 5213e5fe8d fix(xcat-dep): mock_chroot_uid ignores a chrootuid set after an include
mock_chroot_uid parsed the mock configuration files itself and read each
include() after the file that names it. A chrootuid set after an include
lost to the value in the include, so mockbuild-perl-packages.pl gave the
result directories to a uid mock does not build as.

mock_chroot_uid now asks mock's own loader, mockbuild.config.load_config,
for chrootuid. It fails with a clear message when mock is not installed.
mock_result_dirs takes the configuration and gets the uid from
mock_chroot_uid, so the caller cannot pass a uid from another source.

native/mock-chroot-uid.t returned 1000 instead of 1001 before this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 13:52:06 -03:00
Daniel Hilst 329f7dc5f3 test(xcat-dep): mock_chroot_uid ignores a chrootuid set after an include
mock_chroot_uid reads the configuration files itself and processes each
include() after the file that names it. A configuration that includes a file
with chrootuid 1000 and then sets chrootuid 1001 returns 1000, but mock builds
as 1001. mockbuild-perl-packages.pl then gives the result directories to the
wrong uid, and mock cannot write its logs in them.

native/mock-chroot-uid.t compares mock_chroot_uid with that case, with a
wrapper that only includes, and with a configuration that sets no chrootuid.
Ubuntu ships no mock, so the workflow runs the test in a Fedora container.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 13:48:09 -03:00
Daniel Hilst 2a1762b22c fix(xcat-dep): the perl builder gives mock result directories it cannot write
perl-Net-DNS is an owner in the openEuler 24.03 ppc64le catalog, so
mockbuild-all.pl builds it with mockbuild-perl-packages.pl. That script runs as
root and creates the srpm, restamp-srpm and rpm directories it gives mock as
--resultdir. mock 6.8 reloads its uid manager from chrootuid, which
openeuler-24.03-ppc64le.cfg sets to 1000, and opens state.log, build.log and
root.log in --resultdir as that uid. root creates those directories mode 0755
with umask 0022, so mock cannot open a log in them and fails in resetLogging
before the build starts.

MockBuildUtils::mock_chroot_uid reads the uid from the configuration mock reads.
mock_result_dirs creates the three directories owned by it. A configuration that
names no chrootuid keeps the uid that runs mock, which is mock's own default, so
every other target is unchanged.

perl-Crypt-Rijndael, perl-IO-Stty and perl-Net-Telnet are owners on the same
target and build from a committed source rpm, so restamp-srpm has the same
boundary and is covered too.

t/perl_builder_mock_result_permissions.t fails 6 of its 14 checks without this
change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 12:37:49 -03:00
Daniel Hilst c2c1c730c8 test(xcat-dep): nothing proves the perl builder can write its result directories
mockbuild-all.pl builds a perl package with mockbuild-perl-packages.pl when the
native catalog declares it an owner. That script runs as root and creates the
directories it gives mock as --resultdir. mock 6.8 reloads its uid manager from
chrootuid and opens state.log, build.log and root.log in --resultdir as that
uid, so each directory must be writable by it. No test reads the owner or the
mode of those directories.

The test checks the uid read from a mock configuration, then writes a state.log
in each result directory as that uid. The write runs in a forked child that
exits 2 when setuid fails, so a write made as root cannot read as a pass.

The result-directory checks need root, so the workflow runs the file under sudo.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 12:37:27 -03:00
Daniel Hilst 326ecd0916 Merge remote-tracking branch 'up/master' into mm/fix/openeuler-ppc64le-net-dns 2026-10-07 10:57:15 -03:00
Daniel Hilst cb5560737c Merge remote-tracking branch 'up/master' into mm/fix/goconserver-goamd64-v1 2026-10-07 10:57:14 -03:00
Daniel Hilst 8351d2e3d4 fix(xcat-dep): the openEuler x86_64 targets have no ipxe-xcat either
dnf install xCAT on an openEuler 20.03sp4, 22.03sp4 or 24.03sp4 x86_64
management node stops with "nothing provides ipxe-xcat >= 2.0.0-1 needed by
xCAT-2.20.0". All three gating cells died at the install step in under two
minutes and published no test result at all.

xCAT.spec gained Requires: ipxe-xcat for x86_64 in xcat-core 32a688b3, and the
three x86_64 sections of packages-manifest.conf never declared the package. The
ppc64le section was fixed in the commit before this one; the openEuler branch of
target_profile already covers every openEuler target, so the manifest was the
only gap.

t/openeuler.t now asserts each x86_64 section declares it, and fails 3 of 82
without these lines.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 10:16:17 -03:00
Daniel Hilst 3254455ff2 fix(xcat-dep): openEuler ppc64le has no ipxe-xcat and xCAT cannot install
dnf install xCAT on an openEuler 24.03 ppc64le management node stops with
"nothing provides ipxe-xcat >= 2.0.0-1 needed by xCAT-2.20.0". xCAT and
xCATsn require ipxe-xcat by name on ppc64le, both EL ppc64le sections of
packages-manifest.conf list it, and the openEuler section does not, so
mockbuild-all.pl never builds it and the dep repository never carries it.

Declare the package in four places, because each one refuses it
separately: the manifest section, the openEuler target profile that
selects which dep builders run, the native input catalog that resolves an
owner for every manifest name, and the catalog owner allow-list.
ipxe-xcat.spec is BuildArch noarch with no BuildRequires and no compile
step, so the owner builds as uid 1000 like grub2-xcat.

elilo-xcat and conserver-xcat stay out. No core rpm requires either one:
xCAT uses goconserver for consoles, and elilo is an EFI loader for
architectures this cell does not serve.

t/openeuler.t covers both halves and fails without this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 10:16:17 -03:00
Daniel Hilst bd5ac47175 test(xcat-dep): the openEuler ppc64le manifest can omit a package xCAT requires
packages-manifest.conf says which packages mockbuild-all.pl builds for a
target. Nothing compared the openEuler ppc64le section with the EL section
of the same architecture, so a package xCAT requires by name could be
absent and the dep build would still pass. The omission appears much
later, as "nothing provides" when dnf installs xCAT on the management
node.

Assert that the openEuler ppc64le section declares every package
alma+epel-10-ppc64le declares, apart from two exemptions that no core rpm
requires, and that the native input catalog declares an owner for every
package that section names. Both assertions fail today, on ipxe-xcat.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 10:16:17 -03:00
Daniel Hilst d26549495b fix(xcat-dep): the openEuler native builds need procenv on the build host
Every native prerequisite after procenv itself died before rpmbuild started:

  FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/procenv'

mock's procenv plugin executes ["/usr/bin/procenv"] on the build host, not in the
chroot, so the build needed a host package that neither this repository nor
xcat-core-ci-cd declares. The plugin is pure provenance: it writes procenv.log into
the result directory and nothing reads it. mock ships it off.

native_overlay_text now leaves procenv_enable at mock's default for every overlay,
so a native build depends on nothing outside the two repositories.

The procenv node stays in the inputs: mock appends procenv to the buildroot's
preexisting_deps whenever the plugin is on, so the package is still what makes the
plugin usable if the host is ever provisioned for it.

openeuler_native_procenv_plugin.t passes with this commit and failed two checks
without it. Measured on xcat-master-ppc: run 264b installed
procenv-0.60-1.ppc64le into the docbook-style-dsssl chroot and failed on the same
line, which is what showed the chroot was never the problem.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 10:16:17 -03:00
Daniel Hilst e5ceff876b test(xcat-dep): the openEuler native overlays enable a plugin the host cannot run
Every openEuler ppc64le native prerequisite after procenv itself fails before
rpmbuild starts:

  FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/procenv'

raised from mock's procenv plugin prebuild hook. The plugin runs ["/usr/bin/procenv"]
through mockbuild.util.do with no chroot prefix, so it executes the BUILD HOST's copy,
and xcat-master-ppc has none. The plugin also appends procenv to the buildroot's
preexisting_deps itself, so the chroot already gets the package: a run that installed
it, with "Installing : procenv-0.60-1.ppc64le" in root.log, failed on the same line.

mock ships procenv_enable False. The overlays turn it on, which makes every native
build depend on a host package that neither repository declares, for a procenv.log
that nothing reads.

The overlay text was built inline in native_overlay, so there was nothing a unit test
could call. native_overlay_text in XCAT::NativeInputs now renders one overlay and
reproduces today's values exactly, and native_overlay writes what it returns.

openeuler_native_procenv_plugin.t asserts the plugin is left at its default in all
three overlays, that the prerequisite repository and the bind mount survive, and that
the uid split does not move. Two of its eleven checks fail on this commit, which is
the defect.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 10:16:16 -03:00
Daniel Hilst 5d3fcfe906 fix(xcat-dep): the openEuler ppc64le native prerequisites cannot write their logs
Every xcat-dep-build-openeuler24.03-ppc64le build fails at the first native
prerequisite:

  PermissionError: [Errno 13] Permission denied:
    .../native-results/procenv/state.log

mock 6.8 reloads its uid manager from chrootuid ("fix: reload uidManager with
chrootuid/chrootgid from config"), so mock now creates --resultdir and opens its own
state.log, build.log and root.log there as chrootuid, which the openEuler ppc64le
overlay sets to the catalog's build_uid. mockbuild-all.pl creates those directories
as root, mode 755, so mock cannot open a log in them and dies in resetLogging before
the build starts. It is not specific to the shared filesystem: the same failure
reproduces on /tmp.

make_native_path gives every directory mock writes the native build gid and makes it
group writable, and MockBuildUtils::native_owner_command runs the step under setpriv
--regid with a 0002 umask, so what the step creates below those directories inherits
both. The uid a step builds as now comes from the catalog's build_uid instead of the
step id, which also builds xnba-undi as root, as its own declaration says.

t/openeuler_native_result_permissions.t fails five of its six assertions without this
change. native/openeuler-power-inputs.t fails too, with "mock: [Errno 13] Permission
denied: .../native-results/native-leaf/state.log", but only on ppc64le: its native
owner section skips 52 of its assertions on x86_64, which is the architecture the
GitHub workflow runs on. The unit test is what keeps the fix covered there.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 10:15:49 -03:00
Daniel Hilst 63784cfbee test(xcat-dep): nothing proves a native dep builder can write its mock result directories
ipxe-xcat/mockbuild.pl runs as root and calls make_path on $work_dir/srpm
and $work_dir/rpm, then gives each one to mock as --resultdir. The native
openEuler overlay sets chrootuid to the catalog's build_uid and chrootgid to
the native build gid, so mock reloads to that uid and opens state.log,
build.log and root.log in those directories. A root-made directory with the
default umask is root root 0755 and mock cannot write them. grub2-xcat,
ipmitool-xcat, syslinux-xcat and goconserver create their result directories
the same way.

What keeps those directories writable is the step wrapper, not the builder:
native_owner_command gives the step the native build gid and umask 0002, so
every directory the builder creates below it is group writable. No test
measured that, so removing either one is silent.

Move native_owner_command into MockBuildUtils so a test can call it in
process, and assert the wrapper carries setpriv --regid 1000,
--clear-groups and umask 0002, that setpriv precedes the umask and the umask
precedes the builder, and that the overlay is still bound over the target
config so chrootuid stays as the catalog declared it.

This commit is the move and the test only. Five of the six assertions fail
here, because the gid and the umask arrive in the next commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 10:04:41 -03:00
Daniel Hilst cf90df2723 test(xcat-dep): the native owner tests skip mock 6.8 and never check result ownership
native/openeuler-power-inputs.t gates its whole native owner section on
"from mockbuild.util import load_config". mock 6.8 keeps load_config in
mockbuild.config, so the import fails, $can_owner is false and 52 assertions skip
on the only architecture that can run them. native/fixtures/power-mock.py imports
it the same way and cannot start at all.

The fake mock also created --resultdir as the user that started it and wrote no
logs, so it could not see what mock 6.8 does: it reloads its uid manager from
chrootuid, then creates --resultdir and opens state.log, build.log and root.log in
it as that uid.

Both now use mockbuild.config, and the fake mock creates --resultdir and opens
those three logs as chrootuid. Against the unfixed tree the native owner fails:

  mock: [Errno 13] Permission denied:
    .../native-results/native-leaf/state.log
  ERROR: Step failed (rc=1): Build native prerequisite: native-leaf
  Failed 14/115 subtests

The directory is root root 755 and chrootuid is 1000, which is the catalog's
declared build_uid for that node.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 10:03:08 -03:00
Daniel Hilst 485fb2d6bb Merge pull request #85 from middelkoopt/tm-aarch64-dep
feat(xcat-dep): build the EL10 aarch64 dependency repository
2026-10-07 09:43:11 -03:00
Daniel Hilst 7495cb6472 test(xcat-dep): nothing measured the x86-64 baseline of the goconserver deb
The GOAMD64=v1 fix sets the variable at four sites. Three are in the RPM path and
native/goconserver-openeuler.t covers them. The fourth is goconserver/debian/rules,
which is where dpkg-buildpackage compiles, and no assertion read it. A wrong change
there leaves the amd64 deb at v3, and the RPM evidence still looks complete.

t/goconserver_cross_build.t already runs the real debian/rules build target with the
commands around it shadowed. Its go stub now stamps the GOAMD64 it was given into the
binary it emits, answers `go env GOARCH` and `go version -m`, and FIXTURE_GOAMD64 makes
it report a different setting -- what a compiler that ignores the request looks like.
Six assertions on an amd64 cell: the build completes, both `go build` calls carry
GOAMD64=v1, the gate reads the metadata of both binaries, and a v3 binary fails the
build with a diagnostic that names the setting it carries.

Measured by mutation on xcat-master-ub. Deleting the gate from debian/rules fails two
assertions. Deleting `export GOAMD64=v1` from both debian/rules and goconserver/sbuild.pl
fails two more. Deleting it from debian/rules alone still passes, because the sbuild shell
exports the same value: the two sites are redundant and no test can separate them.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 02:08:24 -03:00