fix(linux): reset the build log and stop mis-reading non-OpenSSL - #30
Merged
Conversation
Three defects, all in the path a failed build takes. $PHPVM_LOG was only ever appended to, never reset. On a retry the log still held the previous run, so _phpvm_show_build_error's `grep -m1` reported the first error of the *earlier* build - the one line most likely to send someone chasing a problem they had already fixed. Truncate it once at the top of phpvm_install, before any step writes. _phpvm_openssl_version read `openssl version` without checking the vendor. LibreSSL and BoringSSL answer that command too, and their 3.x still defines RSA_SSLV23_PADDING, so a macOS or OpenBSD host would be refused a PHP 7.x build that would have compiled. Treat a non-OpenSSL banner as "unknown" and let the build proceed. The major-version comparison used `[[ ... -lt 3 ]]`, which errors on a non-numeric major and falls through to blocking - the opposite of this guard's fail-open contract. Check for digits first. Cover all three in bats, plus a zsh smoke for the guard: it now leans on [[ != OpenSSL* ]] globbing and [[ =~ ]] regex, and bats only ever sees the bash reading of both. devhardiyanto
devhardiyanto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Tiga perbaikan di jalur build gagal
phpvm install(Linux/macOS), lanjutan dari #28.Why
Sebuah build log PHP 7.3 masih memperlihatkan
RSA_SSLV23_PADDING undeclaredwalau guard OpenSSL sudah ada di v1.13.1 — mesinnya ternyata belum di-upgrade. Tapi menelusuri log itu memunculkan tiga defect nyata di kode yang sekarang:$PHPVM_LOGhanya pernah di-append, tidak pernah di-reset. Pada install ulang,_phpvm_show_build_error(grep -m1) menampilkan error pertama dari build sebelumnya — persis baris yang paling menyesatkan saat orang sedang retry._phpvm_openssl_versionmembacaopenssl versiontanpa cek vendor. LibreSSL/BoringSSL juga menjawab perintah itu, dan 3.x mereka masih punyaRSA_SSLV23_PADDING. Host macOS/OpenBSD jadi ditolak build PHP 7.x yang sebenarnya sukses.[[ ... -lt 3 ]], yang error kalau major non-numerik lalu jatuh ke memblokir — kebalikan dari kontrak fail-open guard ini.How
phpvm_install, sebelum step mana pun menulis.openssl versionyang tidak diawaliOpenSSLdianggap "unknown" → build jalan.[[ =~ ^[0-9]+$ ]]sebelum membandingkan major.Windows tidak tersentuh: pakai zip prebuilt, tidak compile.
Changes
linux/phpvm.sh—: > "$PHPVM_LOG"diphpvm_install; vendor check + fail-open numerik di_phpvm_openssl_version/_phpvm_check_openssl_compattests/linux/build_preflight.bats— +5 case (LibreSSL, BoringSSL, banner OpenSSL asli, major non-numerik, ordering truncate-sebelum-append)tests/linux/zsh-smoke.zsh— guard sekarang bergantung pada globbing[[ != OpenSSL* ]]dan regex[[ =~ ]]; bats cuma melihat pembacaan bashTesting Done
bats tests/linux/— 82/82 lewat (bats 1.14.0)bash -n linux/phpvm.shzsh tests/linux/zsh-smoke.zsh— zsh tidak tersedia di mesin dev; diverifikasi oleh job zsh di CI