summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Attachment
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-02-15 06:18:14 +0100
committerByron Jones <bjones@mozilla.com>2013-02-15 06:18:14 +0100
commit9986a6db7d542365f03f45246553060dcfcff388 (patch)
tree77740aa32ec35f97c18c64c55044af05bf207a15 /Bugzilla/Attachment
parent275eb1b39a25ef88f47fa5b592c9cf02ad9f754d (diff)
downloadbugzilla-9986a6db7d542365f03f45246553060dcfcff388.tar.gz
bugzilla-9986a6db7d542365f03f45246553060dcfcff388.tar.xz
Bug 839095: Fix interdiff failing on mod_perl with "No valid patch files were found in the attachment"
r=dkl, a=LpSolit
Diffstat (limited to 'Bugzilla/Attachment')
-rw-r--r--Bugzilla/Attachment/PatchReader.pm19
1 files changed, 14 insertions, 5 deletions
diff --git a/Bugzilla/Attachment/PatchReader.pm b/Bugzilla/Attachment/PatchReader.pm
index 29ff1f93f..7bbbfacae 100644
--- a/Bugzilla/Attachment/PatchReader.pm
+++ b/Bugzilla/Attachment/PatchReader.pm
@@ -104,10 +104,19 @@ sub process_interdiff {
# Must hack path so that interdiff will work.
$ENV{'PATH'} = $lc->{diffpath};
- my ($interdiff_stdout, $interdiff_stderr);
- $interdiff_stderr = gensym;
- my $pid = open3(gensym, $interdiff_stdout, $interdiff_stderr,
- $lc->{interdiffbin}, $old_filename, $new_filename);
+ my ($pid, $interdiff_stdout, $interdiff_stderr);
+ if ($ENV{MOD_PERL}) {
+ require Apache2::RequestUtil;
+ require Apache2::SubProcess;
+ my $request = Apache2::RequestUtil->request;
+ (undef, $interdiff_stdout, $interdiff_stderr) = $request->spawn_proc_prog(
+ $lc->{interdiffbin}, [$old_filename, $new_filename]
+ );
+ } else {
+ $interdiff_stderr = gensym;
+ my $pid = open3(gensym, $interdiff_stdout, $interdiff_stderr,
+ $lc->{interdiffbin}, $old_filename, $new_filename);
+ }
binmode $interdiff_stdout;
# Check for errors
@@ -145,7 +154,7 @@ sub process_interdiff {
}
$reader->iterate_fh($interdiff_stdout, 'interdiff #' . $old_attachment->id .
' #' . $new_attachment->id);
- waitpid($pid, 0);
+ waitpid($pid, 0) if $pid;
$ENV{'PATH'} = '';
# Delete temporary files.