Files
gentoo/dev-lang/php/files/php-8.5-musl-pathconf.patch
Michael Orlitzky f653484b80 dev-lang/php: fix pathconf/crypt tests
The posix_pathconf() and posix_fpathconf() functions were disabled on
musl because it short-circuits, but that is explicitly allowed. Include
the test fix from the upstream PR to allow it, and re-enable the
functions via -DHAVE_FOO. This allows all USE=posix tests to pass on
musl.

On Gentoo, using libxcrypt is strongly preferred, even on musl systems,
but the PHP build system will use the musl implementations by default.
We now hack the autoconf cache variables to include -lcrypt so that the
libxcrypt implementations get used. This fixes all crypt-related tests
on musl.

Bug: https://bugs.gentoo.org/942610
Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
2026-08-12 12:12:04 -04:00

29 lines
1.0 KiB
Diff

Test fix from https://github.com/php/php-src/pull/22717
To avoid eautoreconf in the meantime, we define the HAVE_PATHCONF and
HAVE_FPATHCONF via cppflags.
diff --git a/ext/posix/tests/posix_pathconf.phpt b/ext/posix/tests/posix_pathconf.phpt
index ba451c62df97..8df6e872119b 100644
--- a/ext/posix/tests/posix_pathconf.phpt
+++ b/ext/posix/tests/posix_pathconf.phpt
@@ -13,12 +13,15 @@ try {
} catch (\ValueError $e) {
echo $e->getMessage(). "\n";
}
-var_dump(posix_pathconf(str_repeat('non_existent', 4096), POSIX_PC_NAME_MAX));
-var_dump(posix_errno() != 0);
+
+/* POSIX specifically allows implementations to ignore the first
+ * argument if it will not affect the result. */
+$result = posix_pathconf(str_repeat('non_existent', 4096),
+ POSIX_PC_NAME_MAX);
+var_dump( ($result == false && posix_errno() != 0) || is_int($result) );
var_dump(posix_pathconf(sys_get_temp_dir(), POSIX_PC_PATH_MAX));
?>
--EXPECTF--
posix_pathconf(): Argument #1 ($path) must not be empty
-bool(false)
bool(true)
int(%d)