[php-src] PR #16717: Fail early in *nix configuration build script
| From: | hakre | Date: | Wed, 06 Nov 2024 21:13:42 +0000 |
| Subject: | [php-src] PR #16717: Fail early in *nix configuration build script | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-29539@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/16717
Author: hakre
Adding two exit early safeguards in the *nix configuration build script:
1) Given the initial cd into the build tree fails (the project root),
the
buildconf script exits with non-zero status (failure).
2) Given the grep command does not exist or configure.ac AC_INIT [1]
expectations are unmet, the buildconf script exits non-zero.
Additionally quoting the pathname to cd into and the empty CD_PATH parameter for portability, also
for systems that are using a non-portable pathname [2] for the build tree.
Rationale:
CD-ing into the project root should always prematurely exit w/ FAILURE as a required precondition
for its invocation has not been met. This should never go unnoticed as it always requires user
intervention.
Similar and more specifically to the PHP build on *nix systems, the grep command is required early
to obtain the php_extra_version from configure.ac. Previously, if the grep command is
missing (or failing due to not matching the line with the AC_INIT macro [1]), the internal dev
parameter would always be zero (0) which can easily result in the situation that the configure
script is not being rebuilt. This is cumbersome as the rebuild of a configure script is more likely
required with checked-out dev versions under change rather than an already properly set-up build
environment on a dedicated build or release system. Missing the fact that either the grep utility is
missing or the expectation of having the AC_INIT macro in configure.ac is unmet should never go
unnoticed as it always requires user intervention.
[1]: https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Initializing-configure.html
[2]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_271