passt-0^20230818.g0af928e-4.el9

Switch to hard copies instead of hard links -- previous workaround is
not working consistently across filesystems (xfs vs. ext4) and how
cpio archives contents.
This commit is contained in:
Stefano Brivio 2023-08-22 18:59:33 +02:00
parent 7375212a6a
commit 71e80c7335

View File

@ -12,7 +12,7 @@
Name: passt
Version: 0^20230818.g0af928e
Release: 3%{?dist}
Release: 4%{?dist}
Summary: User-mode networking daemons for virtual machines and namespaces
License: GPLv2+ and BSD
Group: System Environment/Daemons
@ -60,13 +60,18 @@ This package adds SELinux enforcement to passt(1) and pasta(1).
%make_install DESTDIR=%{buildroot} prefix=%{_prefix} bindir=%{_bindir} mandir=%{_mandir} docdir=%{_docdir}/%{name}
# The Makefile creates symbolic links for pasta, but we need hard links for
# SELinux file contexts to work as intended. Same with pasta.avx2 if present.
ln -f %{buildroot}%{_bindir}/passt %{buildroot}%{_bindir}/pasta
#
# RHEL 9 note: switch from hard links to copies -- given that the behaviour
# differs depending on filesystems and how cpio builds archives. This leads to
# "Duplicate build-ids" warnings for rpmbuild at the moment, we need to find a
# better solution upstream.
rm %{buildroot}%{_bindir}/pasta
cp %{buildroot}%{_bindir}/passt %{buildroot}%{_bindir}/pasta
%ifarch x86_64
ln -f %{buildroot}%{_bindir}/passt.avx2 %{buildroot}%{_bindir}/pasta.avx2
rm %{buildroot}%{_bindir}/pasta.avx2
cp %{buildroot}%{_bindir}/passt.avx2 %{buildroot}%{_bindir}/pasta.avx2
ln -sr %{buildroot}%{_mandir}/man1/passt.1 %{buildroot}%{_mandir}/man1/passt.avx2.1
ln -sr %{buildroot}%{_mandir}/man1/pasta.1 %{buildroot}%{_mandir}/man1/pasta.avx2.1
install -p -m 755 %{buildroot}%{_bindir}/passt.avx2 %{buildroot}%{_bindir}/pasta.avx2
%endif
pushd contrib/selinux
@ -91,16 +96,6 @@ fi
%posttrans selinux
%selinux_relabel_post -s %{selinuxtype}
# pasta is a hard link to passt, and, depending on the order of archiving,
# rpm(8) might or might not associate (lsetfilecon) the same context to both
# entries, see rpmPackageFilesInstall() in lib/fsm.c. If there's no difference
# in file contexts compared to a previous installed version,
# %selinux_relabel_post won't touch the labels, so we need to ensure that the
# right labels are applied to hard links, here.
restorecon %{_bindir}/passt %{_bindir}/pasta || :
%ifarch x86_64
restorecon %{_bindir}/passt.avx2 %{_bindir}/pasta.avx2 || :
%endif
%files
%license LICENSES/{GPL-2.0-or-later.txt,BSD-3-Clause.txt}
@ -126,6 +121,10 @@ restorecon %{_bindir}/passt.avx2 %{_bindir}/pasta.avx2 || :
%{_datadir}/selinux/packages/%{selinuxtype}/pasta.pp
%changelog
* Tue Aug 22 2023 Stefano Brivio <sbrivio@redhat.com> - 0^20230818.g0af928e-4
- Switch to copies instead of links for pasta: previous workaround unreliable
- Resolves: RHELPLAN-155811
* Tue Aug 22 2023 Stefano Brivio <sbrivio@redhat.com> - 0^20230818.g0af928e-3
- Explicit restorecon in scriptlet as rpm(8) mix up contexts with hard links
- Resolves: RHELPLAN-155811