php-src/scripts/dev
Hans Krentel (hakre) c075546320
Fail early in *nix configuration build script
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.

The initial CD safeguard has been applied to the `buildconf` and
four more scripts:

- build/genif.sh
- scripts/dev/credits
- scripts/dev/genfiles
- scripts/dev/makedist

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

Closes GH-16717.
2024-11-09 14:03:04 +01:00
..
bless_tests.php Add %0 format to run-tests.php 2021-05-29 11:33:13 +02:00
check_parameters.php check_parameters.php: Make the script's retval reflect errors 2022-06-16 15:34:37 +02:00
credits Fail early in *nix configuration build script 2024-11-09 14:03:04 +01:00
find_tested.php Apply tidy formatting 2020-02-03 13:41:31 +01:00
gen_verify_stub Sync leading and final newlines in source code files 2018-10-14 12:56:38 +02:00
genfiles Fail early in *nix configuration build script 2024-11-09 14:03:04 +01:00
makedist Fail early in *nix configuration build script 2024-11-09 14:03:04 +01:00
search_underscores.php Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
tidy.php Fix phpt reindentation in tidy script 2020-11-25 16:07:56 +01:00