Bug 844460

Summary: hash copy interface broken in 2.72
Product: [Fedora] Fedora EPEL Reporter: Dimitri Maziuk <dmaziuk>
Component: perl-Config-IniFilesAssignee: Tom "spot" Callaway <tcallawa>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: el5CC: quiffman, tcallawa
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-21 18:35:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dimitri Maziuk 2012-07-30 17:58:07 UTC
Description of problem:

%hash = %{$ini{$section}} stopped working after 2.72 upgrade.

Version-Release number of selected component (if applicable):

2.72-1.el5

How reproducible:

Always (see test case below).

Steps to Reproduce:

manpage quote:
==============

%hash = %{$ini{$section}}

Using the tie interface, you can copy whole sections of the ini file into another hash. Note that this makes a copy of the entire section. The new hash in no longer tied to the ini file, In particular, this means -default and -nocase settings will not apply to %hash.

test.ini file:
==============

[section1]
  key = val11
  coo = val12
[section2]
  fookey = foo
  barkey = bar
  bazkey = baz
[section3]
  kiki = val31
  cookie = val32

test.pl file:
==============
#!/usr/bin/perl -w

use strict;
use Config::IniFiles;
use Data::Dumper;
$Data::Dumper::Indent = 3;

my %hash;
my $key;

tie %hash, 'Config::IniFiles', ( -file => "test.ini" ) ;
print Dumper(\%hash);
for $key ( keys( %hash ) ) {
    print "+$key\n";
}
print "The source is " . $hash{'section2'}{'barkey'};
print "\n========================================\n";
my %copy = %{$hash{'section2'}};
print "The copy is " . $copy{'barkey'};
print "\n";

  
Actual results:

$ ./test.pl
$VAR1 = {
          'section1' => {},
          'section2' => {},
          'section3' => {}
        };
+section1
+section2
+section3
The source is bar
========================================
Use of uninitialized value in concatenation (.) or string at ./test.pl line 20.
The copy is

Expected results:

Last line should read "The copy is bar" (error message shouldn't be there either).

Additional info:
$ arch
x86_64
$ cat /etc/redhat-release
CentOS release 5.8 (Final)

Comment 1 Fedora Update System 2012-08-02 17:05:19 UTC
perl-Config-IniFiles-2.72-2.el5.2, perl-List-MoreUtils-0.33-5.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2012-6537/perl-Config-IniFiles-2.72-2.el5.2,perl-List-MoreUtils-0.33-5.el5

Comment 2 Fedora Update System 2012-08-05 06:42:00 UTC
Package perl-Config-IniFiles-2.72-2.el5.2, perl-List-MoreUtils-0.33-5.el5:
* should fix your issue,
* was pushed to the Fedora EPEL 5 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing perl-Config-IniFiles-2.72-2.el5.2 perl-List-MoreUtils-0.33-5.el5'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2012-6537/perl-Config-IniFiles-2.72-2.el5.2,perl-List-MoreUtils-0.33-5.el5
then log in and leave karma (feedback).

Comment 3 Richard Guest 2012-08-13 04:01:49 UTC
Yup, I've had the same problem and these updates fix the issue.

Comment 4 Fedora Update System 2012-08-21 18:35:54 UTC
perl-Config-IniFiles-2.72-2.el5.2, perl-List-MoreUtils-0.33-5.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.