-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfaut in test suite #43
Comments
|
I was able to reproduce this. It only seems to happen when one or more loadable modules are installed. See for example: $ sudo dnf --setopt=install_weak_deps=False install vips-devel
$ make test > test.log 2>&1 && echo "Succeed" || echo "Failed"
Succeed
$ sudo dnf install vips-jxl vips-magick-im6 vips-openslide vips-poppler
$ make test > test.log 2>&1 && echo "Succeed" || echo "Failed"
Failed
$ grep "FAILED TEST SUMMARY" -B1 -A4 test.log
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
new_from_buffer works [tests/012.phpt]
can set metadata [tests/042.phpt]
===================================================================== (Tested on Fedora 34) Perhaps the loadable module is somehow unloaded prior to Let me investigate this further. |
It seems that the test suite passes when the $ ZEND_DONT_UNLOAD_MODULES=1 make test So, the PHP vips extension ( z-nodelete.patchdiff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -466,6 +466,20 @@ else
fi
fi
+SAVE_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -Wl,-z,nodelete"
+AC_MSG_CHECKING([whether linker understands -z nodelete])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+ [
+ AC_MSG_RESULT([yes])
+ LDFLAGS_Z_NODELETE="-Wl,-z,nodelete"
+ ],[
+ AC_MSG_RESULT([no])
+ LDFLAGS_Z_NODELETE=""
+ ])
+LDFLAGS="$SAVE_LDFLAGS"
+AC_SUBST(LDFLAGS_Z_NODELETE)
+
# check for gtk-doc
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
diff --git a/libvips/Makefile.am b/libvips/Makefile.am
index 1111111..2222222 100644
--- a/libvips/Makefile.am
+++ b/libvips/Makefile.am
@@ -58,6 +58,7 @@ libvips_la_LIBADD = \
@VIPS_LIBS@
libvips_la_LDFLAGS = \
+ $(LDFLAGS_Z_NODELETE) \
-no-undefined \
-version-info @LIBRARY_CURRENT@:@LIBRARY_REVISION@:@LIBRARY_AGE@
@@ -107,6 +108,7 @@ MODULE_CPPFLAGS = \
$(REQUIRED_CFLAGS)
MODULE_LDFLAGS = \
+ $(LDFLAGS_Z_NODELETE) \
-no-undefined \
-shared \
-module \ But that resulted in the same segfault. |
Linking the extension with Lines 2010 to 2043 in 310b029
(untested) |
Above hack is only for mod_php, and the segfault occurs with cli sapi Also notice that it may not work, as in various distribution, PHP use RTLD_NOW (build using --enable-rtld-now for security / safety reasons) |
I confirm, building the ext with |
Great, thanks for confirming. Commit kleisauke@f08dc82 should ensure that the extension is always linked with In that commit, I've also removed the hack mentioned above, as I think it's no longer needed. However, I couldn't reproduce issue libvips/php-vips#26 with version 1.0.2 of the extension, so I'm not sure if it's completely safe to remove that (maybe it was only needed for older Apache versions?). |
BTW, does test Perhaps the diff --git a/tests/029.phpt b/tests/029.phpt
index 1111111..2222222 100644
--- a/tests/029.phpt
+++ b/tests/029.phpt
@@ -14,7 +14,7 @@ can get error messages
$msg = vips_error_buffer();
if ($err == -1 &&
- $msg == "add: not one band or 3 bands\n") {
+ strpos($msg, "add: not one band or 3 bands\n") !== false) {
echo "pass";
}
?> |
A (draft-)pull request has been made for this at #44. |
Probably since recent changes in libvips
Using PHP 7.4, 8.0 with libvips 8.11.3
The text was updated successfully, but these errors were encountered: