hi all

this escaped error_log is making it impossible to debug anything within the
mod_perl test suite.  I'd like to do something like the attached patch to
make our lives (as well as the lives of our users) a bit easier.  it may not
be ideal, but it seems to make things better for me for the moment, and it
doesn't involve pipes so it should be platform safe.

other approaches or ways to make it better are welcome.

--Geoff
Index: lib/Apache/TestRun.pm
===================================================================
RCS file: /home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.131
diff -u -r1.131 TestRun.pm
--- lib/Apache/TestRun.pm       19 Dec 2003 09:16:14 -0000      1.131
+++ lib/Apache/TestRun.pm       7 Jan 2004 17:08:49 -0000
@@ -326,6 +326,7 @@
                  };
              }
              $self->try_bug_report();
+             $self->fix_error_log();
          }';
     die "failed: $@" if $@;
 
@@ -337,6 +338,39 @@
         $self->{opts}->{bugreport} && $self->can('bug_report')) {
         $self->bug_report;
     }
+}
+
+sub fix_error_log {
+
+    my $self = shift;
+
+    my $config = $self->{test_config};
+
+    (my $version) = $config->server->{version} =~ m:^Apache/(\d\.\d+\.\d+):;
+
+    if ($version le 2.0.48) {
+        debug("skipping error_log fixup for httpd $version");
+        return;
+    } 
+
+    my $error_log = catfile $config->{vars}->{t_logs}, 'error_log';
+
+    unless (-e $error_log) {
+        debug("skipping error_log fixup - $error_log not created");
+        return;
+    }
+
+    my $fh = Symbol::gensym();
+    open $fh, $error_log or die "open $error_log: $!";
+
+    my $log = do { local $/; <$fh> };
+
+    close $fh;
+
+    $log =~ s/\\n|\\t/\n\t/g;
+
+    open $fh, ">$error_log" or die "open $error_log: $!";
+    print $fh $log;
 }
 
 #throw away cached config and start fresh

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to