Bug 427596 - mailto patch breaks logwatch.conf MailTo setting
Summary: mailto patch breaks logwatch.conf MailTo setting
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: logwatch
Version: 7
Hardware: noarch
OS: Linux
low
medium
Target Milestone: ---
Assignee: Ivana Varekova
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords: Reopened
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-01-05 00:27 UTC by John Saalwaechter
Modified: 2008-03-01 12:39 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2008-02-28 21:46:37 UTC


Attachments (Terms of Use)

Description John Saalwaechter 2008-01-05 00:27:40 UTC
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 11:53:36 UTC
Thanks. Fixed in logwatch-7.3.4-10.fc7

Comment 2 Fedora Update System 2008-01-11 22:16:22 UTC
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 22:20:07 UTC
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 07:19:47 UTC
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 07:28:22 UTC
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 13:08:12 UTC
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 17:33:45 UTC
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 17:49:55 UTC
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 17:58:36 UTC
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 06:45:41 UTC
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 16:03:48 UTC
logwatch-7.3.6-15.fc8 has been submitted as an update for Fedora 8

Comment 12 Fedora Update System 2008-02-21 02:55:27 UTC
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 21:46:34 UTC
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 12:39:22 UTC
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.