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

Bug 650806

Summary: app-portage/cfg-update-1.8.9 - Use of uninitialized value $md5sum_file in regexp compilation at /usr/bin/cfg-update line 1000.
Product: Gentoo Linux Reporter: Phil Stracchino (Unix Ronin) <phils>
Component: Current packagesAssignee: Richard Freeman <rich0>
Status: UNCONFIRMED ---    
Severity: normal CC: che
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch to fix uninitialized use of $md5sum_file in determine_state( )

Description Phil Stracchino (Unix Ronin) 2018-03-18 17:42:55 UTC
Created attachment 524284 [details, diff]
Patch to fix uninitialized use of $md5sum_file in determine_state( )

Example:

minbar:root:~:7 # cfg-update -l
Searching for updates...
Use of uninitialized value $md5sum_file in regexp compilation at /usr/bin/cfg-update line 1000.
1    Unmodified File    /etc/apache2/vhosts.d/._cfg0000_00_default_ssl_vhost.conf
Use of uninitialized value $md5sum_file in regexp compilation at /usr/bin/cfg-update line 1000.
2    Unmodified File    /etc/apache2/vhosts.d/._cfg0000_00_default_vhost.conf
Use of uninitialized value $md5sum_file in regexp compilation at /usr/bin/cfg-update line 1000.
3    Unmodified File    /etc/apache2/vhosts.d/._cfg0000_default_vhost.include

$md5sum_file is declared globally, but not initialized, at /usr/bin/cfg-update line 176.  It is then never used except within determine_state( ), which will use it without initialization if $file1 is not found.

($md5sum_index is also declared as a global but then never used outside of determine_state( ).  It looks like pretty much EVERYTHING is declared globally, whether used globally or not.)

Fix is pretty straightforward, and is attached.  This patch does two things:
1.  Move the declarations of $md5sum_file and $md5sum_index into determine_state( ), since they are used nowhere else;
2.  Modify determine_state( ) so that the code block beginning at line 1000, which compares md5sums for $file1, is executed only if $file1 was actually found and an md5sum for it was calculated.
Comment 1 Jochen Schlick 2019-09-19 22:32:04 UTC
- have exactly the same problem in lxc container.
- occured directly after updating perl (5.26 --> 5.28)
- provided patch fixes it