From: Frank Lichtenheld Date: Fri, 29 Feb 2008 17:35:41 +0000 (+0100) Subject: Dpkg::Changelog::Debian: Fix regression in header parsing X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32a82f11db52cacd21723bda85f19bc9dd41cd41;p=dpkg Dpkg::Changelog::Debian: Fix regression in header parsing * scripts/Dpkg/Changelog/Debian.pm (parse): One patch against the old parser that allowed chars '+' and '.' in distribution names was not forward ported into the new parser. Do this now. * scripts/t/600_Dpkg_Changelog/regression: Add testcase for this regression. --- diff --git a/ChangeLog b/ChangeLog index 4a509873..8615cd80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-02-29 Frank Lichtenheld + + * scripts/Dpkg/Changelog/Debian.pm (parse): + One patch against the old parser that allowed + chars '+' and '.' in distribution names was + not forward ported into the new parser. Do + this now. + * scripts/t/600_Dpkg_Changelog/regression: + Add testcase for this regression. + + 2008-02-22 Raphael Hertzog Mike Frysinger diff --git a/debian/changelog b/debian/changelog index 18a08941..782d279e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -60,6 +60,9 @@ dpkg (1.14.17) UNRELEASED; urgency=low .changes files. Information will be available in Checksums-Sha{1,256} fields. .changes format version increased to 1.8. * Link dselect against libncursesw. Closes: #466321 + * Forward port a patch from the old changelog parser to the new + one that got lost during the transition. '+' and '.' can now + be used in distribution names yet again. Closes: XXX [ Updated dpkg translations ] * Korean (Changwoo Ryu). @@ -84,7 +87,7 @@ dpkg (1.14.17) UNRELEASED; urgency=low * Polish (Robert Luberda). * Romanian (Eddy Petrișor). - -- Eddy Petrișor Sat, 09 Feb 2008 13:22:38 +0200 + -- Frank Lichtenheld Fri, 29 Feb 2008 18:34:54 +0100 dpkg (1.14.16.6) unstable; urgency=medium diff --git a/scripts/Dpkg/Changelog/Debian.pm b/scripts/Dpkg/Changelog/Debian.pm index 2aa26874..d7f0c9de 100644 --- a/scripts/Dpkg/Changelog/Debian.pm +++ b/scripts/Dpkg/Changelog/Debian.pm @@ -134,7 +134,8 @@ sub parse { while (<$fh>) { s/\s*\n$//; # printf(STDERR "%-39.39s %-39.39s\n",$expect,$_); - if (m/^(\w[-+0-9a-z.]*) \(([^\(\) \t]+)\)((\s+[-0-9a-z]+)+)\;/i) { + my $name_chars = qr/[-+0-9a-z.]/; + if (m/^(\w$name_chars*) \(([^\(\) \t]+)\)((\s+$name_chars+)+)\;/i) { unless ($expect eq 'first heading' || $expect eq 'next heading or eof') { $entry->{ERROR} = [ $file, $NR, diff --git a/scripts/t/600_Dpkg_Changelog.t b/scripts/t/600_Dpkg_Changelog.t index 6c4837ab..71827181 100644 --- a/scripts/t/600_Dpkg_Changelog.t +++ b/scripts/t/600_Dpkg_Changelog.t @@ -6,7 +6,7 @@ use warnings; use File::Basename; BEGIN { - my $no_examples = 3; + my $no_examples = 4; my $no_err_examples = 1; my $no_tests = $no_examples * 4 + $no_err_examples * 2 @@ -32,7 +32,8 @@ my $test = Dpkg::Changelog::Debian->init( { infile => '/nonexistant', ok( !defined($test), "fatal parse errors lead to init() returning undef"); my $save_data; -foreach my $file ("$srcdir/countme", "$srcdir/shadow", "$srcdir/fields") { +foreach my $file ("$srcdir/countme", "$srcdir/shadow", "$srcdir/fields", + "$srcdir/regressions") { my $changes = Dpkg::Changelog::Debian->init( { infile => $file, quiet => 1 } ); @@ -217,20 +218,21 @@ Xc-Userfield: foobar # 'version numbers in module and Changes match' ); # } - my $oldest_version = $data[-1]->{Version}; - $str = $changes->dpkg_str({ since => $oldest_version }); + SKIP: { + skip("avoid spurios warning with only one entry", 2) + if @data == 1; -# is( $str, `dpkg-parsechangelog -v$oldest_version -l$file`, -# 'Output of dpkg_str equal to output of dpkg-parsechangelog' ) -# or diag("oldest_version=$oldest_version"); + my $oldest_version = $data[-1]->{Version}; + $str = $changes->dpkg_str({ since => $oldest_version }); - $str = $changes->rfc822_str(); + $str = $changes->rfc822_str(); - ok( 1 ); + ok( 1 ); - $str = $changes->rfc822_str({ since => $oldest_version }); + $str = $changes->rfc822_str({ since => $oldest_version }); - ok( 1 ); + ok( 1 ); + } } open CHANGES, '<', "$srcdir/countme"; diff --git a/scripts/t/600_Dpkg_Changelog/regressions b/scripts/t/600_Dpkg_Changelog/regressions new file mode 100644 index 00000000..356174ad --- /dev/null +++ b/scripts/t/600_Dpkg_Changelog/regressions @@ -0,0 +1,6 @@ +re-gressions++1.2.3 (1.5-1) allowed.chars-567+890; urgency=low + + * Test allowed chars in package name and distribution name. + (Closes: #361171) + + -- Frank Lichtenheld Thu, 01 Jan 1970 00:00:00 +0000