First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 107906
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Daniel Gryniewicz <dang@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Boris Zijsling <boriz@home.nl>
Add CC:
CC:
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
logrotate-3.7.1-weekly.patch patch for the problem. patch Boris Zijsling 2005-10-02 09:05 0000 1.14 KB Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 107906 depends on: Show dependency tree
Bug 107906 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2005-10-02 09:04 0000
http://forums.gentoo.org/viewtopic-p-2769131.html    
    
The bug is lenghtily outlined there.    
    
Short version: Logrotate does not rotate weekly items correctly.   
   
I made a patch which applies cleanly against logrotate.3.7.1-r1. I made a  
revised ebuild which installed no problems on my system. I haven't tested the  
changes for correctness yet, as that requires some time.  
  
Here's the patch  
 
--- logrotate-3.7.1-old/logrotate.c     2004-10-19 23:41:24.000000000 +0200  
 +++ logrotate-3.7.1-new/logrotate.c     2005-10-02 17:29:22.380767321 +0200  
 @@ -424,12 +424,15 @@ int findNeedRotating(logInfo * log, int  
          switch (log->criterium) {  
            case ROT_WEEKLY:  
              /* rotate if:  
 -                  1) the current weekday is before the weekday of the  
 -                     last rotation  
 +                  1) the day of the week is the same as the day of the week 
of  
 +                     the previous rotation but not the same day of the year  
 +                     this will rotate it on the same day every week, but not  
 +                     twice a day.  
                    2) more then a week has passed since the last  
                       rotation */  
 -            state->doRotate = ((now.tm_wday < state->lastRotated.tm_wday) ||  
 -                              ((mktime(&now) - mktime(&state->lastRotated)) 
>  
 +            state->doRotate = ((now.tm_wday == state->lastRotated.tm_wday &&  
 +                               now.tm_yday != state->lastRotated.tm_yday) ||  
 +                               ((mktime(&now) - mktime(&state->lastRotated)) 
>  
                                 (7 * 24 * 3600)));  
              break;  
            case ROT_MONTHLY:

------- Comment #1 From Boris Zijsling 2005-10-02 09:05:48 0000 -------
Created an attachment (id=69735) [details]
patch for the problem.

Please review changes for correctness.

------- Comment #2 From Boris Zijsling 2005-10-09 00:24:30 0000 -------
It works:

-rw-------  1 root    root      57996 Oct  9 09:19 messages
-rw-------  1 root    root     155760 Oct  9 00:10 messages.1.gz
-rw-------  1 root    root     197750 Oct  2 18:53 messages.2.gz

logrotate -d shows this right now (9:20):

rotating pattern: /var/log/messages  weekly (52 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/messages
  log does not need rotating

------- Comment #3 From Daniel Gryniewicz 2005-10-10 12:30:51 0000 -------
Thanks.  I'll add the patch hopefully tonight.

------- Comment #4 From Daniel Gryniewicz 2005-10-15 15:10:36 0000 -------
fixed in 3.7.1-r2.  Sorry for the delay.

First Last Prev Next    No search results available      Search page      Enter new bug