From ac43786d5b22e535ac66f9319d58dc786e8637bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 18 Jan 2022 16:10:04 +0100 Subject: [PATCH] Release ownership of /var/log/lastlog /var/log directory is provided by filesystem package, no need to create it. And systemd >= 235 will create /var/log/lastlog owned by utmp. So release ownership of the file, and let systemd manage it. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1798685. Similar change in setup: https://pagure.io/setup/pull-request/30. --- util-linux.spec | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/util-linux.spec b/util-linux.spec index 7b57def..9d3e52b 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -339,9 +339,6 @@ mkdir -p ${RPM_BUILD_ROOT}%{_bindir} mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,6,8,5} mkdir -p ${RPM_BUILD_ROOT}%{_sbindir} mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/{pam.d,security/console.apps} -mkdir -p ${RPM_BUILD_ROOT}/var/log -touch ${RPM_BUILD_ROOT}/var/log/lastlog -chmod 0644 ${RPM_BUILD_ROOT}/var/log/lastlog # install util-linux %make_install @@ -434,24 +431,6 @@ find $RPM_BUILD_ROOT%{_mandir}/man8 -regextype posix-egrep \ -printf "%{_mandir}/man8/%f*\n" >> %{name}.files -%post -# only for minimal buildroots without /var/log -[ -d /var/log ] || mkdir -p /var/log -touch /var/log/lastlog -chown root:root /var/log/lastlog -chmod 0644 /var/log/lastlog -# Fix the file context, do not use restorecon -if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then - SECXT=$( /usr/sbin/matchpathcon -n /var/log/lastlog 2> /dev/null ) - if [ -n "$SECXT" ]; then - # Selinux enabled, but without policy? It's true for buildroots - # without selinux stuff on host machine with enabled selinux. - # We don't want to use any RPM dependence on selinux policy for - # matchpathcon(2). SELinux policy should be optional. - /usr/bin/chcon "$SECXT" /var/log/lastlog >/dev/null 2>&1 || : - fi -fi - %post -n util-linux-core if [ ! -L /etc/mtab ]; then ln -sf ../proc/self/mounts /etc/mtab || : @@ -517,8 +496,6 @@ fi %attr(755,root,root) %{_bindir}/login %attr(2755,root,tty) %{_bindir}/write -%ghost %attr(0644,root,root) %verify(not md5 size mtime) /var/log/lastlog - %{_unitdir}/fstrim.* %{_bindir}/cal