Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 650806 - app-portage/cfg-update-1.8.9 - Use of uninitialized value $md5sum_file in regexp compilation at /usr/bin/cfg-update line 1000.
Summary: app-portage/cfg-update-1.8.9 - Use of uninitialized value $md5sum_file in reg...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Richard Freeman
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2018-03-18 17:42 UTC by Phil Stracchino (Unix Ronin)
Modified: 2019-09-19 22:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to fix uninitialized use of $md5sum_file in determine_state( ) (cfg-update-uninitialized.diff,2.24 KB, patch)
2018-03-18 17:42 UTC, Phil Stracchino (Unix Ronin)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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