use Debbugs::CGI qw(:url :html);
-html_escape(bug_url($ref,mbox=>'yes',mboxstatus=>'yes'));
-
=head1 DESCRIPTION
This module is a replacement for parts of common.pl; subroutines in
$DEBUG = 0 unless defined $DEBUG;
@EXPORT = ();
- %EXPORT_TAGS = (url => [qw(bug_url bug_links bug_linklist maybelink),
- qw(set_url_params pkg_url version_url),
+ %EXPORT_TAGS = (url => [qw(bug_links bug_linklist maybelink),
+ qw(set_url_params version_url),
qw(submitterurl mainturl munge_url),
qw(package_links bug_links),
],
}
-=head2 bug_url
-
- bug_url($ref,mbox=>'yes',mboxstat=>'yes');
-
-Constructs urls which point to a specific
-
-XXX use Params::Validate
-
-=cut
-
-sub bug_url{
- my $ref = shift;
- my %params;
- if (@_ % 2) {
- shift;
- %params = (%URL_PARAMS,@_);
- }
- else {
- %params = @_;
- }
- carp "bug_url is deprecated, use bug_links instead";
-
- return munge_url('bugreport.cgi?',%params,bug=>$ref);
-}
-
-sub pkg_url{
- my %params;
- if (@_ % 2) {
- shift;
- %params = (%URL_PARAMS,@_);
- }
- else {
- %params = @_;
- }
- carp "pkg_url is deprecated, use package_links instead";
- return munge_url('pkgreport.cgi?',%params);
-}
-
=head2 munge_url
my $url = munge_url($url,%params_to_munge);
XXX Use L<Params::Validate>; we want to be able to support query
arguments here too; we should be able to combine bug_links and this
-function into one. [Hell, bug_url should be one function with this one
-too.]
+function into one.
=cut
# this will be cleaned up once it goes out of scope
my $tempdir = File::Temp->newdir();
$parser->output_under($tempdir->dirname());
+ $parser->filer->ignore_filename(1);
my $entity;
if ($record->{inner_file}) {
$entity = $parser->parse($record->{fh});
__END__
-
-
-
-
-
-
+# Local Variables:
+# cperl-indent-level: 4
+# indent-tabs-mode: nil
+# End:
);
my $html = "<li>"; #<a href=\"%s\">#%d: %s</a>\n<br>",
- #bug_url($bug), $bug, html_escape($status{subject});
$html .= short_bug_status_html(status => \%status,
options => $param{options},
) . "\n";
=head1 NAME
-Debbugs::Log::Spam -- an interface to debbugs .log.spam files
+Debbugs::Log::Spam -- an interface to debbugs .log.spam files and .log.spam.d
+directories
=head1 SYNOPSIS
=head1 DESCRIPTION
+Spam in bugs can be excluded using a .log.spam file and a .log.spam.d directory.
+The file contains message ids, one per line, and the directory contains files
+named after message ids, one per file.
=head1 BUGS
chomp;
$self->{spam}{$_} = 1;
}
- close ($fh);
+ close ($fh) or
+ croak "Unable to close bug log filehandle: $!";
+ }
+ if (-d $self->{name}.'.d') {
+ opendir(my $d,$self->{name}.'.d') or
+ croak "Unable to open bug log spamdir '$self->{name}.d' for reading: $!";
+ for my $dir (readdir($d)) {
+ next unless $dir =~ m/([^\.].*)_(\w+)$/;
+ $self->{spam}{$1} = 1;
+ }
+ closedir($d) or
+ croak "Unable to close bug log spamdir: $!";
}
return $self;
}
@EXPORT_OK = ();
Exporter::export_ok_tags(qw(templates));
$EXPORT_TAGS{all} = [@EXPORT_OK];
- push @ISA,qw(Safe::Hole::User);
}
-use Safe;
-use Safe::Hole;
use Text::Template;
use Storable qw(dclone);
our %tt_templates;
our %filled_templates;
-our $safe;
our $language;
# This function is what is called when someone does include('foo/bar')
sub include {
my $template = shift;
$filled_templates{$template}++;
- print STDERR "include template $template language $language safe $safe\n" if $DEBUG;
+ print STDERR "include template $template language $language\n" if $DEBUG;
# Die if we're in a template loop
die "Template loop with $template" if $filled_templates{$template} > 10;
my $filled_tmpl = '';
$filled_tmpl = fill_in_template(template => $template,
variables => {},
language => $language,
- safe => $safe,
);
};
if ($@) {
},
},
);
- #@param{qw(template variables language safe output hole_var no_safe)} = @_;
if ($DEBUG) {
print STDERR "fill_in_template ";
print STDERR join(" ",map {exists $param{$_}?"$_:$param{$_}":()} keys %param);
die "Unable to find template $param{template} with language $param{language}";
}
-# if (defined $param{safe}) {
-# $safe = $param{safe};
-# }
-# else {
-# print STDERR "Created new safe\n" if $DEBUG;
-# $safe = Safe->new() or die "Unable to create safe compartment";
-# $safe->permit_only(':base_core',':base_loop',':base_mem',
-# qw(padsv padav padhv padany),
-# qw(rv2gv refgen srefgen ref),
-# qw(caller require entereval),
-# qw(gmtime time sprintf prtf),
-# qw(sort),
-# );
-# $safe->share('*STDERR');
-# $safe->share('%config');
-# $hole->wrap(\&Debbugs::Text::include,$safe,'&include');
-# my $root = $safe->root();
-# # load variables into the safe
-# for my $key (keys %{$param{variables}||{}}) {
-# print STDERR "Loading $key\n" if $DEBUG;
-# if (ref($param{variables}{$key})) {
-# no strict 'refs';
-# print STDERR $safe->root().'::'.$key,qq(\n) if $DEBUG;
-# *{"${root}::$key"} = $param{variables}{$key};
-# }
-# else {
-# no strict 'refs';
-# ${"${root}::$key"} = $param{variables}{$key};
-# }
-# }
-# for my $key (keys %{exists $param{hole_var}?$param{hole_var}:{}}) {
-# print STDERR "Wraping $key as $param{hole_var}{$key}\n" if $DEBUG;
-# $hole->wrap($param{hole_var}{$key},$safe,$key);
-# }
-# }
$language = $param{language};
my $tt;
if ($tt_type eq 'FILE' and
if (not defined $tt) {
die "Unable to create Text::Template for $tt_type:$tt_source";
}
- my $ret = $tt->fill_in(#SAFE => $safe,
- PACKAGE => 'DTT',
+ my $ret = $tt->fill_in(PACKAGE => 'DTT',
HASH => {%{$param{variables}//{}},
(map {my $t = $_; $t =~ s/^\&//; ($t => $param{hole_var}{$_})}
keys %{$param{hole_var}//{}}),
if ($DEBUG) {
no strict 'refs';
no warnings 'uninitialized';
-# my $temp = $param{nosafe}?'main':$safe->{Root};
print STDERR "Variables for $param{template}\n";
-# print STDERR "Safe $temp\n";
-# print STDERR map {"$_: ".*{$_}."\n"} keys %{"${temp}::"};
}
return $ret;
=head1 SYNOPSIS
- [options]
+ local-debbugs [options]
Options:
--mirror, -M update local mirror
use User;
use Config::Simple;
+use File::Basename qw(dirname);
use File::Temp qw(tempdir);
use Params::Validate qw(validate_with :types);
use POSIX 'setsid';
-use Debbugs::Common qw(checkpid lockpid get_hashname);
-use Debbugs::Mail qw(get_addresses);
use SOAP::Lite;
use IPC::Run;
use IO::File;
use File::Path;
-
+use File::Spec;
my %options = (debug => 0,
help => 0,
verbose => 0,
quiet => 0,
detach => 1,
- cgi_bin => '/var/lib/debbugs/www/cgi',
- css => '/var/lib/debbugs/www/bugs.css',
+ git_mode => -d (dirname(__FILE__).'/../.git') ? 1 : 0,
bug_site => 'bugs.debian.org',
bug_mirror => 'bugs-mirror.debian.org',
);
'bug_mirror|bug-mirror=s',
'debug|d+','help|h|?','man|m');
+if ($options{git_mode}) {
+ my $base_dir = dirname(File::Spec->rel2abs(dirname(__FILE__)));
+ $options{cgi_bin} = "$base_dir/cgi" unless defined $options{cgi_bin};
+ $options{css} = "$base_dir/html/bugs.css" unless defined $options{css};
+ $options{template_dir} = "$base_dir/templates";
+ $options{base_dir} = $base_dir;
+ eval "use lib '$options{base_dir}'";
+} else {
+ $options{cgi_bin} = '/var/lib/debbugs/www/cgi';
+ $options{css} = '/var/lib/debbugs/www/bugs.css';
+ $options{template_dir} = "/usr/share/debbugs/templates";
+}
+
+eval "use Debbugs::Common qw(checkpid lockpid get_hashname)";
+eval "use Debbugs::Mail qw(get_addresses)";
+
pod2usage() if $options{help};
pod2usage({verbose=>2}) if $options{man};
print {$conf} <<"EOF";
\$gConfigDir = "$options{mirror_location}";
\$gSpoolDir = "$options{mirror_location}";
+\$gTemplateDir = "$options{template_dir}";
\$gWebHost = 'localhost:$options{port}';
\$gPackageSource = '';
\$gPseudoDescFile = '';
package local_debbugs::server;
use IO::File;
use HTTP::Server::Simple;
+ use File::Basename qw(dirname);
use base qw(HTTP::Server::Simple::CGI HTTP::Server::Simple::CGI::Environment);
sub net_server {
redirect($cgi,$base_uri."/cgi-bin/pkgreport.cgi?pkg=$1");
}
elsif ($path =~ m{^/?cgi(?:-bin)?/((?:(?:bug|pkg)report|version)\.cgi)}) {
- # dispatch to pkgreport.cgi
- #print "HTTP/1.1 200 OK\n";
- open(my $fh,'-|',"$options{cgi_bin}/$1") or
- die "Unable to execute $options{cgi_bin}/$1";
+ my @exec_options = "$options{cgi_bin}/$1";
+ if ($options{git_mode}) {
+ unshift @exec_options,
+ 'perl','-I',$options{base_dir},'-T';
+ }
+ open(my $fh,'-|',@exec_options) or
+ die "Unable to execute $options{cgi_bin}/$1";
my $status;
my $cache = '';
while (<$fh>) {
elsif (/\s\w+\:/) {
push @bug_selections, $_;
}
- }
+ }
}
# Split archive:both into archive:1 and archive:0
@bug_selections =
$bugs{$archived_bugs}{$_} = 1 for @{$bugs};
}
}
+ for my $bug (@bugs) {
+ $bugs{archived}{$bug} = 1;
+ $bugs{unarchived}{$bug} = 1;
+ }
return \%bugs;
}
__END__
+# Local Variables:
+# cperl-indent-level: 4
+# indent-tabs-mode: nil
+# End:
use Scalar::Util qw(looks_like_number);
use Debbugs::Text qw(:templates);
-
+use URI::Escape qw(uri_escape_utf8);
use List::AllUtils qw(max);
next if @records > 1 and $spam->is_spam($msg_id);
my @lines;
if ($record->{inner_file}) {
- push @lines, $record->{fh}->getline;
- push @lines, $record->{fh}->getline;
+ push @lines, scalar $record->{fh}->getline;
+ push @lines, scalar $record->{fh}->getline;
chomp $lines[0];
chomp $lines[1];
} else {
msg => $msg,
isstrongseverity => \&Debbugs::Status::isstrongseverity,
html_escape => \&Debbugs::CGI::html_escape,
+ uri_escape => \&URI::Escape::uri_escape_utf8,
looks_like_number => \&Scalar::Util::looks_like_number,
make_list => \&Debbugs::Common::make_list,
},
hole_var => {'&package_links' => \&Debbugs::CGI::package_links,
'&bug_links' => \&Debbugs::CGI::bug_links,
'&version_url' => \&Debbugs::CGI::version_url,
- '&bug_url' => \&Debbugs::CGI::bug_url,
'&strftime' => \&POSIX::strftime,
'&maybelink' => \&Debbugs::CGI::maybelink,
},
path if the sendmail default is wrong. (Closes: #719205)
* Fix links to merged and blocked bugs. (Closes: #539691)
* Strip out Mail-Followup-To: (Closes: #798092)
+ * Include references from the original message in replies. (Closes: #485697)
+ Thanks to Julien Cristau
+ * Use pass-through for rewrites of URLs to hide implementation (Closes:
+ #871784) Thanks to Ridier 'OdyX' Raboud
[ Niels Thykier ]
* quitcgi() now returns 400/500 status codes instead of 200 (Closes: #584922)
libhttp-server-simple-perl, libtest-www-mechanize-perl,
libmail-rfc822-address-perl, libsafe-hole-perl, libuser-perl,
libconfig-simple-perl, libtest-pod-perl, liblist-allutils-perl,
-# used by Debbugs::Libravatar and libravatar.cgi
libfile-libmagic-perl, libgravatar-url-perl, libwww-perl, imagemagick,
libdbix-class-perl, libdatetime-format-pg-perl,
libdatetime-format-mail-perl,
- libtext-template-perl, graphviz, libtext-iconv-perl
+ libtext-template-perl, graphviz, libtext-iconv-perl, libnet-server-perl
Homepage: http://wiki.debian.org/Teams/Debbugs
Package: debbugs
# The following two redirect to up-to-date pages
RewriteRule ^/[[:space:]]*#?([[:digit:]][[:digit:]][[:digit:]]+)([;&].+)?$ /cgi-bin/bugreport.cgi?bug=$1$2 [L,R,NE]
RewriteRule ^/([^/+]*)([+])([^/]*)$ "/$1%%{%}2B$3" [N]
- RewriteRule ^/[Ff][Rr][Oo][Mm]:([^/]+\@.+)$ /cgi-bin/pkgreport.cgi?submitter=$1 [L,R,NE]
+ RewriteRule ^/[Ff][Rr][Oo][Mm]:([^/]+\@.+)$ /cgi-bin/pkgreport.cgi?submitter=$1 [PT,NE]
# Commented out, 'cuz aj says it will crash master. (old master)
# RewriteRule ^/[Ss][Ee][Vv][Ee][Rr][Ii][Tt][Yy]:([^/]+\@.+)$ /cgi-bin/pkgreport.cgi?severity=$1 [L,R]
- RewriteRule ^/([^/]+\@.+)$ /cgi-bin/pkgreport.cgi?maint=$1 [L,R,NE]
- RewriteRule ^/mbox:([[:digit:]][[:digit:]][[:digit:]]+)([;&].+)?$ /cgi-bin/bugreport.cgi?mbox=yes&bug=$1$2 [L,R,NE]
- RewriteRule ^/src:([^/]+)$ /cgi-bin/pkgreport.cgi?src=$1 [L,R,NE]
- RewriteRule ^/severity:([^/]+)$ /cgi-bin/pkgreport.cgi?severity=$1 [L,R,NE]
- RewriteRule ^/tag:([^/]+)$ /cgi-bin/pkgreport.cgi?tag=$1 [L,R,NE]
+ RewriteRule ^/([^/]+\@.+)$ /cgi-bin/pkgreport.cgi?maint=$1 [PT,NE]
+ RewriteRule ^/mbox:([[:digit:]][[:digit:]][[:digit:]]+)([;&].+)?$ /cgi-bin/bugreport.cgi?mbox=yes&bug=$1$2 [PT,NE]
+ RewriteRule ^/src:([^/]+)$ /cgi-bin/pkgreport.cgi?src=$1 [PT,NE]
+ RewriteRule ^/severity:([^/]+)$ /cgi-bin/pkgreport.cgi?severity=$1 [PT,NE]
+ RewriteRule ^/tag:([^/]+)$ /cgi-bin/pkgreport.cgi?tag=$1 [PT,NE]
# RewriteMap fix-chars int:noescape
RewriteCond %{REQUEST_URI} ^/(Access\.html|Developer\.html|Reporting\.html|server-request\.html|server-control\.html|server-refcard\.html).* [NC]
RewriteRule .* - [L]
- RewriteRule ^/([0-9]+)$ /cgi-bin/bugreport.cgi?bug=$1 [L,R,NE]
- RewriteRule ^/([^/]+)$ /cgi-bin/pkgreport.cgi?pkg=$1 [L,R,NE]
+ # PT|passthrough to bugreport.cgi and pkgreport.cgi
+ RewriteRule ^/([0-9]+)$ /cgi-bin/bugreport.cgi?bug=$1 [PT,NE]
+ RewriteRule ^/([^/]+)$ /cgi-bin/pkgreport.cgi?pkg=$1 [PT,NE]
</VirtualHost>
use warnings;
use strict;
-use locale;
use POSIX qw(strftime locale_h);
setlocale(LC_TIME, "C");
$_ = $hdr;
s/\n\s/ /g;
finish() if m/^x-loop: (\S+)$/i && $1 eq "$gMaintainerEmail";
- my $ins = !m/^(?:(?:subject|reply-to|return-path|mail-followup-to):
+ my $ins = !m/^(?:(?:subject|reply-to|return-path|
+ mail-followup-to|
+ references):
|From\s|X-Debbugs-)/xi;
$fwd .= encode_utf8($hdr)."\n" if $ins;
# print {$debugfh} ">$_<\n";
$resentcc= "Resent-CC: $resentccval\n";
}
+my $referencesval = join(' ',grep {defined $_} $header{'references'},$data->{msgid});
+my $references = '';
+if (!$newref && length($referencesval)) {
+ $references = "References: $referencesval\n";
+}
+
my $common_headers='';
{
my @tmp = @common_headers;
X-$gProject-PR-Message: report $ref
X-$gProject-PR-Package: $data->{package}
X-$gProject-PR-Keywords: $data->{keywords}
-${source_pr_header}
+${references}${source_pr_header}
END
chomp $enc_msg;
$enc_msg = encode_utf8($enc_msg).$fwd."\n";
X-$gProject-PR-Message: $report_followup $ref
X-$gProject-PR-Package: $data->{package}
X-$gProject-PR-Keywords: $data->{keywords}
-${source_pr_header}
+${references}${source_pr_header}
END
chomp $enc_msg;
$enc_msg = encode_utf8($enc_msg).$fwd."\n";
${common_headers}X-$gProject-PR-Message: $report_followup $ref
X-$gProject-PR-Package: $data->{package}
X-$gProject-PR-Keywords: $data->{keywords}
-${source_pr_header}
+${references}${source_pr_header}
END
chomp $enc_msg;
$enc_msg = encode_utf8($enc_msg).$fwd."\n";
use warnings;
use strict;
-use locale;
use POSIX qw(strftime locale_h);
setlocale(LC_TIME, "C");