From d9eb7d48cf3802ecc560563d1b43b1360ec913d9 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Tue, 20 Jun 2023 08:03:10 +0900 Subject: [PATCH] Backport upstream fix for testSignDocument_PEM_PDF test failure Enable test again --- 0001-fix-testSignDocument_PEM_PDF.patch | 61 +++++++++++++++++++++++++ libreoffice.spec | 16 +++++-- 2 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 0001-fix-testSignDocument_PEM_PDF.patch diff --git a/0001-fix-testSignDocument_PEM_PDF.patch b/0001-fix-testSignDocument_PEM_PDF.patch new file mode 100644 index 0000000..32c7395 --- /dev/null +++ b/0001-fix-testSignDocument_PEM_PDF.patch @@ -0,0 +1,61 @@ +From 599722cf77310429a9b9bd2a348486a08b60de0d Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 13 Mar 2023 20:04:17 +0100 +Subject: svl: fix CppunitTest_desktop_lib's + DesktopLOKTest::testSignDocument_PEM_PDF + +The problem was that this test passed when the entire suite was running, +but not as an individual test. + +Digging deeper, this didn't pass in isolation because the test loads a +private key into memory (which is not in the NSS DB) and since commit +5592ee094ca9f09bfcc16537d931518d4e6b2231 (svl: fix +testSignDocument_PEM_PDF with "dbm:" NSS DB, 2022-04-28) we delete that +in-memory key as a workaround for the NSS dbm -> sqlite transition. + +Fix the problem by not deleting the in-memory private key in the LOK +case: this makes the test (operating in a stateless mode, with in-memory +keys) pass again and keeps the desktop signing (working with the NSS DB) +working. + +I noticed this test failure as a local test update of libxmlsec to 1.3 +RC started to fail here even when the whole suite was running, but looks +like this was working by accident before anyway, and the fix doesn't +hurt for libxmlsec 1.2, either. + +Change-Id: Id365ddc5c5d04d538609f444c0e3c4ab4b32a6fd +Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148817 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +--- + svl/source/crypto/cryptosign.cxx | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx +index 1d6337845569..e68ccb8aafda 100644 +--- a/svl/source/crypto/cryptosign.cxx ++++ b/svl/source/crypto/cryptosign.cxx +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -640,7 +641,11 @@ NSSCMSMessage *CreateCMSMessage(const PRTime* time, + // if it works, and fallback if it doesn't. + if (SECKEYPrivateKey * pPrivateKey = PK11_FindKeyByAnyCert(cert, nullptr)) + { +- SECKEY_DestroyPrivateKey(pPrivateKey); ++ if (!comphelper::LibreOfficeKit::isActive()) ++ { ++ // pPrivateKey only exists in the memory in the LOK case, don't delete it. ++ SECKEY_DestroyPrivateKey(pPrivateKey); ++ } + *cms_signer = NSS_CMSSignerInfo_Create(result, cert, SEC_OID_SHA256); + } + else +-- +cgit v1.2.1 + diff --git a/libreoffice.spec b/libreoffice.spec index 89bee48..199c846 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -55,7 +55,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.2 -Release: 1%{?libo_prerelease}%{?dist} +Release: 2%{?libo_prerelease}%{?dist} # default new files are: MPLv2 # older files are typically: MPLv2 incorporating work under ASLv2 # nlpsolver is: LGPLv3 @@ -268,6 +268,8 @@ Patch4: 0001-default-to-sifr-for-gnome-light-mode.patch # TODO investigate these Patch5: 0001-aarch64-failing-here.patch Patch6: 0001-include-filename-if-the-test-fails.patch +# backported +Patch7: 0001-fix-testSignDocument_PEM_PDF.patch # not upstreamed Patch500: 0001-disable-libe-book-support.patch @@ -1493,10 +1495,10 @@ install -m 0755 -d %{buildroot}%{baseinstdir}/share/extensions rm -f %{buildroot}%{baseinstdir}/program/officebean.abignore %endif -#%%check -#make unitcheck slowcheck -## we don't need this anymore -#rm -f %%{buildroot}%%{baseinstdir}/program/classes/smoketest.jar +%check +make unitcheck slowcheck +# we don't need this anymore +rm -f %{buildroot}%{baseinstdir}/program/classes/smoketest.jar %files @@ -2248,6 +2250,10 @@ gtk-update-icon-cache -q %{_datadir}/icons/hicolor &>/dev/null || : %{_includedir}/LibreOfficeKit %changelog +* Mon Jun 19 2023 Mamoru TASAKA - 1:7.5.4.2-2 +- Backport upstream fix for testSignDocument_PEM_PDF test failure +- Enable test again + * Fri Jun 16 2023 Gwyn Ciesla - 1:7.5.4.2-1 - 7.5.4.2 - Drop 0001-tdf-155161-Always-embed-fonts-with-CFF2-table-as-PDF.patch, upstreamed.