use Debbugs::Common qw(:util :quit :misc :lock);
-use Debbugs::Status qw(:read :status :write :versions);
+use Debbugs::Status qw(:read :status :write :versions :hook);
use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522);
use Debbugs::Mail qw(send_mail_message);
}
}
$header{'message-id'} ||= '';
+$header{subject} ||= '';
grep(s/\s+$//,@bodylines);
# This is an error counter which should be incremented every time there is an error.
my $errors = 0;
-my $controlrequestaddr= ($control ? 'control' : 'request').$config{email_domain};
+my $controlrequestaddr= ($control ? 'control' : 'request').'@'.$config{email_domain};
my $transcript_scalar = '';
my $transcript = IO::Scalar->new(\$transcript_scalar) or
die "Unable to create new IO::Scalar";
last;
}
$_= $bodylines[$procline]; s/\s+$//;
+ # Remove BOM markers from UTF-8 strings
+ # Fixes #488554
+ s/\xef\xbb\xbf//g;
next unless m/\S/;
print {$transcript} "> $_\n";
next if m/^\s*\#/;
Debbugs::User::read_usertags(\%ut, $user);
my @oldtags = (); my @newtags = (); my @badtags = ();
my %chtags;
- for my $t (split /[,\s]+/, $tags) {
- if ($t =~ m/^[a-zA-Z0-9.+\@-]+$/) {
- $chtags{$t} = 1;
- } else {
- push @badtags, $t;
- }
+ if (defined $tags and length $tags) {
+ for my $t (split /[,\s]+/, $tags) {
+ if ($t =~ m/^[a-zA-Z0-9.+\@-]+$/) {
+ $chtags{$t} = 1;
+ } else {
+ push @badtags, $t;
+ }
+ }
}
if (@badtags) {
print {$transcript} "Ignoring illegal tag/s: ".join(', ', @badtags).".\nPlease use only alphanumerics, at, dot, plus and dash.\n";
do {
$affected_packages{$data->{package}} = 1;
add_recipients(data => $data,
- recipients => \%recipients,
- actions_taken => {done => 1},
- );
+ recipients => \%recipients,
+ actions_taken => {done => 1},
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
$data->{done}= $replyto;
my @keywords= split ' ', $data->{keywords};
my $extramessage = '';
}
do {
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
$data->{package}= $newpackage;
$data->{found_versions}= [];
$data->{fixed_versions}= [];
# TODO: what if $newpackage is a source package?
addfoundversions($data, $data->{package}, $version, 'binary');
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
} while (&getnextbug);
}
} elsif (m/^reopen\s+\#?(-?\d+)$/i ? ($noriginator='', 1) :
"$gBug reopened, originator set to $noriginator.";
do {
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
$data->{originator}= $noriginator eq '' ? $data->{originator} : $noriginator;
$data->{fixed_versions}= [];
$data->{done}= '';
"$gBug reopened.";
do {
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
# The 'done' field gets a bit weird with version
# tracking, because a bug may be closed by multiple
# people in different branches. Until we have something
}
do {
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
removefoundversions($data, $data->{package}, $version, 'binary');
} while (&getnextbug);
}
"$gBug reopened.";
do {
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
addfixedversions($data, $data->{package}, $version, 'binary');
} while (&getnextbug);
}
"$gBug reopened.";
do {
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
removefixedversions($data, $data->{package}, $version, 'binary');
} while (&getnextbug);
}
if (&checkpkglimit) {
&foundbug;
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
$oldsubmitter= $data->{originator};
$data->{originator}= $newsubmitter;
$action= "Changed $gBug submitter from $oldsubmitter to $newsubmitter.";
add_recipients(data => $data,
recipients => \%recipients,
actions_taken => {forwarded => 1},
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
);
$data->{forwarded}= $whereto;
} while (&getnextbug);
$action= "Removed annotation that $gBug had been forwarded to $data->{forwarded}.";
do {
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
$data->{forwarded}= '';
} while (&getnextbug);
}
$action= "Severity set to \`$newseverity' from \`$printseverity'";
do {
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
if (defined $gStrongList and isstrongseverity($newseverity)) {
addbcc("$gStrongList\@$gListDomain");
}
}
do {
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
$data->{keywords} = '' if ($addsub eq "set");
# Allow removing obsolete tags.
if ($addsub eq "sub") {
$ok++;
my $bugnum = $2; my $blockers = $4;
my $addsub = "add";
- $addsub = "sub" if ($1 eq "un");
+ $addsub = "sub" if (defined $1 and $1 eq "un");
if ($bugnum =~ m/^-\d+$/ && defined $clonebugs{$bugnum}) {
$bugnum = $clonebugs{$bugnum};
}
my %addedblocks;
do {
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
my @oldblockerlist = split ' ', $data->{blockedby};
$data->{blockedby} = '' if ($addsub eq "set");
foreach my $b (@okayblockers) {
if (&checkpkglimit) {
&foundbug;
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
my $oldtitle = $data->{subject};
$data->{subject}= $newtitle;
$action= "Changed $gBug title to `$newtitle' from `$oldtitle'.";
@bug_affected{@newmergelist} = 1 x @newmergelist;
do {
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
$data->{mergedwith}= ($ref == $discref) ? ''
: join(' ',grep($_ ne $ref,@newmergelist));
} while (&getnextbug);
for $ref (@newmergelist) {
&getbug || die "huh ? $gBug $ref disappeared during merge";
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
@bug_affected{@newmergelist} = 1 x @newmergelist;
$data->{mergedwith}= join(' ',grep($_ != $ref,@newmergelist));
$data->{keywords}= join(' ', keys %tags);
for $ref (@newmergelist) {
&getbug || die "huh ? $gBug $ref disappeared during merge";
$affected_packages{$data->{package}} = 1;
- add_recipients(data => $data, recipients => \%recipients);
+ add_recipients(data => $data,
+ recipients => \%recipients,
+ transcript => $transcript,
+ ($dl > 0 ? (debug => $transcript):()),
+ );
@bug_affected{@newmergelist} = 1 x @newmergelist;
$data->{mergedwith}= join(' ',grep($_ != $ref,@newmergelist));
$data->{keywords}= join(' ', keys %tags);
}
sub sendhelp {
- &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
- &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
- if $control;
+ if ($control) {
+ &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
+ }
+ else {
+ &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
+ }
}
#sub unimplemented {
# print {$transcript} "Sorry, command $_[0] not yet implemented.\n\n";
#}
-
+our %checkmatch_values;
sub checkmatch {
my ($string,$mvarname,$svarvalue,@newmergelist) = @_;
my ($mvarvalue);
if (@newmergelist) {
- eval "\$mvarvalue= \$$mvarname";
+ $mvarvalue = $checkmatch_values{$mvarname};
print {$transcript} "D| checkmatch \`$string' /$mvarname/$mvarvalue/$svarvalue/\n"
if $dl;
$mismatch .=
} else {
print {$transcript} "D| setupmatch \`$string' /$mvarname/$svarvalue/\n"
if $dl;
- eval "\$$mvarname= \$svarvalue";
+ $checkmatch_values{$mvarname} = $svarvalue;
}
}