This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 169885 - logrotate cleanups and indentations
logrotate cleanups and indentations
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: logrotate (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Vrabec
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-10-04 14:40 EDT by Mateus César Gröess
Modified: 2007-11-30 17:11 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-12 09:00:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


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

  None (edit)
Description Mateus César Gröess 2005-10-04 14:40:30 EDT
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 =
(globResult.gl_pathv)[mail_out];
                                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 14:40:31 EDT
Created attachment 119619 [details]
Cleanups and indentation fixes
Comment 2 Peter Vrabec 2005-10-07 04:34:50 EDT
I understand the first code(whole context), it drops old logs.
Example:
  rotatecount = 2
  foo
  foo-20051008
  foo-20051009
  foo-20051010
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 08:53:12 EDT
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 19:52:01 EDT
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 09:00:03 EDT
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.