summaryrefslogtreecommitdiffstats
path: root/collectstats.pl
diff options
context:
space:
mode:
authorjustdave%bugzilla.org <>2004-05-27 18:21:24 +0200
committerjustdave%bugzilla.org <>2004-05-27 18:21:24 +0200
commit66984b98691edbbd4617a351c9a976ad9d6a8f58 (patch)
treeba90f0eaf06dce1484b3c0210563c05899bccdd5 /collectstats.pl
parent3a5de3cbf019668cc3963caa566feb1ee15b6e19 (diff)
downloadbugzilla-66984b98691edbbd4617a351c9a976ad9d6a8f58.tar.gz
bugzilla-66984b98691edbbd4617a351c9a976ad9d6a8f58.tar.xz
Bug 183753: Fix error "can't fork duplicates.cgi: Bad file descriptor" in collectstats.pl on Win32
Patch by Byron Jones <bugzilla@glob.com.au> r=jouni, myk; a=myk
Diffstat (limited to 'collectstats.pl')
-rwxr-xr-xcollectstats.pl32
1 files changed, 21 insertions, 11 deletions
diff --git a/collectstats.pl b/collectstats.pl
index 7391d32da..ec6b4cf70 100755
--- a/collectstats.pl
+++ b/collectstats.pl
@@ -84,18 +84,27 @@ my $tend = time;
CollectSeriesData();
-# Generate a static RDF file containing the default view of the duplicates data.
-open(CGI, "GATEWAY_INTERFACE=cmdline REQUEST_METHOD=GET QUERY_STRING=ctype=rdf ./duplicates.cgi |")
- || die "can't fork duplicates.cgi: $!";
-open(RDF, ">$datadir/duplicates.tmp")
- || die "can't write to $datadir/duplicates.tmp: $!";
-my $headers_done = 0;
-while (<CGI>) {
- print RDF if $headers_done;
- $headers_done = 1 if $_ eq "\n";
+{
+ local $ENV{'GATEWAY_INTERFACE'} = 'cmdline';
+ local $ENV{'REQUEST_METHOD'} = 'GET';
+ local $ENV{'QUERY_STRING'} = 'ctype=rdf';
+
+ my $perl = $^X;
+ trick_taint($perl);
+
+ # Generate a static RDF file containing the default view of the duplicates data.
+ open(CGI, "$perl -T duplicates.cgi |")
+ || die "can't fork duplicates.cgi: $!";
+ open(RDF, ">$datadir/duplicates.tmp")
+ || die "can't write to $datadir/duplicates.tmp: $!";
+ my $headers_done = 0;
+ while (<CGI>) {
+ print RDF if $headers_done;
+ $headers_done = 1 if $_ eq "\n";
+ }
+ close CGI;
+ close RDF;
}
-close CGI;
-close RDF;
if (-s "$datadir/duplicates.tmp") {
rename("$datadir/duplicates.rdf", "$datadir/duplicates-old.rdf");
rename("$datadir/duplicates.tmp", "$datadir/duplicates.rdf");
@@ -183,6 +192,7 @@ sub calculate_dupes {
# so we can read it back in to do changed counters
# First, delete it if it exists, so we don't add to the contents of an old file
if (my @files = <$datadir/duplicates/dupes$today*>) {
+ map { trick_taint($_) } @files;
unlink @files;
}