Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1393247

Summary: Skipped first rotation by time after update to logrotate-3.8.6-12.el7.x86_64
Product: Red Hat Enterprise Linux 7 Reporter: Damir <saydatemp1>
Component: logrotateAssignee: Kamil Dudka <kdudka>
Status: CLOSED ERRATA QA Contact: Robin Hack <rhack>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.3CC: kdudka, rhack, usurse, vdanek, xnie
Target Milestone: rcKeywords: EasyFix, Patch, Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: logrotate-3.8.6-14.el7 Doc Type: If docs needed, set a value
Doc Text:
NEEDLESS TO DOCUMENT
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 16:19:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1298243, 1393867, 1400961    

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