From: Don Armstrong Date: Fri, 23 Feb 2018 21:31:28 +0000 (-0800) Subject: Only search for the first Format-Version: and use it X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=commitdiff_plain;h=4baf4cb97f558ec9ad524c891dc4e0790dbfded2 Only search for the first Format-Version: and use it Avoid applying a regex to all lines of the format; find the first Format-Version: and use it. [There should only ever be one Format-Version: anyway.] --- diff --git a/Debbugs/Status.pm b/Debbugs/Status.pm index 9b59045..2c6ce20 100644 --- a/Debbugs/Status.pm +++ b/Debbugs/Status.pm @@ -227,15 +227,19 @@ sub read_bug{ my %data; my @lines; - my $version = 2; + my $version; local $_; while (<$status_fh>) { chomp; push @lines, $_; - $version = $1 if /^Format-Version: ([0-9]+)/i; + if (not defined $version and + /^Format-Version: ([0-9]+)/i + ) { + $version = $1; + } } - + $version = 2 if not defined $version; # Version 3 is the latest format version currently supported. if ($version > 3) { warn "Unsupported status version '$version'";