On Wed, Jun 26, 2013 at 05:18:54PM +0100, Joe Orton wrote: > The ServerRoot directive in the default httpd.conf is set to ${prefix} > by the httpd buildsystem, there is a direct equivalence there, I think > it's certainly correct for apxs to query the PREFIX variable. Yes, lots > of stuff isn't documented, that's a good reason to improve the docs not > to drop stuff from packages ;)
Right. Thanks for bearing with me, and sorry for not doing my homework properly. > How about a patch to avoid running apxs unless it proves necessary, if > the only problem is the stderr warnings in this case? I'm attaching three patches, hope something there seems useful to you. The first two of them both implement your suggestion in different (but mutually compatible) ways. The third patch is one more try at putting a Debian/Ubuntu specific workaround in: it now falls back the compiled in HTTPD_ROOT value, which should be equivalent to PREFIX on non-buggy systems and which is already parsed from 'httpd -V' output. Thanks again, -- Niko Tyni nt...@debian.org
>From ca00622318e1591d3a24edefc318d091ccfa7a99 Mon Sep 17 00:00:00 2001 From: Niko Tyni <nt...@debian.org> Date: Sat, 29 Jun 2013 00:58:52 +0300 Subject: [PATCH 1/3] Cache failed apxs query results too apxs query failures are not transient, so cache them when one warning has been issued. --- Apache-Test/lib/Apache/TestConfig.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Apache-Test/lib/Apache/TestConfig.pm b/Apache-Test/lib/Apache/TestConfig.pm index 20c2fcb..658da0c 100644 --- a/Apache-Test/lib/Apache/TestConfig.pm +++ b/Apache-Test/lib/Apache/TestConfig.pm @@ -1767,6 +1767,7 @@ sub apxs { } else { warn "APXS ($self->{APXS}) query for $q failed\n"; + $self->{_apxs}{$q} = $val; return $val; } } -- 1.7.10.4
>From ab4bdb4f64788742eb9400075536fb1f31f304c1 Mon Sep 17 00:00:00 2001 From: Niko Tyni <nt...@debian.org> Date: Thu, 27 Jun 2013 00:17:59 +0300 Subject: [PATCH 2/3] Postpone evaluation of "apxs -q PREFIX" The result of the apxs call is only needed when the other methods of deriving ServerRoot don't work, so lazily call it only when necessary. --- Apache-Test/lib/Apache/TestConfigParse.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Apache-Test/lib/Apache/TestConfigParse.pm b/Apache-Test/lib/Apache/TestConfigParse.pm index 4985442..d2eb520 100644 --- a/Apache-Test/lib/Apache/TestConfigParse.pm +++ b/Apache-Test/lib/Apache/TestConfigParse.pm @@ -87,7 +87,7 @@ sub server_file_rel2abs { 'user-supplied $base' ], [ $self->{inherit_config}->{ServerRoot}, 'httpd.conf inherited ServerRoot' ], - [ $self->apxs('PREFIX'), + [ sub { $self->apxs('PREFIX') }, 'apxs-derived ServerRoot' ]); # remove surrounding quotes if any @@ -103,9 +103,10 @@ sub server_file_rel2abs { foreach my $try (@tries) { next unless defined $try->[0]; - if (-d $try->[0]) { - $serverroot = $try->[0]; - debug "using $try->[1] to resolve $file"; + my $val = ( ref $try->[0] eq 'CODE' ? $try->[0]->() : $try->[0] ); + if (-d $val) { + $serverroot = $val; + debug "using $val to resolve $file"; last; } } -- 1.7.10.4
>From 3dc87a2336c865ee93282bf1b39602458bdbf8e8 Mon Sep 17 00:00:00 2001 From: Niko Tyni <nt...@debian.org> Date: Thu, 27 Jun 2013 00:15:26 +0300 Subject: [PATCH 3/3] Fall back to HTTPD_ROOT if PREFIX is not available There are Apache installations out there (at least the Debian and Ubuntu packaged ones) that surprisingly don't define PREFIX at all. Use HTTPD_ROOT from "httpd -V" output as a last resort. --- Apache-Test/lib/Apache/TestConfigParse.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Apache-Test/lib/Apache/TestConfigParse.pm b/Apache-Test/lib/Apache/TestConfigParse.pm index d2eb520..447b247 100644 --- a/Apache-Test/lib/Apache/TestConfigParse.pm +++ b/Apache-Test/lib/Apache/TestConfigParse.pm @@ -88,7 +88,9 @@ sub server_file_rel2abs { [ $self->{inherit_config}->{ServerRoot}, 'httpd.conf inherited ServerRoot' ], [ sub { $self->apxs('PREFIX') }, - 'apxs-derived ServerRoot' ]); + 'apxs-derived ServerRoot' ], + [ $self->{httpd_defines}->{HTTPD_ROOT}, + 'httpd -V derived ServerRoot' ]); # remove surrounding quotes if any # e.g. Include "/tmp/foo.html" -- 1.7.10.4
--------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org For additional commands, e-mail: dev-h...@perl.apache.org