Skip Menu |

This queue is for tickets about the Parse-Debian-Packages CPAN distribution.

Report information
The Basics
Id: 81744
Status: open
Priority: 0/
Queue: Parse-Debian-Packages

People
Owner: Nobody in particular
Requestors: carnil [...] debian.org
Cc: gregoa [...] cpan.org
AdminCc:

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



From: CARNIL [...] cpan.org
Subject: libparse-debian-packages-perl: Problem parsing stanzas with more than 1 multiline entry
This bug has been forwarded from http://bugs.debian.org/695274 Thanks in advance, Salvatore Bonaccorso, Debian Perl Group
Subject: Re: [rt.cpan.org #81744] libparse-debian-packages-perl: Problem parsing stanzas with more than 1 multiline entry
Date: Thu, 6 Dec 2012 16:28:31 +0100
To: Bugs in Parse-Debian-Packages via RT <bug-Parse-Debian-Packages [...] rt.cpan.org>
From: Salvatore Bonaccorso <carnil [...] cpan.org>
Hi By mistake this was sent without further information. I'm quoting here the Debian bug, reported at the link in my original message: ----cut---------cut---------cut---------cut---------cut---------cut----- Package: libparse-debian-packages-perl Version: 0.03-1 Severity: grave Tags: upstream Justification: causes non-serious data loss Using libparse-debain-packages-perl, the following problem arises when parsing stanzas with more than 1 multiline entry: If a multiline entry is found, all lines of this entry are added to the result map under the key "body". If a different multiline entry is processed later on, all multiline entries are added to the same map entry "body", effectively mixing up content from different multiline fields. To demonstrate this, i used the attached source "test_packages.pl", together with the file unzipped file "Packages" from ftp://ftp.tugraz.at/mirror/debian/dists/sid/main /binary-amd64/Packages.gz. The relevant part of the Packages file looks like this: Package: browser-plugin-vlc Source: npapi-vlc Version: 2.0.0-2 Installed-Size: 201 Maintainer: Debian Multimedia Maintainers <pkg-multimedia- maintainers@lists.alioth.debian.org> Architecture: amd64 Replaces: mozilla-plugin-vlc (<< 2.0.0) Depends: vlc, libatk1.0-0 (>= 1.12.4), libc6 (>= 2.3.4), libcairo2 (>= 1.2.4), libfontconfig1 (>= 2.9.0), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.12.0), libgtk2.0-0 (>= 2.24.0), libice6 (>= 1:1.0.0), libpango1.0-0 (>= 1.14.0), libsm6, libstdc++6 (>= 4.1.1), libvlc5 (>= 1.1.0), libx11-6 Breaks: mozilla-plugin-vlc (<< 2.0.0) Description: multimedia plugin for web browsers based on VLC Homepage: http://www.videolan.org/vlc/ Description-md5: 1dfbd075b62a574a99794b2eb520c80e Npp-Applications: 92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a, ec8030f7-c20a-464f-9b0e-13a3a9e97384 Npp-Description: play video and audio in Firefox using the VLC Multimedia Player Npp-File: libvlcplugin.so Npp-Mimetype: application/mpeg4-iod, application/mpeg4-muxcodetable, application/ogg, application/x-google-vlc-plugin, application/x-mplayer2, application/x-ogg, application/x-vlc-plugin, audio/3gpp, audio/3gpp2, audio/mpeg, audio/mpeg4, audio/wav, audio/x-mpeg, audio/x-wav, video/3gpp, video/3gpp2, video/mpeg, video/mpeg-system, video/mpeg4, video/quicktime, video/x-mpeg, video/x-mpeg-system, video/x-ms-asf, video/x-ms-asf-plugin, video/x-ms-wmv, video/x-msvideo Npp-Name: VLC Multimedia Plugin Tag: uitoolkit::gtk Section: video Priority: optional Filename: pool/main/n/npapi-vlc/browser-plugin-vlc_2.0.0-2_amd64.deb Size: 51758 MD5sum: 1714be2acb3cd2d7c1a53f5d86704c34 SHA1: aa57cb8dbb6d7291862968bf27e94ad8652f1fa2 SHA256: 1ca5784dedc8735f652bc47d50afc4b19d7577fd68b321cf063244bb408f8209 The output using libparse-debian-packages-perl yields the following output: --- Architecture: amd64 Breaks: mozilla-plugin-vlc (<< 2.0.0) Depends: 'vlc, libatk1.0-0 (>= 1.12.4), libc6 (>= 2.3.4), libcairo2 (>= 1.2.4), libfontconfig1 (>= 2.9.0), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.12.0), libgtk2.0-0 (>= 2.24.0), libice6 (>= 1:1.0.0), libpango1.0-0 (>= 1.14.0), libsm6, libstdc++6 (>= 4.1.1), libvlc5 (>= 1.1.0), libx11-6' Description: multimedia plugin for web browsers based on VLC Description-md5: 1dfbd075b62a574a99794b2eb520c80e Filename: pool/main/n/npapi-vlc/browser-plugin-vlc_2.0.0-2_amd64.deb Homepage: http://www.videolan.org/vlc/ Installed-Size: 201 MD5sum: 1714be2acb3cd2d7c1a53f5d86704c34 Maintainer: 'Debian Multimedia Maintainers <pkg-multimedia- maintainers@lists.alioth.debian.org>' Npp-Applications: '92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a,' Npp-Description: play video and audio in Firefox using the VLC Multimedia Player Npp-File: libvlcplugin.so Npp-Mimetype: 'application/mpeg4-iod,' Npp-Name: VLC Multimedia Plugin Package: browser-plugin-vlc Priority: optional Replaces: mozilla-plugin-vlc (<< 2.0.0) SHA1: aa57cb8dbb6d7291862968bf27e94ad8652f1fa2 SHA256: 1ca5784dedc8735f652bc47d50afc4b19d7577fd68b321cf063244bb408f8209 Section: video Size: 51758 Source: npapi-vlc Tag: uitoolkit::gtk Version: 2.0.0-2 body: |2 ec8030f7-c20a-464f-9b0e-13a3a9e97384 application/mpeg4-muxcodetable, application/ogg, application/x-google-vlc-plugin, application/x-mplayer2, application/x-ogg, application/x-vlc-plugin, audio/3gpp, audio/3gpp2, audio/mpeg, audio/mpeg4, audio/wav, audio/x-mpeg, audio/x-wav, video/3gpp, video/3gpp2, video/mpeg, video/mpeg-system, video/mpeg4, video/quicktime, video/x-mpeg, video/x-mpeg-system, video/x-ms-asf, video/x-ms-asf-plugin, video/x-ms-wmv, video/x-msvideo On can easily see, that the line ec8030f7-c20a-464f-9b0e-13a3a9e97384 from the Npp-Applications: entry gets added to the body: entry, which now holds all extra lines from the Npp-Applications: and Npp-Mimetype: entries. Also the entries for Npp-Applications: and Npp-Mimetype: now contain only one line, which is not the original content.This is cleary a bug, as it is now impossible to reconstruct the original content. ----cut---------cut---------cut---------cut---------cut---------cut----- The mentioned test_packages.pl is attached. Regards, Salvatore

Message body is not shown because sender requested not to inline it.

Download signature.asc
application/pgp-signature 836b

Message body not shown because it is not plain text.

Here's the patch we've came up with in Debian. Cheers, gregor
Subject: fix_multiline_fields.patch
Description: fix handling of lines starting with whitespace - they are continuation lines of header fields now - there is no "body" (description) in the Packages file anymore Origin: vendor Bug: https://rt.cpan.org/Public/Bug/Display.html?id=81744 Bug-Debian: https://bugs.debian.org/695274 Forwarded: not-yet Author: Simon Kainz <simon@familiekainz.at> Reviewed-by: gregor herrmann <gregoa@debian.org> Last-Update: 2014-02-28 --- a/lib/Parse/Debian/Packages.pm +++ b/lib/Parse/Debian/Packages.pm @@ -14,15 +14,18 @@ my $fh = $self->{fh}; my %parsed; + my $lastkey; while (<$fh>) { last if /^$/; if (my ($key, $value) = m/^(\S+): (.*)/) { $parsed{$key} = $value; + $lastkey=$key; } else { s/ //; s/^\.$//; - $parsed{body} .= $_; + chomp; + $parsed{$lastkey} .= "\n" . $_; } }