Re: [PATCH v3 1/3] t/lib-httpd: dynamically detect httpd and modules path
- From
Jeff King <peff@peff.net>
- Date
- Nov 9, 2023, 07:32 UTC
- Message-ID
- <20231109073250.GA2698227@coredump.intra.peff.net>
- In-Reply-To
- <e4c75c492dd89fd7464db2b3028b2bb9e6addbf8.1699513524.git.ps@pks.im>
On Thu, Nov 09, 2023 at 08:09:52AM +0100, Patrick Steinhardt wrote:
Show 8 quoted lines
> -for DEFAULT_HTTPD_PATH in '/usr/sbin/httpd' '/usr/sbin/apache2' > +for DEFAULT_HTTPD_PATH in '/usr/sbin/httpd' \ > + '/usr/sbin/apache2' \ > + "$(command -v httpd)" \ > + "$(command -v apache2)" > do > - if test -x "$DEFAULT_HTTPD_PATH" > + if test -n "$DEFAULT_HTTPD_PATH" -a -x "$DEFAULT_HTTPD_PATH"
Sorry to be a pedant, but I'm not sure if we might have portability problems with "-a". It's an XSI extension, and POSIX labels it as obsolescent because it can create parsing ambiguities.
We do have a few instances, but only in corners of the test suite that probably don't get as much exposure (t/perf and valgrind/valgrind.sh). So maybe not worth worrying about, but it's easy to write it as:
if test -n "$DEFAULT_HTTPD_PATH" && test -x "$DEFAULT_HTTPD_PATH"
-Peff