Re: [PATCH v4 1/3] t/lib-httpd: dynamically detect httpd and modules path
On Sat, Nov 11, 2023 at 09:00:09AM +0900, Junio C Hamano wrote:
Show 30 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
>
> > +if test -x "$DEFAULT_HTTPD_PATH"
> > +then
> > + DETECTED_HTTPD_ROOT="$("$DEFAULT_HTTPD_PATH" -V | sed -n 's/^ -D HTTPD_ROOT="\(.*\)"$/\1/p')"
> > +fi
>
> With this patch, my test run starts like so:
>
> rm -f -r 'test-results'
> *** prove ***
> apache2: Could not open configuration file /etc/apache2/apache2.conf: No such file or directory
> ...
>
> I find the error message leaking mildly annoying, and would suggest
> doing something like the following on top.
>
> diff --git c/t/lib-httpd.sh w/t/lib-httpd.sh
> index 0a74922d7f..03493ee72b 100644
> --- c/t/lib-httpd.sh
> +++ w/t/lib-httpd.sh
> @@ -68,7 +68,7 @@ done
>
> if test -x "$DEFAULT_HTTPD_PATH"
> then
> - DETECTED_HTTPD_ROOT="$("$DEFAULT_HTTPD_PATH" -V | sed -n 's/^ -D HTTPD_ROOT="\(.*\)"$/\1/p')"
> + DETECTED_HTTPD_ROOT="$("$DEFAULT_HTTPD_PATH" -V 2>/dev/null | sed -n 's/^ -D HTTPD_ROOT="\(.*\)"$/\1/p')"
> fi
>
> for DEFAULT_HTTPD_MODULE_PATH in '/usr/libexec/apache2' \Yup, makes sense. Thanks for the tweak.
Patrick