X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FStatus.pm;h=5b6e9dcf9963ddd141453909cee26e2fe5d1dac7;hb=2a65291b8c26653fd72a48b3691e95da4a1d9263;hp=00516b404d30ddd0bfbf56f954ea6e5fdcc119d0;hpb=5750b9ee882f461539a6bc9033ad8f6ffccbdd3e;p=debbugs.git diff --git a/Debbugs/Status.pm b/Debbugs/Status.pm index 00516b4..5b6e9dc 100644 --- a/Debbugs/Status.pm +++ b/Debbugs/Status.pm @@ -40,7 +40,7 @@ use Params::Validate qw(validate_with :types); use Debbugs::Common qw(:util :lock :quit :misc); use Debbugs::Config qw(:config); use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522); -use Debbugs::Packages qw(makesourceversions make_source_versions getversions get_versions binarytosource); +use Debbugs::Packages qw(makesourceversions make_source_versions getversions get_versions binary_to_source); use Debbugs::Versions; use Debbugs::Versions::Dpkg; use POSIX qw(ceil); @@ -232,7 +232,11 @@ sub read_bug{ for my $line (@lines) { if ($line =~ /(\S+?): (.*)/) { my ($name, $value) = (lc $1, $2); - $data{$namemap{$name}} = $value if exists $namemap{$name}; + # this is a bit of a hack; we should never, ever have \r + # or \n in the fields of status. Kill them off here. + # [Eventually, this should be superfluous.] + $value =~ s/[\r\n]//g; + $data{$namemap{$name}} = $value if exists $namemap{$name}; } } for my $field (keys %fields) { @@ -522,6 +526,13 @@ sub makestatus { } } + # this is a bit of a hack; we should never, ever have \r or \n in + # the fields of status. Kill them off here. [Eventually, this + # should be superfluous.] + for my $field (keys %newdata) { + $newdata{$field} =~ s/[\r\n]//g if defined $newdata{$field}; + } + if ($version == 1) { for my $field (@v1fieldorder) { if (exists $newdata{$field} and defined $newdata{$field}) { @@ -623,7 +634,8 @@ sub addfoundversions { my $source = $package; if (defined $package and $isbinary) { - my @srcinfo = binarytosource($package, $version, undef); + my @srcinfo = binary_to_source(binary => $package, + version => $version); if (@srcinfo) { # We know the source package(s). Use a fully-qualified version. addfoundversions($data, $_->[0], $_->[1], '') foreach @srcinfo; @@ -697,7 +709,8 @@ sub addfixedversions { my $source = $package; if (defined $package and $isbinary) { - my @srcinfo = binarytosource($package, $version, undef); + my @srcinfo = binary_to_source(binary => $package, + version => $version); if (@srcinfo) { # We know the source package(s). Use a fully-qualified version. addfixedversions($data, $_->[0], $_->[1], '') foreach @srcinfo; @@ -1059,25 +1072,10 @@ sub get_bug_status { $status{package} = '' if not defined $status{package}; $status{"package"} =~ s/\s*$//; - # if we aren't supposed to indicate the source, we'll return - # unknown here. - $status{source} = 'unknown'; - if ($param{indicatesource}) { - my @packages = split /\s*,\s*/, $status{package}; - my @source; - for my $package (@packages) { - next if $package eq ''; - if ($package =~ /^src\:(.+)$/) { - push @source,$1; - } - else { - push @source, binarytosource($package); - } - } - if (@source) { - $status{source} = join(', ',@source); - } - } + + $status{source} = binary_to_source(binary=>[split /\s*,\s*/, $status{package}], + source_only => 1, + ); $status{"package"} = 'unknown' if ($status{"package"} eq ''); $status{"severity"} = 'normal' if (not defined $status{severity} or $status{"severity"} eq '');