diff options
author | Byron Jones <bjones@mozilla.com> | 2013-03-25 05:50:05 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-03-25 05:50:05 +0100 |
commit | 9c177145ceb127429b4dc71499ab879caf607fd4 (patch) | |
tree | b12ee791570ea109f053e942195b05154ade5d14 /Bugzilla | |
parent | ddf489ad8abf9e0afa3d4545e784eab7c854bcbe (diff) | |
download | bugzilla-9c177145ceb127429b4dc71499ab879caf607fd4.tar.gz bugzilla-9c177145ceb127429b4dc71499ab879caf607fd4.tar.xz |
Bug 849120: change "send error to error reporter" from forking to running a process
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Arecibo.pm | 33 | ||||
-rw-r--r-- | Bugzilla/Install/Filesystem.pm | 1 |
2 files changed, 13 insertions, 21 deletions
diff --git a/Bugzilla/Arecibo.pm b/Bugzilla/Arecibo.pm index 760c60c59..8c3282ab7 100644 --- a/Bugzilla/Arecibo.pm +++ b/Bugzilla/Arecibo.pm @@ -20,9 +20,10 @@ our @EXPORT = qw( use Apache2::Log; use Apache2::SubProcess; use Carp; +use Data::Dumper; use Email::Date::Format qw(email_gmdate); +use File::Temp; use LWP::UserAgent; -use POSIX qw(setsid nice); use Sys::Hostname; use Bugzilla::Constants; @@ -205,27 +206,17 @@ sub arecibo_handle_error { username => $username, ]; - # fork then post - local $SIG{CHLD} = 'IGNORE'; - my $pid = fork(); - if (defined($pid) && $pid == 0) { - # detach - chdir('/'); - open(STDIN, '</dev/null'); - open(STDOUT, '>/dev/null'); - open(STDERR, '>/dev/null'); - setsid(); - nice(19); - - # post to arecibo (ignore any errors) - my $agent = LWP::UserAgent->new( - agent => 'bugzilla.mozilla.org', - timeout => 10, # seconds - ); - $agent->post($arecibo_server, $data); - - CORE::exit(0); + my $fh = File::Temp->new( UNLINK => 0 ); + if (!$fh) { + warn "Failed to create temp file: $!\n"; + return; } + print $fh Dumper($data); + close($fh) or die $!; + my $filename = $fh->filename; + + my $command = bz_locations()->{'cgi_path'} . "/arecibo.pl '$filename' &"; + system($command); return 1; } diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index c3f103aaa..6297428af 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -159,6 +159,7 @@ sub FILESYSTEM { 'runtests.pl' => { perms => OWNER_EXECUTE }, 'jobqueue.pl' => { perms => OWNER_EXECUTE }, 'migrate.pl' => { perms => OWNER_EXECUTE }, + 'arecibo.pl' => { perms => OWNER_EXECUTE }, 'install-module.pl' => { perms => OWNER_EXECUTE }, 'Bugzilla.pm' => { perms => CGI_READ }, |