The following commit has been merged in the master branch:
commit bb38862b4a6232b89f5f20abbb5d20756b34d4d6
Author: Guillem Jover <[email protected]>
Date: Thu Jul 25 03:31:01 2013 +0200
Dpkg::Source::Package: Do not scan control file twice for PGP signature
The code was pre-scanning the control file looking for a PGP signature,
and the parser was doing a more thorough check later on. Just remove the
double parsing, and rely on the more accurate one from the parser.
diff --git a/debian/changelog b/debian/changelog
index 193cf7a..7f52af0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -140,6 +140,7 @@ dpkg (1.17.0) UNRELEASED; urgency=low
which might be problematic when cross-compiling. Closes: #698881
* Only apply empy line and comma cleanups when doing substvar replacements
on fields where those are relevant. Closes: #659814
+ * Do not scan control files twice for PGP signature presence.
[ Raphaƫl Hertzog ]
* Fix dpkg-maintscript-helper rm_conffile and mv_conffile to do nothing
diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm
index 236e111..51cfc5a 100644
--- a/scripts/Dpkg/Control/HashCore.pm
+++ b/scripts/Dpkg/Control/HashCore.pm
@@ -105,6 +105,7 @@ sub new {
my $self = \{
in_order => [],
out_order => [],
+ is_pgp_signed => 0,
allow_pgp => 0,
allow_duplicate => 0,
drop_empty => 0,
@@ -172,7 +173,6 @@ sub parse {
my $parabody = 0;
my $cf; # Current field
my $expect_pgp_sig = 0;
- my $pgp_signed = 0;
while (<$fh>) {
s/\s*\n$//;
@@ -229,7 +229,7 @@ sub parse {
}
# This does not mean the signature is correct, that needs to
# be verified by gnupg.
- $pgp_signed = 1;
+ $$self->{is_pgp_signed} = 1;
}
last; # Finished parsing one block
} else {
@@ -238,7 +238,7 @@ sub parse {
}
}
- if ($expect_pgp_sig and not $pgp_signed) {
+ if ($expect_pgp_sig and not $$self->{is_pgp_signed}) {
syntaxerr($desc, _g('unfinished PGP signature'));
}
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index 0d510fb..3472f44 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -189,19 +189,11 @@ sub initialize {
$self->{basedir} = $dir || './';
$self->{filename} = $fn;
- # Check if it contains a signature
- open(my $dsc_fh, '<', $filename) || syserr(_g('cannot open %s'),
$filename);
- $self->{is_signed} = 0;
- while (<$dsc_fh>) {
- next if /^\s*$/o;
- $self->{is_signed} = 1 if /^-----BEGIN PGP SIGNED MESSAGE-----\s*$/o;
- last;
- }
- close($dsc_fh);
# Read the fields
my $fields = Dpkg::Control->new(type => CTRL_PKG_SRC);
$fields->load($filename);
$self->{fields} = $fields;
+ $self->{is_signed} = $fields->get_option('is_pgp_signed');
foreach my $f (qw(Source Version Files)) {
unless (defined($fields->{$f})) {
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]