]> git.donarmstrong.com Git - debbugs.git/blob - cgi/bugreport.cgi
show version graph link on bugreport.cgi
[debbugs.git] / cgi / bugreport.cgi
1 #!/usr/bin/perl -wT
2
3 package debbugs;
4
5 use warnings;
6 use strict;
7 use POSIX qw(strftime tzset);
8 use MIME::Parser;
9 use MIME::Decoder;
10 use IO::Scalar;
11 use IO::File;
12
13 use Debbugs::Config qw(:globals);
14 #require '/usr/lib/debbugs/errorlib';
15 require './common.pl';
16
17 require '/etc/debbugs/text';
18
19 # for read_log_records
20 use Debbugs::Log;
21 use Debbugs::MIME qw(convert_to_utf8 decode_rfc1522 create_mime_message);
22 use Debbugs::CGI qw(:url :html version_url);
23
24 use Scalar::Util qw(looks_like_number);
25
26 my %param = readparse();
27
28 my $tail_html;
29
30 my $ref = $param{'bug'} || quitcgi("No bug number");
31 $ref =~ /(\d+)/ or quitcgi("Invalid bug number");
32 $ref = $1;
33 my $short = "#$ref";
34 my $msg = $param{'msg'} || "";
35 my $att = $param{'att'};
36 my $boring = ($param{'boring'} || 'no') eq 'yes'; 
37 my $terse = ($param{'terse'} || 'no') eq 'yes';
38 my $reverse = ($param{'reverse'} || 'no') eq 'yes';
39 my $mbox = ($param{'mbox'} || 'no') eq 'yes'; 
40 my $mime = ($param{'mime'} || 'yes') eq 'yes';
41
42 my $trim_headers = ($param{trim} || ($msg?'no':'yes')) eq 'yes';
43
44 my $mbox_status_message = ($param{mboxstat}||'no') eq 'yes';
45 my $mbox_maint = ($param{mboxmaint}||'no') eq 'yes';
46 $mbox = 1 if $mbox_status_message or $mbox_maint;
47
48
49 # Not used by this script directly, but fetch these so that pkgurl() and
50 # friends can propagate them correctly.
51 my $archive = ($param{'archive'} || 'no') eq 'yes';
52 my $repeatmerged = ($param{'repeatmerged'} || 'yes') eq 'yes';
53 set_option('archive', $archive);
54 set_option('repeatmerged', $repeatmerged);
55
56 my $buglog = buglog($ref);
57
58 if (defined $ENV{REQUEST_METHOD} and $ENV{REQUEST_METHOD} eq 'HEAD' and not defined($att) and not $mbox) {
59     print "Content-Type: text/html; charset=utf-8\n";
60     my @stat = stat $buglog;
61     if (@stat) {
62         my $mtime = strftime '%a, %d %b %Y %T GMT', gmtime($stat[9]);
63         print "Last-Modified: $mtime\n";
64     }
65     print "\n";
66     exit 0;
67 }
68
69 sub display_entity ($$$$\$\@);
70 sub display_entity ($$$$\$\@) {
71     my $entity = shift;
72     my $ref = shift;
73     my $top = shift;
74     my $xmessage = shift;
75     my $this = shift;
76     my $attachments = shift;
77
78     my $head = $entity->head;
79     my $disposition = $head->mime_attr('content-disposition');
80     $disposition = 'inline' if not defined $disposition or $disposition eq '';
81     my $type = $entity->effective_type;
82     my $filename = $entity->head->recommended_filename;
83     $filename = '' unless defined $filename;
84     $filename = decode_rfc1522($filename);
85
86     if ($top and not $terse) {
87          my $header = $entity->head;
88          $$this .= "<pre class=\"headers\">\n";
89          if ($trim_headers) {
90               my @headers;
91               foreach (qw(From To Cc Subject Date)) {
92                    my $head_field = $head->get($_);
93                    next unless defined $head_field and $head_field ne '';
94                    push @headers, qq(<b>$_:</b> ) . htmlsanit(decode_rfc1522($head_field));
95               }
96               $$this .= join(qq(), @headers) unless $terse;
97          } else {
98               $$this .= htmlsanit(decode_rfc1522($entity->head->stringify));
99          }
100          $$this .= "</pre>\n";
101     }
102
103     unless (($top and $type =~ m[^text(?:/plain)?(?:;|$)]) or
104             ($type =~ m[^multipart/])) {
105         push @$attachments, $entity;
106         my @dlargs = ($ref, "msg=$xmessage", "att=$#$attachments");
107         push @dlargs, "filename=$filename" if $filename ne '';
108         my $printname = $filename;
109         $printname = 'Message part ' . ($#$attachments + 1) if $filename eq '';
110         $$this .= '<pre class="mime">[<a href="' . bugurl(@dlargs) . qq{">$printname</a> } .
111                   "($type, $disposition)]</pre>\n";
112
113         if ($msg and defined($att) and $att eq $#$attachments) {
114             my $head = $entity->head;
115             chomp(my $type = $entity->effective_type);
116             my $body = $entity->stringify_body;
117             print "Content-Type: $type";
118             my ($charset) = $head->get('Content-Type:') =~ m/charset\s*=\s*\"?([\w-]+)\"?/i;
119             print qq(; charset="$charset") if defined $charset;
120             print "\n";
121             if ($filename ne '') {
122                 my $qf = $filename;
123                 $qf =~ s/"/\\"/g;
124                 $qf =~ s[.*/][];
125                 print qq{Content-Disposition: inline; filename="$qf"\n};
126             }
127             print "\n";
128             my $decoder = new MIME::Decoder($head->mime_encoding);
129             $decoder->decode(new IO::Scalar(\$body), \*STDOUT);
130             exit(0);
131         }
132     }
133
134     return if not $top and $disposition eq 'attachment' and not defined($att);
135     return unless ($type =~ m[^text/?] and
136                    $type !~ m[^text/(?:html|enriched)(?:;|$)]) or
137                   $type =~ m[^application/pgp(?:;|$)] or
138                   $entity->parts;
139
140     if ($entity->is_multipart) {
141         my @parts = $entity->parts;
142         foreach my $part (@parts) {
143             display_entity($part, $ref, 0, $xmessage,
144                            $$this, @$attachments);
145             $$this .= "\n";
146         }
147     } elsif ($entity->parts) {
148         # We must be dealing with a nested message.
149         $$this .= "<blockquote>\n";
150         my @parts = $entity->parts;
151         foreach my $part (@parts) {
152             display_entity($part, $ref, 1, $xmessage,
153                            $$this, @$attachments);
154             $$this .= "\n";
155         }
156         $$this .= "</blockquote>\n";
157     } else {
158          if (not $terse) {
159               my $content_type = $entity->head->get('Content-Type:') || "text/html";
160               my ($charset) = $content_type =~ m/charset\s*=\s*\"?([\w-]+)\"?/i;
161               my $body = $entity->bodyhandle->as_string;
162               $body = convert_to_utf8($body,$charset) if defined $charset;
163               $body = htmlsanit($body);
164               # Add links to URLs
165               $body =~ s,((ftp|http|https)://[\S~-]+?/?)((\&gt\;)?[)]?[']?[:.\,]?(\s|$)),<a href=\"$1\">$1</a>$3,go;
166               # Add links to bug closures
167               $body =~ s[(closes:\s*(?:bug)?\#?\s?\d+(?:,?\s*(?:bug)?\#?\s?\d+)*)
168                         ][my $temp = $1; $temp =~ s{(\d+)}{qq(<a href=").bugurl($1).qq(">$1</a>)}ge; $temp;]gxie;
169               $$this .= qq(<pre class="message">$body</pre>\n);
170          }
171     }
172 }
173
174 my %maintainer = %{getmaintainers()};
175 my %pkgsrc = %{getpkgsrc()};
176
177 my $indexentry;
178 my $showseverity;
179
180 my $tpack;
181 my $tmain;
182
183 my $dtime = strftime "%a, %e %b %Y %T UTC", gmtime;
184 $tail_html = $debbugs::gHTMLTail;
185 $tail_html =~ s/SUBSTITUTE_DTIME/$dtime/;
186
187 my %status = %{getbugstatus($ref)};
188 unless (%status) {
189     print <<EOF;
190 Content-Type: text/html; charset=utf-8
191
192 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
193 <html>
194 <head><title>$short - $debbugs::gProject $debbugs::gBug report logs</title></head>
195 <body>
196 <h1>$debbugs::gProject $debbugs::gBug report logs - $short</h1>
197 <p>There is no record of $debbugs::gBug $short.
198 Try the <a href="http://$gWebDomain/">search page</a> instead.</p>
199 $tail_html</body></html>
200 EOF
201     exit 0;
202 }
203
204 $|=1;
205
206 $tpack = lc $status{'package'};
207 my @tpacks = splitpackages($tpack);
208
209 if  ($status{severity} eq 'normal') {
210         $showseverity = '';
211 } elsif (isstrongseverity($status{severity})) {
212         $showseverity = "Severity: <em class=\"severity\">$status{severity}</em>;\n";
213 } else {
214         $showseverity = "Severity: $status{severity};\n";
215 }
216
217 $indexentry .= "<div class=\"msgreceived\">\n";
218 $indexentry .= htmlpackagelinks($status{package}, 0) . ";\n";
219
220 foreach my $pkg (@tpacks) {
221     my $tmaint = defined($maintainer{$pkg}) ? $maintainer{$pkg} : '(unknown)';
222     my $tsrc = defined($pkgsrc{$pkg}) ? $pkgsrc{$pkg} : '(unknown)';
223
224     $indexentry .=
225             htmlmaintlinks(sub { $_[0] == 1 ? "Maintainer for $pkg is\n"
226                                             : "Maintainers for $pkg are\n" },
227                            $tmaint);
228     $indexentry .= ";\nSource for $pkg is\n".
229             '<a href="'.srcurl($tsrc)."\">$tsrc</a>" if ($tsrc ne "(unknown)");
230     $indexentry .= ".\n";
231 }
232
233 $indexentry .= "<br>";
234 $indexentry .= htmladdresslinks("Reported by: ", \&submitterurl,
235                                 $status{originator}) . ";\n";
236 $indexentry .= sprintf "Date: %s.\n",
237                 (strftime "%a, %e %b %Y %T UTC", localtime($status{date}));
238
239 $indexentry .= "<br>Owned by: " . htmlsanit($status{owner}) . ".\n"
240               if length $status{owner};
241
242 $indexentry .= "</div>\n";
243
244 my @descstates;
245
246 $indexentry .= "<h3>$showseverity";
247 $indexentry .= sprintf "Tags: %s;\n", 
248                 htmlsanit(join(", ", sort(split(/\s+/, $status{tags}))))
249                         if length($status{tags});
250 $indexentry .= "<br>" if (length($showseverity) or length($status{tags}));
251
252 my @merged= split(/ /,$status{mergedwith});
253 if (@merged) {
254         my $descmerged = 'Merged with ';
255         my $mseparator = '';
256         for my $m (@merged) {
257                 $descmerged .= $mseparator."<a href=\"" . bugurl($m) . "\">#$m</a>";
258                 $mseparator= ",\n";
259         }
260         push @descstates, $descmerged;
261 }
262
263 if (@{$status{found_versions}}) {
264     my $foundtext = 'Found in ';
265     $foundtext .= (@{$status{found_versions}} == 1) ? 'version ' : 'versions ';
266     $foundtext .= join ', ', map htmlsanit($_), @{$status{found_versions}};
267     push @descstates, $foundtext;
268 }
269
270 if (@{$status{fixed_versions}}) {
271     my $fixedtext = '<strong>Fixed</strong> in ';
272     $fixedtext .= (@{$status{fixed_versions}} == 1) ? 'version ' : 'versions ';
273     $fixedtext .= join ', ', map htmlsanit($_), @{$status{fixed_versions}};
274     if (length($status{done})) {
275         $fixedtext .= ' by ' . htmlsanit(decode_rfc1522($status{done}));
276     }
277     push @descstates, $fixedtext;
278     push @descstates, '<a href="'.
279          version_url($status{package},
280                      $status{found_versions},
281                      $status{fixed_versions},
282                     ).qq{">Version Graph</a>};
283
284 } elsif (length($status{done})) {
285     push @descstates, "<strong>Done:</strong> ".htmlsanit(decode_rfc1522($status{done}));
286 } elsif (length($status{forwarded})) {
287     push @descstates, "<strong>Forwarded</strong> to ".maybelink($status{forwarded});
288 }
289
290
291 my @blockedby= split(/ /, $status{blockedby});
292 if (@blockedby && $status{"pending"} ne 'fixed' && ! length($status{done})) {
293     for my $b (@blockedby) {
294         my %s = %{getbugstatus($b)};
295         next if $s{"pending"} eq 'fixed' || length $s{done};
296         push @descstates, "Fix blocked by <a href=\"" . bugurl($b) . "\">#$b</a>: ".htmlsanit($s{subject});
297     }
298 }
299
300 my @blocks= split(/ /, $status{blocks});
301 if (@blocks && $status{"pending"} ne 'fixed' && ! length($status{done})) {
302     for my $b (@blocks) {
303         my %s = %{getbugstatus($b)};
304         next if $s{"pending"} eq 'fixed' || length $s{done};
305         push @descstates, "Blocking fix for <a href=\"" . bugurl($b) . "\">#$b</a>: ".htmlsanit($s{subject});
306     }
307 }
308
309 if ($buglog !~ m#^\Q$gSpoolDir/db#) {
310     push @descstates, "Bug is archived. No further changes may be made";
311 }
312
313 $indexentry .= join(";\n<br>", @descstates) . ".\n" if @descstates;
314 $indexentry .= "</h3>\n";
315
316 my $descriptivehead = $indexentry;
317
318 my $buglogfh;
319 if ($buglog =~ m/\.gz$/) {
320     my $oldpath = $ENV{'PATH'};
321     $ENV{'PATH'} = '/bin:/usr/bin';
322     $buglogfh = new IO::File "zcat $buglog |" or &quitcgi("open log for $ref: $!");
323     $ENV{'PATH'} = $oldpath;
324 } else {
325     $buglogfh = new IO::File "<$buglog" or &quitcgi("open log for $ref: $!");
326 }
327
328
329 my @records;
330 eval{
331      @records = read_log_records($buglogfh);
332 };
333 if ($@) {
334      quitcgi("Bad bug log for $debbugs::gBug $ref. Unable to read records: $@");
335 }
336 undef $buglogfh;
337
338 =head2 handle_email_message
339
340      handle_email_message($record->{text},
341                           ref        => $bug_number,
342                           msg_number => $msg_number,
343                          );
344
345 Returns a decoded e-mail message and displays entities/attachments as
346 appropriate.
347
348
349 =cut
350
351 sub handle_email_message{
352      my ($email,%options) = @_;
353
354      my $output = '';
355      my $parser = new MIME::Parser;
356      # Because we are using memory, not tempfiles, there's no need to
357      # clean up here like in Debbugs::MIME
358      $parser->tmp_to_core(1);
359      $parser->output_to_core(1);
360      my $entity = $parser->parse_data( $email);
361      my @attachments = ();
362      display_entity($entity, $options{ref}, 1, $options{msg_number}, $output, @attachments);
363      return $output;
364
365 }
366
367 =head2 handle_record
368
369      push @log, handle_record($record,$ref,$msg_num);
370
371 Deals with a record in a bug log as returned by
372 L<Debbugs::Log::read_log_records>; returns the log information that
373 should be output to the browser.
374
375 =cut
376
377 sub handle_record{
378      my ($record,$bug_number,$msg_number,$seen_msg_ids) = @_;
379
380      my $output = '';
381      local $_ = $record->{type};
382      if (/html/) {
383           my $class = $record->{text} =~ /^<strong>(?:Acknowledgement|Reply|Information|Report|Notification)/ ? 'infmessage':'msgreceived';
384           $output .= decode_rfc1522($record->{text});
385           # Link to forwarded http:// urls in the midst of the report
386           # (even though these links already exist at the top)
387           $output =~ s,((?:ftp|http|https)://[\S~-]+?/?)([\)\'\:\.\,]?(?:\s|\.<|$)),<a href=\"$1\">$1</a>$2,go;
388           # Add links to the cloned bugs
389           $output =~ s{(Bug )(\d+)( cloned as bugs? )(\d+)(?:\-(\d+)|)}{$1.bug_links($2).$3.bug_links($4,$5)}eo;
390           # Add links to merged bugs
391           $output =~ s{(?<=Merged )([\d\s]+)(?=\.)}{join(' ',map {bug_links($_)} (split /\s+/, $1))}eo;
392           # Add links to blocked bugs
393           $output =~ s{(?<=Blocking bugs)(?:(of )(\d+))?( (?:added|set to|removed):\s+)([\d\s\,]+)}
394                       {(defined $2?$1.bug_links($2):'').$3.
395                             join(' ',map {bug_links($_)} (split /\,?\s+/, $4))}eo;
396           # Add links to reassigned packages
397           $output =~ s{(Bug reassigned from package \`)([^\']+)(' to \`)([^\']+)(')}
398           {$1.q(<a href=").pkgurl($2).qq(">$2</a>).$3.q(<a href=").pkgurl($4).qq(">$4</a>).$5}eo;
399           $output .= '<a href="' . bugurl($ref, 'msg='.($msg_number+1)) . '">Full text</a> and <a href="' .
400                bugurl($ref, 'msg='.($msg_number+1), 'mbox') . '">rfc822 format</a> available.';
401
402           $output = qq(<div class="$class"><hr>\n<a name="$msg_number">\n) . $output . "</div>\n";
403      }
404      elsif (/recips/) {
405           my ($msg_id) = $record->{text} =~ /^Message-Id:\s+<(.+)>/im;
406           if (defined $msg_id and exists $$seen_msg_ids{$msg_id}) {
407                return ();
408           }
409           elsif (defined $msg_id) {
410                $$seen_msg_ids{$msg_id} = 1;
411           }
412           $output .= qq(<hr><a name="$msg_number">\n);
413           $output .= 'View this message in <a href="' . bugurl($ref, "msg=$msg_number", "mbox") . '">rfc822 format</a>';
414           $output .= handle_email_message($record->{text},
415                                     ref        => $bug_number,
416                                     msg_number => $msg_number,
417                                    );
418      }
419      elsif (/autocheck/) {
420           # Do nothing
421      }
422      elsif (/incoming-recv/) {
423           my ($msg_id) = $record->{text} =~ /^Message-Id:\s+<(.+)>/im;
424           if (defined $msg_id and exists $$seen_msg_ids{$msg_id}) {
425                return ();
426           }
427           elsif (defined $msg_id) {
428                $$seen_msg_ids{$msg_id} = 1;
429           }
430           # Incomming Mail Message
431           my ($received,$hostname) = $record->{text} =~ m/Received: \(at (\S+)\) by (\S+)\;/;
432           $output .= qq|<hr><p class="msgreceived"><a name="$msg_number"><a name="msg$msg_number">Message received</a> at |.
433                htmlsanit("$received\@$hostname") . q| (<a href="| . bugurl($ref, "msg=$msg_number") . '">full text</a>'.q|, <a href="| . bugurl($ref, "msg=$msg_number") . ';mbox=yes">mbox</a>)'.":</p>\n";
434           $output .= handle_email_message($record->{text},
435                                     ref        => $bug_number,
436                                     msg_number => $msg_number,
437                                    );
438      }
439      else {
440           die "Unknown record type $_";
441      }
442      return $output;
443 }
444
445 my $log='';
446 my $msg_num = 0;
447 my $skip_next = 0;
448 if (looks_like_number($msg) and ($msg-1) <= $#records) {
449      @records = ($records[$msg-1]);
450      $msg_num = $msg - 1;
451 }
452 my @log;
453 if ( $mbox ) {
454      my $date = strftime "%a %b %d %T %Y", localtime;
455      if (@records > 1) {
456           print qq(Content-Disposition: attachment; filename="bug_${ref}.mbox"\n);
457           print "Content-Type: text/plain\n\n";
458      }
459      else {
460           $msg_num++;
461           print qq(Content-Disposition: attachment; filename="bug_${ref}_message_${msg_num}.mbox"\n);
462           print "Content-Type: message/rfc822\n\n";
463      }
464      if ($mbox_status_message and @records > 1) {
465           my $status_message='';
466           my @status_fields = (retitle   => 'subject',
467                                package   => 'package',
468                                submitter => 'originator',
469                                severity  => 'severity',
470                                tag       => 'tags',
471                                owner     => 'owner',
472                                blocks    => 'blocks',
473                                forward   => 'forward',
474                               );
475           my ($key,$value);
476           while (($key,$value) = splice(@status_fields,0,2)) {
477                if (defined $status{$value} and length $status{$value}) {
478                     $status_message .= qq($key $ref $status{$value}\n);
479                }
480           }
481           print STDOUT qq(From unknown $date\n),
482                create_mime_message([From       => "$debbugs::gBug#$ref <$ref\@$debbugs::gEmailDomain>",
483                                     To         => "$debbugs::gBug#$ref <$ref\@$debbugs::gEmailDomain>",
484                                     Subject    => "Status: $status{subject}",
485                                     "Reply-To" => "$debbugs::gBug#$ref <$ref\@$debbugs::gEmailDomain>",
486                                    ],
487                                    <<END,);
488 $status_message
489 thanks
490
491
492 END
493      }
494      my $message_number=0;
495      my %seen_message_ids;
496      for my $record (@records) {
497           next if $record->{type} !~ /^(?:recips|incoming-recv)$/;
498           my $wanted_type = $mbox_maint?'recips':'incoming-recv';
499           # we want to include control messages anyway
500           my $record_wanted_anyway = 0;
501           my ($msg_id) = $record->{text} =~ /^Message-Id:\s+<(.+)>/im;
502           next if exists $seen_message_ids{$msg_id};
503           $seen_message_ids{$msg_id} = 1;
504           next if $msg_id =~/handler\..+\.ack(?:info)?\@/;
505           $record_wanted_anyway = 1 if $record->{text} =~ /^Received: \(at control\)/;
506           next if not $boring and $record->{type} ne $wanted_type and not $record_wanted_anyway and @records > 1;
507           my @lines = split( "\n", $record->{text}, -1 );
508           if ( $lines[ 1 ] =~ m/^From / ) {
509                my $tmp = $lines[ 0 ];
510                $lines[ 0 ] = $lines[ 1 ];
511                $lines[ 1 ] = $tmp;
512           }
513           if ( !( $lines[ 0 ] =~ m/^From / ) ) {
514                unshift @lines, "From unknown $date";
515           }
516           map { s/^(>*From )/>$1/ } @lines[ 1 .. $#lines ];
517           print join( "\n", @lines ) . "\n";
518      }
519      exit 0;
520 }
521
522 else {
523      my %seen_msg_ids;
524      for my $record (@records) {
525           $msg_num++;
526           if ($skip_next) {
527                $skip_next = 0;
528                next;
529           }
530           $skip_next = 1 if $record->{type} eq 'html' and not $boring;
531           push @log, handle_record($record,$ref,$msg_num,\%seen_msg_ids);
532      }
533 }
534
535 @log = reverse @log if $reverse;
536 $log = join("\n",@log);
537
538
539 print "Content-Type: text/html; charset=utf-8\n\n";
540
541 my $title = htmlsanit($status{subject});
542
543 my $dummy2 = $debbugs::gWebHostBugDir;
544
545 print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
546 print <<END;
547 <HTML><HEAD>
548 <TITLE>$short - $title - $debbugs::gProject $debbugs::gBug report logs</TITLE>
549 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
550 <link rel="stylesheet" href="$debbugs::gWebHostBugDir/css/bugs.css" type="text/css">
551 <script type="text/javascript">
552 <!--
553 function toggle_infmessages(){
554        var styles = document.styleSheets;
555        var deleted = 0
556        for (var i = 0; i < styles.length; i++) {
557           for (var j = 0; j < styles[i].cssRules.length; j++) {
558             if (styles[i].cssRules[j].cssText == ".infmessage { display: none; }") {
559                  styles[i].deleteRule(j);
560                  deleted = 1;
561             }
562           }
563        }
564        if (!deleted) {
565             styles[0].insertRule(".infmessage { display: none; }",0);
566        }
567 }
568 -->
569 </script>
570 </HEAD>
571 <BODY">
572 END
573 print "<H1>" . "$debbugs::gProject $debbugs::gBug report logs - <A HREF=\"mailto:$ref\@$gEmailDomain\">$short</A>" .
574       "<BR>" . $title . "</H1>\n";
575
576 print "$descriptivehead\n";
577 print qq(<p><a href="mailto:$ref\@$debbugs::gEmailDomain">Reply</a> ),
578      qq(or <a href="mailto:$ref-subscribe\@$debbugs::gEmailDomain">subscribe</a> ),
579      qq(to this bug.</p>\n);
580 print qq(<p><a href="javascript:toggle_infmessages();">Show useless messages</a></p>);
581 printf qq(<div class="msgreceived"><p>View this report as an <a href="%s">mbox folder</a>, ).
582      qq(<a href="%s">status mbox</a>, <a href="%s">maintainer mbox</a></p></div>\n),
583      html_escape(bug_url($ref, mbox=>'yes')),
584      html_escape(bug_url($ref, mbox=>'yes',mboxstatus=>'yes')),
585      html_escape(bug_url($ref, mbox=>'yes',mboxmaint=>'yes'));
586 print "$log";
587 print "<HR>";
588 print "<p class=\"msgreceived\">Send a report that <a href=\"/cgi-bin/bugspam.cgi?bug=$ref\">this bug log contains spam</a>.</p>\n<HR>\n";
589 print $tail_html;
590
591 print "</BODY></HTML>\n";
592
593 exit 0;