Skip to content

Commit ea32499

Browse files
committed
Fix shell test grouping and clean up spacing
Use brace groups for compound [ ... ] tests to avoid relying on subshell parentheses and improve POSIX shell compatibility. Remove unnecessary spaces around redirections and here-docs and tidy a minor comment.
1 parent df1d428 commit ea32499

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

bin/install

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ setup_compiler_for_old_php() {
197197
php_patch=$(echo "$php_version" | cut -d. -f3 | sed 's/[^0-9].*//')
198198

199199
# Only apply special compiler setup for problematic old versions
200-
if ! ([ "$php_major" -eq 7 ] && [ "$php_minor" -eq 4 ]) && ! ([ "$php_major" -eq 8 ] && [ "$php_minor" -eq 0 ] && [ "$php_patch" -lt 20 ]); then
200+
if ! { [ "$php_major" -eq 7 ] && [ "$php_minor" -eq 4 ]; } && ! { [ "$php_major" -eq 8 ] && [ "$php_minor" -eq 0 ] && [ "$php_patch" -lt 20 ]; }; then
201201
return 0
202202
fi
203203

@@ -233,7 +233,7 @@ setup_compiler_for_old_php() {
233233
# Test basic compilation
234234
local test_c_file
235235
test_c_file=$(mktemp --suffix=.c)
236-
echo 'int main() { return 0; }' > "$test_c_file"
236+
echo 'int main() { return 0; }' >"$test_c_file"
237237

238238
if "$target_cc" -o "${test_c_file%.c}" "$test_c_file" 2>/dev/null; then
239239
echo "✓ Compiler test successful"
@@ -371,7 +371,7 @@ validate_compiler_setup() {
371371
php_patch=$(echo "$php_version" | cut -d. -f3 | sed 's/[^0-9].*//')
372372

373373
# Only validate for problematic versions
374-
if ! ([ "$php_major" -eq 7 ] && [ "$php_minor" -eq 4 ]) && ! ([ "$php_major" -eq 8 ] && [ "$php_minor" -eq 0 ] && [ "$php_patch" -lt 20 ]); then
374+
if ! { [ "$php_major" -eq 7 ] && [ "$php_minor" -eq 4 ]; } && ! { [ "$php_major" -eq 8 ] && [ "$php_minor" -eq 0 ] && [ "$php_patch" -lt 20 ]; }; then
375375
return 0
376376
fi
377377

@@ -397,7 +397,7 @@ validate_compiler_setup() {
397397
# Test basic compilation to ensure compiler works
398398
local test_c_file
399399
test_c_file=$(mktemp --suffix=.c)
400-
echo 'int main() { return 0; }' > "$test_c_file"
400+
echo 'int main() { return 0; }' >"$test_c_file"
401401

402402
if "$CC" -o "${test_c_file%.c}" "$test_c_file" 2>/dev/null; then
403403
echo "✓ Basic compilation test passed"
@@ -418,7 +418,7 @@ prepare_php_build_environment() {
418418
local wrapper_script
419419
wrapper_script=$(mktemp)
420420

421-
cat > "$wrapper_script" << 'EOF'
421+
cat >"$wrapper_script" <<'EOF'
422422
#!/bin/bash
423423
set -eo pipefail
424424
@@ -475,12 +475,12 @@ php_major=$(echo "$version" | cut -d. -f1)
475475
php_minor=$(echo "$version" | cut -d. -f2)
476476
php_patch=$(echo "$version" | cut -d. -f3 | sed 's/[^0-9].*//')
477477

478-
if ([ "$php_major" -eq 7 ] && [ "$php_minor" -eq 4 ]) || ([ "$php_major" -eq 8 ] && [ "$php_minor" -eq 0 ] && [ "$php_patch" -lt 20 ]); then
478+
if { [ "$php_major" -eq 7 ] && [ "$php_minor" -eq 4 ]; } || { [ "$php_major" -eq 8 ] && [ "$php_minor" -eq 0 ] && [ "$php_patch" -lt 20 ]; }; then
479479
echo "Using environment wrapper for PHP ${version}..."
480480

481481
# Force regenerate autotools cache before build
482482
export CONFIG_SHELL=/bin/bash
483-
export AUTOCONF_CACHE_DIR="" # Clear autoconf cache
483+
export AUTOCONF_CACHE_DIR="" # Clear autoconf cache
484484

485485
wrapper_script=$(prepare_php_build_environment "$version" "$install_path")
486486

0 commit comments

Comments
 (0)