#12 define attributes for non existent ghost entries
Closed 5 years ago by maage. Opened 5 years ago by maage.
rpms/ maage/dnf verify  into  master

file modified
+9 -9
@@ -407,15 +407,15 @@ 

  %config(noreplace) %{confdir}/%{name}.conf

  %config(noreplace) %{confdir}/protected.d/%{name}.conf

  %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}

- %ghost %{_localstatedir}/log/hawkey.log

- %ghost %{_localstatedir}/log/%{name}.log

- %ghost %{_localstatedir}/log/%{name}.librepo.log

- %ghost %{_localstatedir}/log/%{name}.rpm.log

- %ghost %{_localstatedir}/log/%{name}.plugin.log

- %ghost %{_sharedstatedir}/%{name}

- %ghost %{_sharedstatedir}/%{name}/groups.json

- %ghost %{_sharedstatedir}/%{name}/yumdb

- %ghost %{_sharedstatedir}/%{name}/history

+ %ghost %attr(600,-,-) %{_localstatedir}/log/hawkey.log

+ %ghost %attr(600,-,-) %{_localstatedir}/log/%{name}.log

+ %ghost %attr(600,-,-) %{_localstatedir}/log/%{name}.librepo.log

+ %ghost %attr(600,-,-) %{_localstatedir}/log/%{name}.rpm.log

+ %ghost %attr(600,-,-) %{_localstatedir}/log/%{name}.plugin.log

+ %ghost %attr(700,-,-) %dir %{_sharedstatedir}/%{name}

+ %ghost %attr(600,-,-) %{_sharedstatedir}/%{name}/groups.json

+ %ghost %attr(700,-,-) %dir %{_sharedstatedir}/%{name}/yumdb

+ %ghost %attr(700,-,-) %dir %{_sharedstatedir}/%{name}/history

  %{_mandir}/man5/%{name}.conf.5*

  %{_tmpfilesdir}/%{name}.conf

  %{_sysconfdir}/libreport/events.d/collect_dnf.conf

When defining %ghost entries for non existing files or directories it should be mandatory to define all essential attributes.

dnf-data-4.0.4-1.fc29.noarch
defines:
% rpm -qvl dnf-data
---------- 1 root root 0 Oct 15 15:00 /var/lib/dnf
---------- 1 root root 0 Oct 15 15:00 /var/lib/dnf/groups.json
---------- 1 root root 0 Oct 15 15:00 /var/lib/dnf/history
---------- 1 root root 0 Oct 15 15:00 /var/lib/dnf/yumdb
---------- 1 root root 0 Oct 15 15:00 /var/log/dnf.librepo.log
---------- 1 root root 0 Oct 15 15:00 /var/log/dnf.plugin.log
---------- 1 root root 0 Oct 15 15:00 /var/log/dnf.rpm.log
---------- 1 root root 0 Oct 15 15:00 /var/log/hawkey.log

And if you run sudo rpm --restore dnf-data you end up with /var/lib/dnf with 0000 perms and if /var/lib/dnf is missing at that point it is created as file.

With this patch those files are defined as:
drwx------ 2 root root 0 Oct 28 12:57 /var/lib/dnf
-rw------- 1 root root 0 Oct 28 12:57 /var/lib/dnf/groups.json
drwx------ 2 root root 0 Oct 28 12:57 /var/lib/dnf/history
drwx------ 2 root root 0 Oct 28 12:57 /var/lib/dnf/yumdb
-rw------- 1 root root 0 Oct 28 12:57 /var/log/dnf.librepo.log
-rw------- 1 root root 0 Oct 28 12:57 /var/log/dnf.plugin.log
-rw------- 1 root root 0 Oct 28 12:57 /var/log/dnf.rpm.log
-rw------- 1 root root 0 Oct 28 12:57 /var/log/hawkey.log

Please note if you use rpm --restore you might meet https://github.com/rpm-software-management/rpm/issues/585

Please can you make a pull request for dnf upstream https://github.com/rpm-software-management/dnf. The downstream spec directly reflect spec in upstream and we more than prefer this way of contribution. Thanks a lot.

Pull-Request has been closed by maage

5 years ago