#17 Fix %%ghost files
Closed 2 years ago by sergiomb. Opened 3 years ago by sergiomb.
rpms/ sergiomb/clamav master  into  rawhide

file modified
+24 -15
@@ -41,7 +41,7 @@ 

  Summary:    End-user tools for the Clam Antivirus scanner

  Name:       clamav

  Version:    0.102.4

- Release:    2%{?dist}

+ Release:    3%{?dist}

  License:    %{?with_unrar:proprietary}%{!?with_unrar:GPLv2}

  URL:        https://www.clamav.net/

  %if %{with unrar}
@@ -303,12 +303,9 @@ 

  

  install -d -m 0755 \

      $RPM_BUILD_ROOT%_sysconfdir/{mail,clamd.d,logrotate.d} \

-     $RPM_BUILD_ROOT%_tmpfilesdir \

      $RPM_BUILD_ROOT%_rundir \

      $RPM_BUILD_ROOT%_var/log \

-     $RPM_BUILD_ROOT%milterstatedir \

-     $RPM_BUILD_ROOT%homedir \

-     $RPM_BUILD_ROOT%scanstatedir

+     $RPM_BUILD_ROOT%homedir

  

  rm -f $RPM_BUILD_ROOT%_libdir/*.la

  
@@ -386,9 +383,14 @@ 

  

  mv $RPM_BUILD_ROOT%_sysconfdir/clamd.conf.sample _doc_server/clamd.conf

  

+ %if %{with tmpfiles}

+ install -d -m 0755 $RPM_BUILD_ROOT%_tmpfilesdir

  cat << EOF > $RPM_BUILD_ROOT%_tmpfilesdir/clamd.scan.conf

  d %scanstatedir 0710 %scanuser virusgroup

  EOF

+ %else

+ install -d -m 0755 $RPM_BUILD_ROOT%scanstatedir

+ %endif

  

  ### The milter stuff

  sed -ri \
@@ -404,11 +406,13 @@ 

  

  install -D -p -m 0644 %SOURCE330 $RPM_BUILD_ROOT%_unitdir/clamav-milter.service

  

+ %if %{with tmpfiles}

  cat << EOF > $RPM_BUILD_ROOT%_tmpfilesdir/clamav-milter.conf

  d %milterstatedir 0710 %milteruser %milteruser

  EOF

- 

- %{!?with_tmpfiles: rm -rf $RPM_BUILD_ROOT%_tmpfilesdir}

+ %else

+ install -d -m 0755 $RPM_BUILD_ROOT%milterstatedir

+ %endif

  

  # TODO: Evaluate using upstream's unit with clamav-daemon.socket

  rm $RPM_BUILD_ROOT%_unitdir/clamav-daemon.*
@@ -577,9 +581,9 @@ 

  %config(noreplace) %_sysconfdir/sysconfig/freshclam

  %endif

  %config(noreplace) %verify(not mtime)    %_sysconfdir/logrotate.d/*

- %ghost %attr(0664,root,%updateuser) %verify(not size md5 mtime) %freshclamlog

- %ghost %attr(0664,%updateuser,%updateuser) %homedir/*.cld

- %ghost %attr(0664,%updateuser,%updateuser) %homedir/mirrors.dat

+ %ghost %freshclamlog

+ %ghost %homedir/*.cld

+ %ghost %homedir/mirrors.dat

  

  

  %files -n clamd
@@ -592,7 +596,7 @@ 

  %ghost %scanstatedir/clamd.sock

  %if %{with tmpfiles}

    %_tmpfilesdir/clamd.scan.conf

-   %ghost %dir %attr(0710,%scanuser,virusgroup) %scanstatedir

+   %ghost %dir %scanstatedir

  %else

    %dir %attr(0710,%scanuser,virusgroup) %scanstatedir

  %endif
@@ -601,22 +605,27 @@ 

  %files milter

  %doc clamav-milter/README.fedora

  %_sbindir/*milter*

+ %_unitdir/clamav-milter.service

  %_mandir/man8/clamav-milter*

  %dir %_sysconfdir/mail

  %config(noreplace) %_sysconfdir/mail/clamav-milter.conf

- %ghost %attr(0620,root,%milteruser) %verify(not size md5 mtime) %milterlog

- %ghost %milterstatedir/clamav-milter.socket

+ %ghost %milterlog

  

+ %ghost %milterstatedir/clamav-milter.socket

  %if %{with tmpfiles}

    %_tmpfilesdir/clamav-milter.conf

-   %ghost %dir %attr(0710,%milteruser,%milteruser) %milterstatedir

+   %ghost %dir %milterstatedir

  %else

    %dir %attr(0710,%milteruser,%milteruser) %milterstatedir

  %endif

- %_unitdir/clamav-milter.service

  

  

  %changelog

+ * Sun Aug 09 2020 Sérgio Basto <sergio@serjux.com> - 0.102.4-3

+ - Remove %%attr and %%vertify from %%ghost files

+ - Rearrange some files of milter package

+ - Rearrange tmpfiles and only create /var/run dirs if we aren't using tmpfiles

+ 

  * Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.102.4-2

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

  

Seems to me when we define %ghost file or directory , %attr and %verify shouldn't be there ,doesn't make sense %ghost have this attributes ...

Have you tested this? I'm pretty sure we need the files to be created with the proper permissions out of the box or things won't work.

No, but I studied a little ... Packaging:Tmpfiles.d [1] does not mention %ghost files , and %ghost directive [2] says "There are times when a file should be owned by the package but not installed" , i.e. %ghost files are not installed by clamav packages, so seems to me there is no point have %attr , I thought it was an error when we migrate to tmptiles.d ...
Therefore, I deduce the files are created after installing the packages and, of course, with the correct permissions.

But I will test it

[1]
https://docs.fedoraproject.org/en-US/packaging-guidelines/Tmpfiles.d/

[2]
http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html

1 new commit added

  • Rearrange some files of milter package
3 years ago

rebased onto 7b81c3d

3 years ago

Pull-Request has been closed by sergiomb

2 years ago