X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=cgi%2Fpkgreport.cgi;h=1ea9a17a314160b2c83314677852e8f5f6312235;hb=05f158937d8e18b9bec70594f465fc078ed3bc59;hp=a856a80981923beae5b7f51917ff8776603afe54;hpb=89c921ea1cc1577e381843348fe54c802cf10dfc;p=debbugs.git diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index a856a80..1ea9a17 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -13,6 +13,12 @@ use warnings; use strict; +# Sanitize environent for taint +BEGIN{ + delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; +} + +binmode(STDOUT,':encoding(UTF-8)'); use POSIX qw(strftime nice); use Debbugs::Config qw(:globals :text :config); @@ -54,6 +60,7 @@ our %param = cgi_parameters(query => $q, qw(bug-rev pend-rev sev-rev), qw(maxdays mindays version), qw(data which dist newest), + qw(noaffects), ], default => $default_params, ); @@ -77,7 +84,8 @@ if (exists $param{form_options} and defined $param{form_options}) { } for my $incexc (qw(include exclude)) { next unless exists $param{$incexc}; - $param{$incexc} = [grep /\S\:\S/, make_list($param{$incexc})]; + # normalize tag to tags + $param{$incexc} = [map {s/^tag:/tags:/; $_} grep /\S\:\S/, make_list($param{$incexc})]; } for my $key (keys %package_search_keys) { next unless exists $param{key}; @@ -93,6 +101,16 @@ if (exists $param{form_options} and defined $param{form_options}) { exit 0; } +# normalize innclude/exclude keys; currently this is in two locations, +# which is suboptimal. Closes: #567407 +for my $incexc (qw(include exclude)) { + next unless exists $param{$incexc}; + # normalize tag to tags + $param{$incexc} = [map {s/^tag:/tags:/; $_} make_list($param{$incexc})]; +} + + + # map from yes|no to 1|0 for my $key (qw(repeatmerged bug-rev pend-rev sev-rev)) { if (exists $param{$key}){ @@ -360,6 +378,23 @@ my $title = $gBugs.' '.join(' and ', map {/ or /?"($_)":$_} @title); usertags => \%ut, ); +# shove in bugs which affect this package if there is a package or a +# source given (by default), but no affects options given +if (not exists $param{affects} and not exists $param{noaffects} and + (exists $param{src} or + exists $param{package})) { + push @bugs, get_bugs((map {my $key = $_; + exists $param{$key}?($key =~ /^(?:package|src)$/?'affects':$key, + ($key eq 'src'?[map {"src:$_"}make_list($param{$key})]:$param{$_})):()} + grep {$_ ne 'newest'} + keys %package_search_keys, 'archive'), + usertags => \%ut, + ); +} + +# filter out included or excluded bugs + + if (defined $param{version}) { $title .= " at version $param{version}"; } @@ -401,6 +436,7 @@ my $result = pkg_htmlizebugs(bugs => \@bugs, (exists $param{dist})?(dist => $param{dist}):(), ); +print "Cache-Control: public, max-age=300\n"; print "Content-Type: text/html; charset=utf-8\n\n"; print "\n"; @@ -424,7 +460,7 @@ if (defined $pseudodesc and defined $pkg and exists $pseudodesc->{$pkg}) { delete $param{dist}; } -# output infomration about the packages +# output information about the packages for my $package (make_list($param{package}||[])) { print generate_package_info(binary => 1, @@ -454,7 +490,7 @@ if (exists $param{submitter}) { print $result; -print pkg_javascript() . "\n"; +print fill_in_template(template=>'cgi/pkgreport_javascript'); print qq(

Options

\n);