Package: libparse-debian-packages-perl
Version: 0.01-1
Severity: normal
Tags: patch

When there is a colon in the text description of a package, parsing fails
by treating it as if a key for the returned hash has been found.  So as 
well as the normal keys, such as Section, Filename, etc., some random keys
get created occasionally.  For instance, the first package in the current
Packages file for sid, 2vcard, comes up with an unexpected key of
'and alias files from the following formats'.

The attached patch fixes this; it also makes next() return a reference to
%package rather than a copy of it, which seems to run more quickly.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-epos (PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_GB.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libparse-debian-packages-perl depends on:
ii  libyaml-perl                  0.71-1     YAML Ain't Markup Language
ii  perl                          5.10.1-12  Larry Wall's Practical Extraction 

libparse-debian-packages-perl recommends no packages.

libparse-debian-packages-perl suggests no packages.

-- no debconf information
--- Packages.pm.orig    2010-04-24 23:00:15.000000000 +0100
+++ Packages.pm 2010-04-24 23:42:44.000000000 +0100
@@ -15,8 +15,8 @@
 
     my %parsed;
     while (<$fh>) {
-        last if /^$/;
-        if (my ($key, $value) = m/^(.*): (.*)/) {
+        return \%parsed if (/^$/);
+        if (my ($key, $value) = m/^(\S*): (.*)/) {
             $parsed{$key} = $value;
         }
         else {
@@ -26,7 +26,7 @@
         }
     }
 
-    return %parsed;
+    return;
 }
 
 1;
@@ -44,8 +44,8 @@
  my $fh = IO::File->new("Packages");
 
  my $parser = Parse::Debian::Packages->new( $fh );
- while (my %package = $parser->next) {
-     print Dump \%package;
+ while (my $package = $parser->next) {
+     print Dump \$package;
  }
 
 =head1 DESCRIPTION

Reply via email to