Bug 1393247 - Skipped first rotation by time after update to logrotate-3.8.6-12.el7.x86_64
Summary: Skipped first rotation by time after update to logrotate-3.8.6-12.el7.x86_64
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: logrotate
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Kamil Dudka
QA Contact: Robin Hack
URL:
Whiteboard:
: 1393209 (view as bug list)
Depends On:
Blocks: 1298243 1393867 1400961
TreeView+ depends on / blocked
 
Reported: 2016-11-09 08:04 UTC by Damir
Modified: 2020-09-10 09:56 UTC (History)
5 users (show)

Fixed In Version: logrotate-3.8.6-14.el7
Doc Type: If docs needed, set a value
Doc Text:
NEEDLESS TO DOCUMENT
Clone Of:
Environment:
Last Closed: 2017-08-01 16:19:24 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1889 0 normal SHIPPED_LIVE logrotate bug fix and enhancement update 2017-08-01 17:54:32 UTC

Description Damir 2016-11-09 08:04:07 UTC
Description of problem:
Skipped first rotation by time after update to logrotate-3.8.6-12.el7.x86_64 from logrotate-3.8.6-7 or earlier, because /var/lib/logrotate/logrotate.status is empty.

Version-Release number of selected component (if applicable):
logrotate-3.8.6-12.el7.x86_64

How reproducible:
update to logrotate-3.8.6-12.el7.x86_64 from logrotate-3.8.6-7 or earlier

Steps to Reproduce:
1.update to logrotate-3.8.6-12.el7.x86_64 from logrotate-3.8.6-7 or earlier
2.check that /var/lib/logrotate/logrotate.status is empty.


Actual results:
After update /var/lib/logrotate/logrotate.status is empty.

Expected results:
After update /var/lib/logrotate/logrotate.status copied from /var/lib/logrotate.status, if /var/lib/logrotate/logrotate.status not exist before update.

Additional info:
%pre script in SPEC file copies logrotate.status file from old location to new location.
But after that /var/lib/logrotate/logrotate.status 
is copied from RPM despite %config(noreplace), because in a previous version of the package didn't have that file.

Comment 1 Kamil Dudka 2016-11-09 10:46:21 UTC
*** Bug 1393209 has been marked as a duplicate of this bug. ***

Comment 2 Kamil Dudka 2016-11-09 10:55:50 UTC
Confirmed.  Thanks for the analysis!  The workaround is to copy the saved state file into the new location manually after the update:

# cp -a /var/lib/logrotate.status.rpmsave /var/lib/logrotate/logrotate.status

Sorry for the troubles!

Comment 3 Kamil Dudka 2016-11-10 11:15:04 UTC
I believe this could fixed by using the %ghost directive for logrotate.status:

--- a/logrotate.spec
+++ b/logrotate.spec
@@ -91,7 +91,7 @@ rm -rf $RPM_BUILD_ROOT
 %attr(0644, root, root) %config(noreplace) %{_sysconfdir}/logrotate.conf
 %attr(0755, root, root) %dir %{_sysconfdir}/logrotate.d
 %attr(0755, root, root) %dir %{_localstatedir}/lib/logrotate
-%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate/logrotate.status
+%attr(0644, root, root) %ghost %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate/logrotate.status
 %config(noreplace) %{_sysconfdir}/rwtab.d/logrotate

 %changelog

Comment 7 Kamil Dudka 2016-11-11 16:28:10 UTC
fixed in logrotate-3.10.0-3.fc26:

http://pkgs.fedoraproject.org/cgit/rpms/logrotate.git/commit/?id=bd156318

Comment 21 errata-xmlrpc 2017-08-01 16:19:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1889


Note You need to log in before you can comment on or make changes to this bug.