[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - external/nss

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Sat Jan 18 23:59:58 UTC 2020


 external/nss/UnpackedTarball_nss.mk |    1 +
 external/nss/macos-dlopen.patch.0   |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

New commits:
commit ee779da3acc32371d45b91f92ad9da0c46594e47
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jan 17 11:13:43 2020 +0100
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Sun Jan 19 00:59:29 2020 +0100

    tdf#127619: external/nss: Load smime3 lib with a path on macOS
    
    A plain dlopen("libsmime3.dylib",...) would search (among other places)
    DYLD_FALLBACK_LIBRARY_PATH, which when unset defaults to a set of paths
    including /usr/local/lib (so would erroneously find Homebrew's
    /usr/local/lib/libsmime3.dylib instead of LO's
    LibreOffice.app/Contents/Frameworks/libsmime3.dylib next to the calling
    LibreOffice.app/Contents/Frameworks/libnspr4.dylib).
    
    At least macOS 10.15.2 supports a "@loader_path/" prefix in dlopen, to find the
    requested library next to the calling code, so use that as a quick fix.  (Should
    that turn out to be problematic, there is PORT_LoadLibraryFromOrigin in
    workdir/UnpackedTarball/nss/nss/lib/util/secload.c that might be useful in a
    more elaborate fix.)
    
    Change-Id: I8688606017a4b32a2dd55740f67b8fdb36fc5435
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86966
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit a3ca9b88b4b38c008efa868844ba7a3105b4bcca)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86969
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/external/nss/UnpackedTarball_nss.mk b/external/nss/UnpackedTarball_nss.mk
index 3079216b674e..0e174879a702 100644
--- a/external/nss/UnpackedTarball_nss.mk
+++ b/external/nss/UnpackedTarball_nss.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,nss,\
 	$(if $(filter ANDROID,$(OS)), \
 		external/nss/nss-android.patch.1) \
 	external/nss/nss.bzmozilla1238154.patch \
+    external/nss/macos-dlopen.patch.0 \
 ))
 
 ifeq ($(COM_IS_CLANG),TRUE)
diff --git a/external/nss/macos-dlopen.patch.0 b/external/nss/macos-dlopen.patch.0
new file mode 100644
index 000000000000..8c484e4c6841
--- /dev/null
+++ b/external/nss/macos-dlopen.patch.0
@@ -0,0 +1,25 @@
+--- nspr/pr/src/linking/prlink.c
++++ nspr/pr/src/linking/prlink.c
+@@ -793,7 +793,7 @@
+         /* ensure the file exists if it contains a slash character i.e. path */
+         /* DARWIN's dlopen ignores the provided path and checks for the */
+         /* plain filename in DYLD_LIBRARY_PATH */
+-        if (strchr(name, PR_DIRECTORY_SEPARATOR) == NULL ||
++        if (strchr(name, PR_DIRECTORY_SEPARATOR) == NULL || strncmp(name, "@loader_path/", 13) == 0 ||
+             PR_Access(name, PR_ACCESS_EXISTS) == PR_SUCCESS) {
+             h = dlopen(name, dl_flags);
+         }
+--- nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c
++++ nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c
+@@ -224,7 +224,11 @@
+ static PRStatus PR_CALLBACK pkix_getDecodeFunction(void)
+ {
+     pkix_decodeFunc.smimeLib = 
++#if defined DARWIN
++		PR_LoadLibrary("@loader_path/" SHLIB_PREFIX"smime3."SHLIB_SUFFIX);
++#else
+ 		PR_LoadLibrary(SHLIB_PREFIX"smime3."SHLIB_SUFFIX);
++#endif
+     if (pkix_decodeFunc.smimeLib == NULL) {
+ 	return PR_FAILURE;
+     }


More information about the Libreoffice-commits mailing list