Bug 169885 - logrotate cleanups and indentations
Summary: logrotate cleanups and indentations
Alias: None
Product: Fedora
Classification: Fedora
Component: logrotate   
(Show other bugs)
Version: rawhide
Hardware: All Linux
Target Milestone: ---
Assignee: Peter Vrabec
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-10-04 18:40 UTC by Mateus César Gröess
Modified: 2007-11-30 22:11 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-10-12 13:00:44 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Cleanups and indentation fixes (9.64 KB, patch)
2005-10-04 18:40 UTC, Mateus César Gröess
no flags Details | Diff
Cleanups only, without the indentation changes. (3.15 KB, patch)
2005-10-10 12:53 UTC, Mateus César Gröess
no flags Details | Diff

Description Mateus César Gröess 2005-10-04 18:40:30 UTC
Hi! New suggested patch (against logrotate-3.7.2-4), this time to do some
cleanups and fix indentation in logrotate (at least looks good when using my
good old VI and tab with size 8).

One question:

In logrotate.c (line 631 of 3.7.2-4), there is this code to mail and remove
logs, when LOG_FLAG_DATEEXT is used:

                            if (!hasErrors && log->logAddress) {
                                char * mailFilename =
                                hasErrors = mailLogWrapper(mailFilename,
mailCommand, logNum, log);
                                if (!hasErrors)
                                    hasErrors = removeLogFile(mailFilename);

After the previous code, there is also this code (line 669) that do almost the
same when LOG_FLAG_DATEEXT isn't used:

                    char * mailFilename = (globResult.gl_pathv)[i];
                    if (!hasErrors && log->logAddress)
                        hasErrors = mailLogWrapper(mailFilename, mailCommand,
logNum, log);
                    if (!hasErrors)
                        hasErrors = removeLogFile(mailFilename);

Note that in second code the log removal doesn't depend on log->logAddress, but
the first do. Shouldn't both codes behave exactly the same way?

Comment 1 Mateus César Gröess 2005-10-04 18:40:31 UTC
Created attachment 119619 [details]
Cleanups and indentation fixes

Comment 2 Peter Vrabec 2005-10-07 08:34:50 UTC
I understand the first code(whole context), it drops old logs.
  rotatecount = 2
foo-20051008 should have not existed, because rotatecount==2, but if it
exists(somehow) it is removed in case mail address is provided.
I guess second code should do something similar but don't not how.

I suggest to do indention by  "indent -bsd"(I vote for bsd style)

Comment 3 Mateus César Gröess 2005-10-10 12:53:12 UTC
Created attachment 119770 [details]
Cleanups only, without the indentation changes.

Ok, I just proposed changes to correct bad indentation in some lines, haven't
used "indent". I attached another patch with cleanups only and a change to
second "if" described above, to make it act like the first. Maybe it's better
the maintainer do indentation changes according with his taste.

Comment 4 Ruediger Oertel 2005-10-10 23:52:01 UTC
well, according to the manpage, a to-be-removed logfile is 
- mailed out if an address is given 
- removed then, regardless if the address was given or not 
in that sense, I guess it is perfectly ok to remove the logfile 
in both code snippets, regardless if logAdress is set or not. 

Comment 5 Peter Vrabec 2005-10-12 13:00:03 UTC
Fixed in logrotate-3.7.2-6 in devel.
Indent will by apllied in next release 3.7.3.

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