Broken argument parsing in Lexicon::import().

Bug #321688 reported by Remo Inverardi
4
Affects Status Importance Assigned to Milestone
liblocale-maketext-lexicon-perl (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

The Locale::Maketext::Lexicon::import() function of the liblocale-maketext-lexicon-perl fails to parse its arguments correctly. As a result, the following function call does not work:

> Locale::Maketext::Lexicon->import(Gettext => '/tmp/sample.po');

While trying to check if the number of arguments is *even*, the import() function actually checks if an *odd* number of arguments was passed. From /usr/share/perl5/Locale/Maketext/Lexicon.pm +213:

> sub import {
> my $class = shift;
> return unless @_;
>
> my %entries;
> if (UNIVERSAL::isa($_[0], 'HASH')) {
> # a hashref with $lang as keys, [$format, $src ...] as values
> %entries = %{$_[0]};
> }
> elsif (@_ % 2) {
> %entries = ( '' => [ @_ ] );
> }

The elsif statement on line 222 should read:

> elsif (@_ % 2 == 0) {
> %entries = ( '' => [ @_ ] );
> }

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=6.06
DISTRIB_CODENAME=dapper
DISTRIB_DESCRIPTION="Ubuntu 6.06.2 LTS"

$ apt-cache policy liblocale-maketext-lexicon-perl
liblocale-maketext-lexicon-perl:
  Installed: 0.53-1
  Candidate: 0.53-1
  Version table:
 *** 0.53-1 0
        500 http://archive.ubuntu.com dapper/universe Packages
        100 /var/lib/dpkg/status

Thanks.

Revision history for this message
Remo Inverardi (j-launchpad+nospam-inverardi-ch) wrote :
Revision history for this message
TheHobbit (the-hobbit) wrote :

The bug is known and solved upstream (see version 0.77 of the Locale::Maketext::Lexicon on cpan http://search.cpan.org/~drtech/Locale-Maketext-Lexicon-0.77/

Changed in liblocale-maketext-lexicon-perl (Ubuntu):
status: New → Confirmed
Revision history for this message
TheHobbit (the-hobbit) wrote :

The bug does not affect Jaunty (which sports release0.75)

Revision history for this message
TheHobbit (the-hobbit) wrote :

I was wrong and I crave the community pardon... The bug is not there.... it was fixed in ubuntu with the upload of 0.62-1

Changed in liblocale-maketext-lexicon-perl (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
TheHobbit (the-hobbit) wrote :

It was fixed in ubuntu with the upload of 0.62-1

Changed in liblocale-maketext-lexicon-perl (Ubuntu):
status: Invalid → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.