[Logwatch-Devel] errors when upgrading perl to 5.8.0

mark@winksmith.com mark@winksmith.com
Wed, 18 Sep 2002 14:07:16 -0400

i noticed that my logwatch 3.3 stopped working on my box.  i tracked the
problem down to exactly the same moment when i upgraded to perl 5.8.0.
this was found with the sendmail service and i will use that as the
example.  the issue is that the logwatch.pl script itself depends upon
the correct ordering of shared script filtering ($FilterText).

the filter ordering is supposed to be:


this works on 5.6.1 because the hash %{$ServiceData{$ServiceName}} (from
memory) just happens to be ordered correctly (well, reverse ordered, but
correct after reverse() applied).  with 5.8.0 the internal hash
implementation (imo) has changed and thus the ordering is now:


the 'onlyservice' shared filter has no headers (e.g. service name) to
work with and thus does the only thing responsible and that is to filter
out everything.

the short term solution was to use sort(), but this works only because of
the happenstance that 'o' comes before 'r'.  a correct fix is required
which requires the ordering of shared filters, perhaps some kind or weighting
system.  a cheap solution would be to rename filters with a number in front
to imply the weighting and then only filters with the same weighting could be
run simultaneously.  for instance, the 'removeheaders' filter would have to be
run last so it would have a higher number.

Mark Smith
mark at winksmith dot com
mark at tux dot org