Package: dpkg-dev
Version: 1.15.6
Severity: normal
Tags: patch

.dsc files haven't always had a Format field.  It was introduced in dpkg
1.6.13, in May 2000.  This means that it's still not entirely
implausible to run across source packages without Format, for example
when importing the history of a source package into revision control.  I
found one here:

  http://snapshot-dev.debian.org/package/nethack-spoilers/3.2.2-1/

dpkg-source fails to unpack this with:

  dpkg-source.pl: error: missing critical source control field Format

When the Format field was introduced, it was just in preparation for
future changes, not accompanying a format change itself.  Thus,
dpkg-source should treat a missing Format field as 1.0, for
compatibility with these old packages.

diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index 3ebfc56..fb57359 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -144,7 +144,7 @@ sub initialize {
     $fields->load($filename);
     $self->{'fields'} = $fields;
 
-    foreach my $f (qw(Source Format Version Files)) {
+    foreach my $f (qw(Source Version Files)) {
         unless (defined($fields->{$f})) {
             error(_g("missing critical source control field %s"), $f);
         }
@@ -158,6 +158,8 @@ sub initialize {
 sub upgrade_object_type {
     my ($self, $update_format) = @_;
     $update_format = 1 unless defined $update_format;
+    $self->{'fields'}{'Format'} = '1.0'
+        unless exists $self->{'fields'}{'Format'};
     my $format = $self->{'fields'}{'Format'};
 
     if ($format =~ /^([\d\.]+)(?:\s+\((.*)\))?$/) {

Thanks,

-- 
Colin Watson                                       [[email protected]]



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to