Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 526752

Summary: sys-apps/logwatch: emerge.log parsing broken since Perl 5.18.x
Product: Gentoo Linux Reporter: Christian Ruppert (idl0r) <idl0r>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: CONFIRMED ---    
Severity: normal CC: sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---

Description Christian Ruppert (idl0r) gentoo-dev 2014-10-25 12:35:01 UTC

the emerge.log parser is broken since Perl 5.18.x.

/var/log/emerge.log.offset contains two timestamps and the last one has no newline.
Later the offset file is concated with /var/log/emerge.log which then ends up in a line with two timestamps not being separated, like:
74685231323806403: Started emerge on: Dec 13, 2011 21:00:03
instead of:
1323806403: Started emerge on: Dec 13, 2011 21:00:03

This caused an error with Perl 5.18.x because strftime() is more strict now and just not simply ignores such broken lines.
That happens in:

The actual problem is IMHO in logwatch itself, not the applydate nor the Portage part. Other modules/script just don't throw an error because they handle/parse it somewhat different but they all should get similar broken lines since logwatch concats those files together.
IMHO the best solution is: to either add a newline to the offset files and/or write a newline char after printing/piping the offset file.

The actual error for emerge/portage is:
Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) at /usr/share/logwatch/scripts/logfiles/emerge/applydate line 69, <STDIN> line 2.
system 'cat '/var/cache/logwatch/logwatch.sg2KnV_A/emerge-archive' '/var/log/emerge.log'  | /usr/bin/perl5.18.2 /usr/share/logwatch/scripts/logfiles/emerge/applydate>/var/cache/logwatch/logwatch.sg2KnV_A/emerge'
failed: 65280 at /usr/sbin/ line 862.

Tested with logwatch up to 7.4.0_p170-r1. There is a 7.4.1 release which I haven't tried yet but I doubt it has been fixed there already. But I'll take a look later.