]> git.donarmstrong.com Git - debbugs.git/commitdiff
merge changes from mainline
authorDon Armstrong <don@volo>
Tue, 21 Nov 2006 07:52:05 +0000 (23:52 -0800)
committerDon Armstrong <don@volo>
Tue, 21 Nov 2006 07:52:05 +0000 (23:52 -0800)
1  2 
cgi/bugreport.cgi
cgi/pkgreport.cgi
debian/changelog

diff --combined cgi/bugreport.cgi
index 51ea552af0a0aa414b4917be01c2910ed754a15b,bc669d5e0fb0cc8f44b797f8d244862adef1fb0d..ef397b4bcd2a142392df5d3eecb5bb39c8eaf7a1
@@@ -2,7 -2,6 +2,7 @@@
  
  package debbugs;
  
 +use warnings;
  use strict;
  use POSIX qw(strftime tzset);
  use MIME::Parser;
@@@ -10,14 -9,17 +10,14 @@@ use MIME::Decoder
  use IO::Scalar;
  use IO::File;
  
 +use Debbugs::Config qw(:globals :text);
  #require '/usr/lib/debbugs/errorlib';
  require './common.pl';
  
 -require '/etc/debbugs/config';
 -require '/etc/debbugs/text';
 -
 -use vars(qw($gEmailDomain $gHTMLTail $gSpoolDir $gWebDomain));
 -
  # for read_log_records
  use Debbugs::Log;
 -use Debbugs::MIME qw(convert_to_utf8 decode_rfc1522);
 +use Debbugs::MIME qw(convert_to_utf8 decode_rfc1522 create_mime_message);
 +use Debbugs::CGI qw(:url :html version_url);
  
  use Scalar::Util qw(looks_like_number);
  
@@@ -39,11 -41,6 +39,11 @@@ my $mime = ($param{'mime'} || 'yes') e
  
  my $trim_headers = ($param{trim} || ($msg?'no':'yes')) eq 'yes';
  
 +my $mbox_status_message = ($param{mboxstat}||'no') eq 'yes';
 +my $mbox_maint = ($param{mboxmaint}||'no') eq 'yes';
 +$mbox = 1 if $mbox_status_message or $mbox_maint;
 +
 +
  # Not used by this script directly, but fetch these so that pkgurl() and
  # friends can propagate them correctly.
  my $archive = ($param{'archive'} || 'no') eq 'yes';
@@@ -178,7 -175,10 +178,7 @@@ my $showseverity
  my $tpack;
  my $tmain;
  
 -$ENV{"TZ"} = 'UTC';
 -tzset();
 -
 -my $dtime = strftime "%a, %e %b %Y %T UTC", localtime;
 +my $dtime = strftime "%a, %e %b %Y %T UTC", gmtime;
  $tail_html = $debbugs::gHTMLTail;
  $tail_html =~ s/SUBSTITUTE_DTIME/$dtime/;
  
@@@ -189,10 -189,10 +189,10 @@@ Content-Type: text/html; charset=utf-
  
  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <html>
 -<head><title>$short - $debbugs::gProject $debbugs::gBug report logs</title></head>
 +<head><title>$short - $gProject $gBug report logs</title></head>
  <body>
 -<h1>$debbugs::gProject $debbugs::gBug report logs - $short</h1>
 -<p>There is no record of $debbugs::gBug $short.
 +<h1>$gProject $gBug report logs - $short</h1>
 +<p>There is no record of $gBug $short.
  Try the <a href="http://$gWebDomain/">search page</a> instead.</p>
  $tail_html</body></html>
  EOF
@@@ -273,12 -273,6 +273,12 @@@ if (@{$status{fixed_versions}}) 
        $fixedtext .= ' by ' . htmlsanit(decode_rfc1522($status{done}));
      }
      push @descstates, $fixedtext;
 +    push @descstates, '<a href="'.
 +       version_url($status{package},
 +                   $status{found_versions},
 +                   $status{fixed_versions},
 +                  ).qq{">Version Graph</a>};
 +
  } elsif (length($status{done})) {
      push @descstates, "<strong>Done:</strong> ".htmlsanit(decode_rfc1522($status{done}));
  } elsif (length($status{forwarded})) {
@@@ -329,7 -323,7 +329,7 @@@ eval
       @records = read_log_records($buglogfh);
  };
  if ($@) {
 -     quitcgi("Bad bug log for $debbugs::gBug $ref. Unable to read records: $@");
 +     quitcgi("Bad bug log for $gBug $ref. Unable to read records: $@");
  }
  undef $buglogfh;
  
@@@ -362,6 -356,30 +362,6 @@@ sub handle_email_message
  
  }
  
 -=head2 bug_links
 -
 -     bug_links($one_bug);
 -     bug_links($starting_bug,$stoping_bugs,);
 -
 -Creates a set of links to bugs, starting with bug number
 -$starting_bug, and finishing with $stoping_bug; if only one bug is
 -passed, makes a link to only a single bug.
 -
 -The content of the link is the bug number.
 -
 -=cut
 -
 -sub bug_links{
 -     my ($start,$stop,$query_arguments) = @_;
 -     $stop = $stop || $start;
 -     $query_arguments ||= '';
 -     my @output;
 -     for my $bug ($start..$stop) {
 -        push @output,'<a href="'.bugurl($bug,'').qq(">$bug</a>);
 -     }
 -     return join(', ',@output);
 -}
 -
  =head2 handle_record
  
       push @log, handle_record($record,$ref,$msg_num);
@@@ -427,7 -445,7 +427,8 @@@ sub handle_record
          }
          # Incomming Mail Message
          my ($received,$hostname) = $record->{text} =~ m/Received: \(at (\S+)\) by (\S+)\;/;
 +        $output .= qq|<hr><p class="msgreceived"><a name="$msg_number"></a><a name="msg$msg_number">Message received</a> at |.
+         $output .= qq|<hr><p class="msgreceived"><a name="$msg_number"><a name="msg$msg_number">Message received</a> at |.
               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";
          $output .= handle_email_message($record->{text},
                                    ref        => $bug_number,
@@@ -449,7 -467,6 +450,7 @@@ if (looks_like_number($msg) and ($msg-1
  }
  my @log;
  if ( $mbox ) {
 +     my $date = strftime "%a %b %d %T %Y", localtime;
       if (@records > 1) {
          print qq(Content-Disposition: attachment; filename="bug_${ref}.mbox"\n);
          print "Content-Type: text/plain\n\n";
          print qq(Content-Disposition: attachment; filename="bug_${ref}_message_${msg_num}.mbox"\n);
          print "Content-Type: message/rfc822\n\n";
       }
 +     if ($mbox_status_message and @records > 1) {
 +        my $status_message='';
 +        my @status_fields = (retitle   => 'subject',
 +                             package   => 'package',
 +                             submitter => 'originator',
 +                             severity  => 'severity',
 +                             tag       => 'tags',
 +                             owner     => 'owner',
 +                             blocks    => 'blocks',
 +                             forward   => 'forward',
 +                            );
 +        my ($key,$value);
 +        while (($key,$value) = splice(@status_fields,0,2)) {
 +             if (defined $status{$value} and length $status{$value}) {
 +                  $status_message .= qq($key $ref $status{$value}\n);
 +             }
 +        }
 +        print STDOUT qq(From unknown $date\n),
 +             create_mime_message([From       => "$gBug#$ref <$ref\@$gEmailDomain>",
 +                                  To         => "$gBug#$ref <$ref\@$gEmailDomain>",
 +                                  Subject    => "Status: $status{subject}",
 +                                  "Reply-To" => "$gBug#$ref <$ref\@$gEmailDomain>",
 +                                 ],
 +                                 <<END,);
 +$status_message
 +thanks
 +
 +
 +END
 +     }
 +     my $message_number=0;
 +     my %seen_message_ids;
       for my $record (@records) {
          next if $record->{type} !~ /^(?:recips|incoming-recv)$/;
 -        next if not $boring and $record->{type} eq 'recips' and @records > 1;
 +        my $wanted_type = $mbox_maint?'recips':'incoming-recv';
 +        # we want to include control messages anyway
 +        my $record_wanted_anyway = 0;
 +        my ($msg_id) = $record->{text} =~ /^Message-Id:\s+<(.+)>/im;
 +        next if exists $seen_message_ids{$msg_id};
 +        $seen_message_ids{$msg_id} = 1;
 +        next if $msg_id =~/handler\..+\.ack(?:info)?\@/;
 +        $record_wanted_anyway = 1 if $record->{text} =~ /^Received: \(at control\)/;
 +        next if not $boring and $record->{type} ne $wanted_type and not $record_wanted_anyway and @records > 1;
          my @lines = split( "\n", $record->{text}, -1 );
          if ( $lines[ 1 ] =~ m/^From / ) {
               my $tmp = $lines[ 0 ];
               $lines[ 1 ] = $tmp;
          }
          if ( !( $lines[ 0 ] =~ m/^From / ) ) {
 -             my $date = strftime "%a %b %d %T %Y", localtime;
               unshift @lines, "From unknown $date";
          }
          map { s/^(>*From )/>$1/ } @lines[ 1 .. $#lines ];
@@@ -538,14 -516,14 +539,14 @@@ print "Content-Type: text/html; charset
  
  my $title = htmlsanit($status{subject});
  
 -my $dummy2 = $debbugs::gWebHostBugDir;
 +my $dummy2 = $gWebHostBugDir;
  
  print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
  print <<END;
  <HTML><HEAD>
 -<TITLE>$short - $title - $debbugs::gProject $debbugs::gBug report logs</TITLE>
 +<TITLE>$short - $title - $gProject $gBug report logs</TITLE>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
 -<link rel="stylesheet" href="$debbugs::gWebHostBugDir/css/bugs.css" type="text/css">
 +<link rel="stylesheet" href="$gWebHostBugDir/css/bugs.css" type="text/css">
  <script type="text/javascript">
  <!--
  function toggle_infmessages(){
  </HEAD>
  <BODY>
  END
 -print "<H1>" . "$debbugs::gProject $debbugs::gBug report logs - <A HREF=\"mailto:$ref\@$gEmailDomain\">$short</A>" .
 +print "<H1>" . "$gProject $gBug report logs - <A HREF=\"mailto:$ref\@$gEmailDomain\">$short</A>" .
        "<BR>" . $title . "</H1>\n";
  
  print "$descriptivehead\n";
 -print qq(<p><a href="mailto:$ref\@$debbugs::gEmailDomain">Reply</a> ),
 -     qq(or <a href="mailto:$ref-subscribe\@$debbugs::gEmailDomain">subscribe</a> ),
 +print qq(<p><a href="mailto:$ref\@$gEmailDomain">Reply</a> ),
 +     qq(or <a href="mailto:$ref-subscribe\@$gEmailDomain">subscribe</a> ),
       qq(to this bug.</p>\n);
  print qq(<p><a href="javascript:toggle_infmessages();">Toggle useless messages</a></p>);
 -printf "<div class=\"msgreceived\"><p>View this report as an <a href=\"%s\">mbox folder</a>.</p></div>\n", bugurl($ref, "mbox");
 +printf qq(<div class="msgreceived"><p>View this report as an <a href="%s">mbox folder</a>, ).
 +     qq(<a href="%s">status mbox</a>, <a href="%s">maintainer mbox</a></p></div>\n),
 +     html_escape(bug_url($ref, mbox=>'yes')),
 +     html_escape(bug_url($ref, mbox=>'yes',mboxstatus=>'yes')),
 +     html_escape(bug_url($ref, mbox=>'yes',mboxmaint=>'yes'));
  print "$log";
  print "<HR>";
  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";
diff --combined cgi/pkgreport.cgi
index 30284baa66ac2d0d8cd5406230ce98399c342486,3a96210957183adfccc9d57ba5684d70300c0cf3..c89ded45271e49acf893be0486d1d8169abdf21d
@@@ -3,13 -3,15 +3,13 @@@
  package debbugs;
  
  use strict;
 -use POSIX qw(strftime tzset nice);
 +use POSIX qw(strftime nice);
  
 -#require '/usr/lib/debbugs/errorlib';
  require './common.pl';
  
 -require '/etc/debbugs/config';
 -require '/etc/debbugs/text';
 -
 +use Debbugs::Config qw(:globals :text);
  use Debbugs::User;
 +use Debbugs::CGI qw(version_url);
  
  use vars qw($gPackagePages $gWebDomain %gSeverityDisplay @gSeverityList);
  
@@@ -88,10 -90,10 +88,10 @@@ my %cats = 
      } ],
      "severity" => [ {
          "nam" => "Severity",
 -        "pri" => [map { "severity=$_" } @debbugs::gSeverityList],
 -        "ttl" => [map { $debbugs::gSeverityDisplay{$_} } @debbugs::gSeverityList],
 +        "pri" => [map { "severity=$_" } @gSeverityList],
 +        "ttl" => [map { $gSeverityDisplay{$_} } @gSeverityList],
          "def" => "Unknown Severity",
 -        "ord" => [0,1,2,3,4,5,6,7],
 +        "ord" => [0..@gSeverityList],
      } ],
      "classification" => [ {
          "nam" => "Classification",
@@@ -179,7 -181,10 +179,7 @@@ my $this = ""
  my %indexentry;
  my %strings = ();
  
 -$ENV{"TZ"} = 'UTC';
 -tzset();
 -
 -my $dtime = strftime "%a, %e %b %Y %T UTC", localtime;
 +my $dtime = strftime "%a, %e %b %Y %T UTC", gmtime;
  my $tail_html = $debbugs::gHTMLTail;
  $tail_html = $debbugs::gHTMLTail;
  $tail_html =~ s/SUBSTITUTE_DTIME/$dtime/;
@@@ -371,12 -376,12 +371,12 @@@ print "Content-Type: text/html; charset
  
  print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
  print "<HTML><HEAD>\n" . 
 -    "<TITLE>$debbugs::gProject$Archived $debbugs::gBug report logs: $title</TITLE>\n" .
 -    '<link rel="stylesheet" href="/css/bugs.css" type="text/css">' .
 +    "<TITLE>$gProject$Archived $gBug report logs: $title</TITLE>\n" .
 +    qq(<link rel="stylesheet" href="$gWebHostBugDir/css/bugs.css" type="text/css">) .
      "</HEAD>\n" .
      '<BODY onload="pagemain();">' .
      "\n";
 -print "<H1>" . "$debbugs::gProject$Archived $debbugs::gBug report logs: $title" .
 +print "<H1>" . "$gProject$Archived $gBug report logs: $title" .
        "</H1>\n";
  
  my $showresult = 1;
@@@ -421,12 -426,12 +421,12 @@@ if (defined $pkg || defined $src) 
          if ($pkg and defined($pseudodesc) and exists($pseudodesc->{$pkg})) {
              push @references, "to the <a href=\"http://${debbugs::gWebDomain}/pseudo-packages${debbugs::gHTMLSuffix}\">list of other pseudo-packages</a>";
          } else {
 -            if ($pkg and defined $debbugs::gPackagePages) {
 +            if ($pkg and defined $gPackagePages) {
                  push @references, sprintf "to the <a href=\"%s\">%s package page</a>", urlsanit("http://${debbugs::gPackagePages}/$pkg"), htmlsanit("$pkg");
              }
 -            if (defined $debbugs::gSubscriptionDomain) {
 +            if (defined $gSubscriptionDomain) {
                  my $ptslink = $pkg ? $srcforpkg : $src;
 -                push @references, "to the <a href=\"http://$debbugs::gSubscriptionDomain/$ptslink\">Package Tracking System</a>";
 +                push @references, "to the <a href=\"http://$gSubscriptionDomain/$ptslink\">Package Tracking System</a>";
              }
              # Only output this if the source listing is non-trivial.
              if ($pkg and $srcforpkg and (@pkgs or $pkg ne $srcforpkg)) {
  set_option("archive", !$archive);
  printf "<p>See the <a href=\"%s\">%s reports</a></p>",
       urlsanit('pkgreport.cgi?'.join(';',
 -                                  (map {$_ eq 'archived'?():("$_=$param{$_}")
 +                                  (map {$_ eq 'archive'?():("$_=$param{$_}")
                                     } keys %param
                                    ),
 -                                  ('archived='.($archive?"no":"yes"))
 +                                  ('archive='.($archive?"no":"yes"))
                                   )
             ), ($archive ? "active" : "archived");
  set_option("archive", $archive);
@@@ -612,11 -617,7 +612,11 @@@ sub pkg_htmlindexentrystatus 
          my @fixed = @{$status{fixed_versions}};
          $showversions .= join ', ', map {s{/}{ }; htmlsanit($_)} @fixed;
      }
 -    $result .= " ($showversions)" if length $showversions;
 +    $result .= ' (<a href="'.
 +       version_url($status{package},
 +                   $status{found_versions},
 +                   $status{fixed_versions},
 +                  ).qq{">$showversions</a>)} if length $showversions;
      $result .= ";\n";
  
      $result .= $showseverity;
      $result .= buglinklist(";\nBlocks ", ", ",
          split(/ /,$status{blocks}));
  
 -    my $days = 0;
      if (length($status{done})) {
          $result .= "<br><strong>Done:</strong> " . htmlsanit($status{done});
 -# Disabled until archiving actually works again
 -#        $days = ceil($debbugs::gRemoveAge - -M buglog($status{id}));
 -#         if ($days >= 0) {
 -#             $result .= ";\n<strong>Will be archived" . ( $days == 0 ? " today" : $days == 1 ? " in $days day" : " in $days days" ) . "</strong>";
 -#         } else {
 -#             $result .= ";\n<strong>Archived</strong>";
 -        }
 +        my $days = bug_archiveable(bug => $status{id},
 +                                 status => \%status,
 +                                 days_until => 1,
 +                                );
 +        if ($days >= 0) {
 +            $result .= ";\n<strong>Will be archived" . ( $days == 0 ? " today" : $days == 1 ? " in $days day" : " in $days days" ) . "</strong>";
 +        }
      }
  
      unless (length($status{done})) {
              $result .= ";\n<strong>Forwarded</strong> to "
                         . join(', ',
                              map {maybelink($_)}
 -                            split /,\s*/,$status{forwarded}
 +                            split /[,\s]+/,$status{forwarded}
                             );
          }
          my $daysold = int((time - $status{date}) / 86400);   # seconds to days
@@@ -693,7 -695,7 +693,7 @@@ sub pkg_htmlizebugs 
      my $header = '';
      my $footer = "<h2 class=\"outstanding\">Summary</h2>\n";
  
 -    my @dummy = ($debbugs::gRemoveAge); #, @debbugs::gSeverityList, @debbugs::gSeverityDisplay);  #, $debbugs::gHTMLExpireNote);
 +    my @dummy = ($gRemoveAge); #, @gSeverityList, @gSeverityDisplay);  #, $gHTMLExpireNote);
  
      if (@bugs == 0) {
          return "<HR><H2>No reports found!</H2></HR>\n";
@@@ -819,7 -821,20 +819,7 @@@ sub pkg_htmlpackagelinks 
  }
  
  sub pkg_htmladdresslinks {
 -    my ($prefixfunc, $urlfunc, $addresses) = @_;
 -    if (defined $addresses and $addresses ne '') {
 -        my @addrs = getparsedaddrs($addresses);
 -        my $prefix = (ref $prefixfunc) ? $prefixfunc->(scalar @addrs)
 -                                       : $prefixfunc;
 -        return $prefix .
 -               join ', ', map { sprintf '<a class="submitter" href="%s">%s</a>',
 -                                        $urlfunc->($_->address),
 -                                        htmlsanit($_->format) || '(unknown)'
 -                              } @addrs;
 -    } else {
 -        my $prefix = (ref $prefixfunc) ? $prefixfunc->(1) : $prefixfunc;
 -        return sprintf '%s<a class="submitter" href="%s">(unknown)</a>', $prefix, $urlfunc->('');
 -    }
 +     htmlize_addresslinks(@_,'submitter');
  }
  
  sub pkg_javascript {
@@@ -942,12 -957,13 +942,13 @@@ sub pkg_htmlselectarch 
  }
  
  sub myurl {
-     return pkg_etc_url($pkg, "pkg", 0) if defined($pkg);
-     return pkg_etc_url($src, "src", 0) if defined($src);
-     return pkg_etc_url($maint, "maint", 0) if defined($maint);
-     return pkg_etc_url($submitter, "submitter", 0) if defined($submitter);
-     return pkg_etc_url($severity, "severity", 0) if defined($severity);
-     return pkg_etc_url($tag, "tag", 0) if defined($tag);
+      return urlsanit('pkgreport.cgi?'.
+                    join(';',
+                         (map {("$_=$param{$_}")
+                                           } keys %param
+                         )
+                        )
+                   );
  }
  
  sub make_order_list {
@@@ -1002,8 -1018,13 +1003,8 @@@ sub get_bug_order_index 
  
  sub buglinklist {
      my ($prefix, $infix, @els) = @_;
 -    my $sep = $prefix;
 -    my $r = "";
 -    for my $e (@els) {
 -        $r .= $sep."<A class=\"submitter\" href=\"" . bugurl($e) . "\">#$e</A>";
 -        $sep = $infix;
 -    }
 -    return $r;
 +    return '' if not @els;
 +    return $prefix . bug_linklist($infix,'submitter',@els);
  }
  
  
diff --combined debian/changelog
index b7536a57febb04b21cb14200de75b7eed863ad0f,df88ac098fd6fc84650acc7f6f8a21cdafd129ed..5708cbd09ddf936707f87a3c25aa91465a779963
@@@ -124,7 -124,6 +124,7 @@@ debbugs (2.4.2) UNRELEASED; urgency=lo
      - Explain how to close bugs in the ack message (closes: #37605)
      - Make the moreinfo ack more general (closes: #70810)
      - Use RFC compliant dates in headers (closes: #362935)
 +    - Add SOAP support (closes: #377520) Thanks to Raphael Hertzog.
      - Split forwarded on commas for linking (closes: #367813)
      - Don't display duplicate bugs (closes: #348116)
      - Display links to archived bugs for all searches (closes: #53710)
      - Fix javascript error in pkgreport.cgi (closes: #346043)
      - When a bug can't be found in control@; indicate to user that it may
        be archived. (closes: #153536)
+     - my_url in pkgreport.cgi now returns the complete url (closes: #378566)
+     - Document precisely how forwarded works (closes: #228049)
+     - Dissallow forwarded being set to a $gEmailDomain address
+       (closes: #397486)
      - Fix broken sorting by usertags by forcing numeric (closes: #395027)