This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 427596 - mailto patch breaks logwatch.conf MailTo setting
mailto patch breaks logwatch.conf MailTo setting
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: logwatch (Show other bugs)
7
noarch Linux
low Severity medium
: ---
: ---
Assigned To: Ivana Varekova
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-04 19:27 EST by John Saalwaechter
Modified: 2008-03-01 07:39 EST (History)
1 user (show)

See Also:
Fixed In Version: 7.3.6-15.fc8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-02-28 16:46:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description John Saalwaechter 2008-01-04 19:27:40 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11

Description of problem:
The logwatch-7.3.4-mailto.patch introduced in this rpm breaks the MailTo
setting contained in /etc/logwatch/conf/logwatch.conf.  That patch contains
this:

--- logwatch-7.3.4/scripts/logwatch.pl.pom      2007-04-13 15:43:35.000000000 +0200
+++ logwatch-7.3.4/scripts/logwatch.pl  2007-04-20 12:14:43.000000000 +0200
@@ -312,6 +312,13 @@

 CleanVars();

+#if MAILTO is set in the environment, grab it as we may be being used by
+#cron or anacron, which do not set command line args.
+if ($ENV{'MAILTO'})
+  {
+    $Config{'mailto'} = $ENV{'MAILTO'};
+  }
+
 if ($OldMailTo ne $Config{'mailto'}) {
    $Config{'print'} = 0;
 } elsif ($OldPrint ne $Config{'print'}) {

The problem is that this code patch is inserted below the point where
logwatch.pl has read its config file at /etc/logwatch/conf/logwatch.conf.
So it clobbers the MailTo setting from that config file.  This happens
because in Fedora 7, logwatch is run from /etc/cron.daily/0logwatch,
which is controlled from /etc/crontab, which contains a MAILTO=root
line.

I'm not sure what prompted this patch, but if it's truly necessary, then
the code to grab MAILTO from the environment should occur *before* the
script reads its config files, so that the logwatch.conf has precedence.

Version-Release number of selected component (if applicable):
logwatch-7.3.4-9.fc7

How reproducible:
Always


Steps to Reproduce:
1. set "MailTo = myself@someemail.com" in /etc/logwatch/conf/logwatch.conf
2. let logwatch run from /etc/cron.daily/0logwatch as usual


Actual Results:
No email to the configured email address in logwatch.conf.  Instead the logwatch
output is only emailed to the local root account.

Expected Results:
The logwatch output shoud be emailed to the address defined in logwatch.conf

Additional info:
Comment 1 Ivana Varekova 2008-01-09 06:53:36 EST
Thanks. Fixed in logwatch-7.3.4-10.fc7
Comment 2 Fedora Update System 2008-01-11 17:16:22 EST
logwatch-7.3.6-13.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update logwatch'
Comment 3 Fedora Update System 2008-01-11 17:20:07 EST
logwatch-7.3.4-10.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update logwatch'
Comment 4 Fedora Update System 2008-01-27 02:19:47 EST
logwatch-7.3.4-10.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 5 Fedora Update System 2008-01-27 02:28:22 EST
logwatch-7.3.6-13.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 6 Milan Slanař 2008-02-08 08:08:12 EST
logwatch-7.3.6-13.fc8 introduced this bug to me! Downgrading to
logwatch-7.3.6-12.fc8 fixed correct handling of /etc/logwatch/conf/logwatch.conf
MailTo setting for me. Should be reopened.
Comment 7 Hameedullah Khan 2008-02-13 12:33:45 EST
Yes, the bug is still present in logwatch-7.3.6-13.fc8 and all our 40+ hosts are
using the same version, so downgrading it would be impossible. 

So, this bug report should be reopened, as it needs fixing.
Comment 8 John Saalwaechter 2008-02-13 12:49:55 EST
I'm the original reporter, and for reference, logwatch-7.3.4-10.fc7 did fix the
problem on my Fedora 7 system.  I don't have access to Fedora 8 to see what's
wrong there.
Comment 9 Askar Ali Khan 2008-02-13 12:58:36 EST
logwatch was fine on Fedora 7 and reading its MailTo from config while running
under cron, however on Fedora 8 which got logwatch-7.3.6-13.fc8 installed its no
longer reading (or honoring MailTo) while its run under cron.
Comment 10 Askar Ali Khan 2008-02-17 01:45:41 EST
Ok here is the fix that works fine for me on 40+ Fedora 8 hosts, fixed was
suggested on logwatch mailing list see ..

http://www2.list.logwatch.org:81/pipermail/logwatch/2008-February/001679.html

Under Fedora 8 to fix this issue the logwatch.pl script must be
>     modified. This should be reported back up to Fedora. Basically you need
>     to move the ENV kludge forward. Line 63 is about right and it should
>     look like this
> 
>     #Honor ENV MAILTO as default if exists -mgt
>     if ($ENV{'MAILTO'}) {
>         $Config{'mailto'} = $ENV{'MAILTO'};
>     } else {
>         $Config{'mailto'} = "root";
>     }
> 
>     Then remove the other ENV setting at around line 362 just remove the
>     whole conditional.


I am sure Fedora folks will soon roll out updated rpm for logwatch after reading
this bug and the solution to fix.

Thanks.
Askar
Comment 11 Fedora Update System 2008-02-20 11:03:48 EST
logwatch-7.3.6-15.fc8 has been submitted as an update for Fedora 8
Comment 12 Fedora Update System 2008-02-20 21:55:27 EST
logwatch-7.3.6-15.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update logwatch'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F8/FEDORA-2008-1885
Comment 13 Fedora Update System 2008-02-28 16:46:34 EST
logwatch-7.3.6-15.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 14 Askar Ali Khan 2008-03-01 07:39:22 EST
Thank you very much after updating to logwatch-7.3.6-15.fc8 on 50+ hosts and it
fixed the issue of logwatch not sending emails to which has been defined in
/etc/logwatch/conf/logwatch.conf file

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