Bug 247410

Summary: Logrotate 3.7.4 does not honor size directive
Product: Red Hat Enterprise Linux 5 Reporter: Seth Robertson <in-redhat>
Component: logrotateAssignee: Tomas Smetana <tsmetana>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 5.0CC: brandon.franks.011, chet.burgess, joel.winteregg, mmalik, ssaux
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-1002 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-15 14:07:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to address size option not working none

Description Seth Robertson 2007-07-09 04:46:16 UTC
Description of problem:


Version-Release number of selected component (if applicable): 3.7.4


How reproducible:


Steps to Reproduce:
1. echo foo > foo
2. cat > foo.logrotate <<EOF
$PWD/foo {
size 1
rotate 2
}
EOF
3. logrotate -dv foo
  
Actual results:
logrotate -dv foo.logrotate 
reading config file foo.logrotate
reading config info for /tmp/logrotate-3.7.4/foo 

Handling 1 logs

rotating pattern: /tmp/logrotate-3.7.4/foo  1048576 bytes (2 rotations)
empty log files are rotated, only log files >= 1 bytes are rotated, old logs are
removed
considering log /tmp/logrotate-3.7.4/foo
  log does not need rotating


Expected results:
reading config file foo.logrotate
reading config info for /tmp/logrotate-3.7.4/foo 

Handling 1 logs

rotating pattern: /tmp/logrotate-3.7.4/foo  1 bytes (2 rotations)
empty log files are rotated, old logs are removed
considering log /tmp/logrotate-3.7.4/foo
  log needs rotating
rotating log /tmp/logrotate-3.7.4/foo, log->rotateCount is 2
renaming /tmp/logrotate-3.7.4/foo.2 to /tmp/logrotate-3.7.4/foo.3 (rotatecount
2, logstart 1, i 2), 
renaming /tmp/logrotate-3.7.4/foo.1 to /tmp/logrotate-3.7.4/foo.2 (rotatecount
2, logstart 1, i 1), 
renaming /tmp/logrotate-3.7.4/foo.0 to /tmp/logrotate-3.7.4/foo.1 (rotatecount
2, logstart 1, i 0), 
renaming /tmp/logrotate-3.7.4/foo to /tmp/logrotate-3.7.4/foo.1
removing old log /tmp/logrotate-3.7.4/foo.3


Additional info:

Bug is at config.c line 620 being interfered with by 589.  You compare size
against opt, but the string opt pointed to was restored to its original value on
line 589 which causes the match to fail.  This means assignments to size and
minsize always get assigned to minsize.

Comment 1 Tomas Smetana 2007-07-09 07:47:16 UTC
You're right. Thanks for reporting.

Comment 2 Chet Burgess 2007-08-03 20:01:22 UTC
I didn't see a fix for this issue and since I needed the latest logrotate to
address another bug I was encountering I have created a patch for this bug. I
have attached a simple fix for this issue.

Comment 3 Chet Burgess 2007-08-03 20:02:27 UTC
Created attachment 160651 [details]
Patch to address size option not working

Comment 4 Tomas Smetana 2007-08-06 07:46:52 UTC
This bug is against RHEL, so you have to wait for the next update. If you
require a hotfix then you must contact the customer support.

Comment 5 Tomas Smetana 2007-08-13 07:48:37 UTC
*** Bug 251596 has been marked as a duplicate of this bug. ***

Comment 12 errata-xmlrpc 2007-11-15 14:07:41 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-1002.html


Comment 14 Tomas Smetana 2008-06-03 12:10:58 UTC
*** Bug 448622 has been marked as a duplicate of this bug. ***

Comment 15 brandon.franks.011 2019-08-06 22:25:17 UTC
I am experiencing this bug while using logrotate version 3.8.6. Why is that?