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

Bug 450146

Summary: app-portage/genlop-0.30.8-r2 does not handle empty and missing files gracefully
Product: Portage Development Reporter: Massimo Burcheri <burcheri.massimo+bugs-gentoo>
Component: Third-Party ToolsAssignee: Portage Tools Team <tools-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Massimo Burcheri 2013-01-04 07:48:55 UTC
I'm rotating /var/log/emerge.log by logrotate with 2 bzip2 archives. So I have that alias in my profile:

alias genlop='genlop -f /var/log/emerge.log -f /var/log/emerge.log.1.bz2 -f 

That usually works fine but leads to errors if some of the files are missing or empty.

So I start with an empty set by
# touch /var/log/emerge.log.{1,2}.bz2

But these empty files lead to perl warnings:

using logfile /var/log/emerge.log
using logfile /var/log/emerge.log.1.bz2
using logfile /var/log/emerge.log.2.bz2
Use of uninitialized value $fline in split at /usr/bin/genlop line 159.
Use of uninitialized value $fline in split at /usr/bin/genlop line 159.
Use of uninitialized value $ordered{"/var/log/emerge.log.2.bz2"} in numeric comparison (<=>) at /usr/bin/genlop line 161.
Use of uninitialized value $ordered{"/var/log/emerge.log"} in numeric comparison (<=>) at /usr/bin/genlop line 161.
Use of uninitialized value $ordered{"/var/log/emerge.log.2.bz2"} in numeric comparison (<=>) at /usr/bin/genlop line 161.
Use of uninitialized value $ordered{"/var/log/emerge.log"} in numeric comparison (<=>) at /usr/bin/genlop line 161.


Please make genlop
1. more tolerant for missing files and
2. more robust for empty files
Comment 1 Paul Varner (RETIRED) gentoo-dev 2013-01-22 20:43:20 UTC
This has been fixed and pushed to the git repository.  You can test using genlop-9999 which is the same as genlop-0.30.9-r1 plus a bash completion fix and this change.

This change now does the following
1. Warns if a log file is unreadable
2. Does not print "Use of uninitialized value" if the log file is empty
3. If no readable log files are found, it warns and defaults to /var/log/emerge.log
Comment 2 Massimo Burcheri 2013-01-24 08:46:15 UTC
Thanks, perl warnings are removed.
However that current version seems to add another bug 453774.