From 4baf4cb97f558ec9ad524c891dc4e0790dbfded2 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Fri, 23 Feb 2018 13:31:28 -0800 Subject: [PATCH] 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.] --- Debbugs/Status.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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'"; -- 2.39.2