X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=cgi%2Fpkgreport.cgi;h=abf739dec4c544f55dcfebb88b3c99d8ad78f245;hb=4b5667efca09883c3c7e96380fe3dfa7e427bce2;hp=78a7e884b227a04d0bef96cd08a88cc1f9b70fa8;hpb=d6288c2df805482f0f59b0684691bf1755acda80;p=debbugs.git diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index 78a7e88..abf739d 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -13,7 +13,14 @@ 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 List::AllUtils qw(uniq); use Debbugs::Config qw(:globals :text :config); @@ -54,6 +61,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 +85,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 +102,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}){ @@ -210,7 +229,8 @@ our %cats = ( "ord" => [2,3,4,1,0,5], } ], "oldview" => [ qw(status severity) ], - "normal" => [ qw(status severity classification) ], + "normal" => [ qw(status severity classification) ], + raw => [{nam => 'Raw',def => 'Raw'}], ); if (exists $param{which} and exists $param{data}) { @@ -226,16 +246,15 @@ if (defined $param{maintenc}) { delete $param{maintenc} } - -if (not grep {exists $param{$_}} keys %package_search_keys and exists $param{users}) { - $param{usertag} = [make_list($param{users})]; -} - if (exists $param{pkg}) { $param{package} = $param{pkg}; delete $param{pkg}; } +if (not grep {exists $param{$_}} keys %package_search_keys and exists $param{users}) { + $param{usertag} = [make_list($param{users})]; +} + my %bugusertags; my %ut; my %seen_users; @@ -258,7 +277,8 @@ if (defined $param{usertag}) { } } -quitcgi("You have to choose something to select by") unless grep {exists $param{$_}} keys %package_search_keys; +quitcgi("You have to choose something to select by", '400 Bad Request') + unless grep {exists $param{$_}} keys %package_search_keys; my $Archived = $param{archive} ? " Archived" : ""; @@ -361,6 +381,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}"; } @@ -402,6 +439,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"; @@ -425,7 +463,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, @@ -453,143 +491,21 @@ if (exists $param{submitter}) { print "different addresses.\n"; } -# my $archive_links; -# my @archive_links; -# my %archive_values = (both => 'archived and unarchived', -# 0 => 'not archived', -# 1 => 'archived', -# ); -# while (my ($key,$value) = each %archive_values) { -# next if $key eq lc($param{archive}); -# push @archive_links, qq($value reports ); -# } -# print '

See the '.join (' or ',@archive_links)."

\n"; - print $result; -print pkg_javascript() . "\n"; +print fill_in_template(template=>'cgi/pkgreport_javascript'); print qq(

Options

\n); +$param{orderings} = + [uniq((grep {!$hidden{$_}} keys %cats), + $param{ordering})]; print option_form(template => 'cgi/pkgreport_options', param => \%param, form_options => $form_options, variables => $form_option_variables, ); -# print "

Options

\n"; -# print "
\n"; -# printf "
\n", myurl(); -# -# print "\n"; -# -# my ($checked_any, $checked_sui, $checked_ver) = ("", "", ""); -# if (defined $dist) { -# $checked_sui = "CHECKED"; -# } elsif (defined $version) { -# $checked_ver = "CHECKED"; -# } else { -# $checked_any = "CHECKED"; -# } -# -# print "\n"; -# print " \n"; -# print ""; -# print " \n"; -# -# if (defined $pkg) { -# my $v = html_escape($version) || ""; -# my $pkgsane = html_escape($pkg->[0]); -# print ""; -# print " \n"; -# } elsif (defined $src) { -# my $v = html_escape($version) || ""; -# my $srcsane = html_escape($src->[0]); -# print ""; -# print " \n"; -# } -# print "\n"; -# -# my $includetags = html_escape(join(" ", grep { !m/^subj:/i } map {split /[\s,]+/} ref($include)?@{$include}:$include)); -# my $excludetags = html_escape(join(" ", grep { !m/^subj:/i } map {split /[\s,]+/} ref($exclude)?@{$exclude}:$exclude)); -# my $includesubj = html_escape(join(" ", map { s/^subj://i; $_ } grep { m/^subj:/i } map {split /[\s,]+/} ref($include)?@{$include}:$include)); -# my $excludesubj = html_escape(join(" ", map { s/^subj://i; $_ } grep { m/^subj:/i } map {split /[\s,]+/} ref($exclude)?@{$exclude}:$exclude)); -# my $vismindays = ($mindays == 0 ? "" : $mindays); -# my $vismaxdays = ($maxdays == -1 ? "" : $maxdays); -# -# my $sel_rmy = ($param{repeatmerged} ? " selected" : ""); -# my $sel_rmn = ($param{repeatmerged} ? "" : " selected"); -# my $sel_ordraw = ($ordering eq "raw" ? " selected" : ""); -# my $sel_ordold = ($ordering eq "oldview" ? " selected" : ""); -# my $sel_ordnor = ($ordering eq "normal" ? " selected" : ""); -# my $sel_ordage = ($ordering eq "age" ? " selected" : ""); -# -# my $chk_bugrev = ($bug_rev ? " checked" : ""); -# my $chk_pendrev = ($pend_rev ? " checked" : ""); -# my $chk_sevrev = ($sev_rev ? " checked" : ""); -# -# print < -# -# -# -# -# -# \n"; -# -# printf "\n", -# pkg_htmlselectyesno("pend-rev", "outstanding bugs first", "done bugs first", $pend_rev); -# printf "\n", -# pkg_htmlselectyesno("sev-rev", "highest severity first", "lowest severity first", $sev_rev); -# printf "\n", -# pkg_htmlselectyesno("bug-rev", "oldest bugs first", "newest bugs first", $bug_rev); -# -# print < -# -# EOF -# -# print "
Show bugs applicable toanything
" . pkg_htmlselectsuite(1,2,1) . " for " . pkg_htmlselectarch(1,2,2) . "
$pkgsane version
$srcsane version
 
Only include bugs tagged with or that have in their subject
Exclude bugs tagged with or that have in their subject
Only show bugs older than days, and younger than days
 
Merged bugs should be -# -#
Categorise bugs by -#
Order bugs by%s
%s
%s
 
with new settings
\n"; - print "
\n"; print fill_in_template(template=>'html/html_tail', hole_var => {'&strftime' => \&POSIX::strftime,