From db07a23349e1cc7d7d04df96fc50ac3aec2eb4f9 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Thu, 15 Oct 2026 12:06:01 -0300 Subject: [PATCH] fix(xcat-core): rpm does not own the probe subcmds/bin directory The %post of xCAT-probe created /opt/xcat/probe/subcmds/bin, so the directory belonged to no package and carried usr_t from its parent rather than the bin_t the policy gives /opt/.*/bin. It was the only path under /opt/xcat that restorecon reported as pending, on every management node. %install now creates the directory, so rpm owns it and labels it from the policy at install, as the Debian package already does through debian/dirs. The %post keeps removing the obsolete switchprobe file it finds there. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-probe/xCAT-probe.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-probe/xCAT-probe.spec b/xCAT-probe/xCAT-probe.spec index 53bbb589cd..6466e94585 100644 --- a/xCAT-probe/xCAT-probe.spec +++ b/xCAT-probe/xCAT-probe.spec @@ -52,6 +52,10 @@ rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin mkdir -p $RPM_BUILD_ROOT/%{prefix}/probe/ +# xcatprobe drops a switchprobe symlink in here at run time. rpm must own the +# directory, or it takes the context of its parent instead of the one the +# policy gives /opt/.*/bin, and nothing relabels it afterwards. +mkdir -p $RPM_BUILD_ROOT/%{prefix}/probe/subcmds/bin cp xcatprobe $RPM_BUILD_ROOT/%{prefix}/bin cp -r subcmds $RPM_BUILD_ROOT/%{prefix}/probe/ @@ -77,8 +81,6 @@ rm -rf $RPM_BUILD_ROOT %post if [ -e %{prefix}/probe/subcmds/bin/switchprobe ]; then rm -rf %{prefix}/probe/subcmds/bin/switchprobe -else - mkdir -p %{prefix}/probe/subcmds/bin/ fi %preun