Skip Menu |

This queue is for tickets about the Config-General CPAN distribution.

Report information
The Basics
Id: 40925
Status: resolved
Priority: 0/
Queue: Config-General

People
Owner: tlinden [...] cpan.org
Requestors: jschulz.cpan [...] bloonix.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.40
Fixed in: (no value)



Subject: /$indichar/ matches 'äöü'
Hi, I found a bug. Here a simple example: -------- test.conf -------- <section> name = äöü </section> -------- test.pl -------- use strict; use warnings; use Config::General; use Data::Dumper; my $config = { Config::General::ParseConfig( '-ConfigFile' => 'test.conf', '-SplitPolicy' => 'equalsign', ) }; print Dumper($config); Show quoted text
-------- Output -------- $VAR1 = { 'section' => { 'name = ä� => 'ü' } };
-------- Affected lines -------- General.pm 742 if (/$indichar/) { 743 ($option,$value) = split /\s*$indichar\s*/, $_, 2; # separated by heredoc-finding in _open() 744 } 745 else { 746 if ($this->{SplitPolicy} eq 'guess') {
-------- Description -------- SplitPolicy is never checked because /$indichar/ matches the string 'öäü'. It would be joyful if SplitPolicy has a higher priority or to disable $indichar detection '-Indichar => 0' or something else. Cheers Jonny
Can't reproduce: Show quoted text
---- script ---- #!/usr/bin/env perl use strict; use lib qw(blib/lib); use Config::General; use Data::Dumper; my $cg = new Config::General( -InterPolateVars => 1, -ConfigFile => shift(), '-SplitPolicy' => 'equalsign' ); my %hash = $cg->getall(); print Dumper(\%hash);
---- config ---- <section> name = äöü </section>
---- output ---- $VAR1 = { 'section' => { 'name' => 'äöü' } };
this patch will work for this bug. ================================= 584c584 < $hier .= ' ' . chr 132; # append a "・ to the here-doc- name, so --- Show quoted text
> $hier .= ' ' . chr 182; # append a "・ to the here-doc-
name, so 757c757 < my $indichar = chr 132; # ・ inserted by _open, our here-doc indicator --- Show quoted text
> my $indichar = chr 182; # ・ inserted by _open, our here-doc
indicator 768c768 < # separator (ascii 132). --- Show quoted text
> # separator (ascii 182).
======================================= indichar is set chr 182. but some euc-jp chars(multibyte chars) has 182(b6). like ざ(b6a4) and if these chars are in config file, Config::General goes wrong. On 水曜日 12月 17 10:07:33 2008, TLINDEN wrote: Show quoted text
> Can't reproduce: > > ---- script ---- > #!/usr/bin/env perl > use strict; > use lib qw(blib/lib); > use Config::General; > use Data::Dumper; > > my $cg = new Config::General( > -InterPolateVars => 1, > -ConfigFile => shift(), > '-SplitPolicy' => 'equalsign' > ); > > my %hash = $cg->getall(); > > print Dumper(\%hash); > > > > > > ---- config ---- > <section> > name = äöü > </section> > > > > > ---- output ---- > $VAR1 = { > 'section' => { > 'name' => 'äöü' > } > };
fixed in release 2.43. $indichar has been replaced by a 256 bit SHA checksum to circumvent future collisions of this kind.