[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#853915: reportbug: Retrieved base64 messages aren't decoded



> So either something does not work as expected there, or I'm simply
> looking at the wrong code and should be looking somewhere else.

If this is the correct code, then why is it behaving differently when
its is run to serve a soap request, as compared to running it directly,
 for the same email message?

This is at least happening for multipart/signed messages, and likely
also for other MIME messages. For testing I am using the initial report
mail from #853037. The BTS' SOAP interface delivers the message body as
the entire undecoded body of the primary email message, as if the BTS
did not understand multipart messages at all. See `reportbug -N 853037`
for how the email body is then displayed by reportbug.

However, when I run this same message through Debbugs::MIME's `parse`,
it correctly identifies the text/plain subpart and decodes and returns
it. I've tested this by downloading the message mbox:

wget -O msg
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853037;mbox=yes;msg=5

and then using the following perl script to call the `parse` function:

------- m.pl ------
#! /usr/bin/perl

use strict;
use warnings;

use Data::Dumper;
use Debbugs::MIME qw(parse);

sub make_list {
     return map {(ref($_) eq 'ARRAY')?@{$_}:$_} @_;
}

local $/;
my $lines = <>;

my $message = parse $lines;
my ($header, $body) = map {join("\n", make_list($_))}
	@{$message}{qw(header body)};

print Dumper({header => $header, body => $body,});
-------------

Command line:

perl -I debbugs/lib/ m.pl < msg

Here the result shows a nicely identified and extracted message text.

Looking now at the code starting here:
https://salsa.debian.org/debbugs-team/debbugs/-/blob/master/lib/Debbugs/MIME.pm#L130
Somehow, when the code is run on the BTS server, the MIME::Parser seems
to fail and the `parse` function code is falling back to the legacy
pre-MIME code. Why?


Reply to: