Date: Tuesday, March 1, 2022 @ 11:08:05 Author: andyrtr Revision: 438260
upgpkg: libreoffice-fresh 7.3.0-6: apply upstream fix for tdf#147611 - FS#73987 Added: libreoffice-fresh/trunk/0003_tdf147611_fix_indices.patch Modified: libreoffice-fresh/trunk/PKGBUILD ----------------------------------+ 0003_tdf147611_fix_indices.patch | 155 +++++++++++++++++++++++++++++++++++++ PKGBUILD | 8 + 2 files changed, 162 insertions(+), 1 deletion(-) Added: 0003_tdf147611_fix_indices.patch =================================================================== --- 0003_tdf147611_fix_indices.patch (rev 0) +++ 0003_tdf147611_fix_indices.patch 2022-03-01 11:08:05 UTC (rev 438260) @@ -0,0 +1,155 @@ +From e85d2140ae5e9a611754c29aa4e5cdb6ad7fcab0 Mon Sep 17 00:00:00 2001 +From: Mike Kaganski <[email protected]> +Date: Wed, 23 Feb 2022 18:14:38 +0300 +Subject: tdf#147611: fix indices + +The maKeyState vector in ScSortParam is initialized with three elements, +and they are never removed. The code in ScVbaRange::Sort incorrectly used +1-based indices into that vector. + +This was broken since commit a02b445c39d969fedc554fc2c500b88a27a13906 + Author: Albert Thuswaldner <[email protected]> + Date: Tue Mar 20 19:38:29 2012 +0100 + + fdo#45747 remove the limitation to 3 sort entries in calc part1 + +It was fixed in commit 568d3912bf8ced76ecb9506bccc3bd361daba082 + Author: Kohei Yoshida <[email protected]> + Date: Wed Apr 04 15:30:35 2012 -0400 + + Cleanup. ScPivot(Collection) is no more. + +but was restored by commit 3e887edcaacc5b0f5e35d682a259124648e84229 + Author: Markus Mohrhard <[email protected]> + Date: Thu Apr 5 05:05:40 2012 +0200 + + Revert "Cleanup. ScPivot(Collection) is no more." + +Change-Id: I009252e794c9365f0aef8a61daf9cbd40eca8b75 +Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130441 +Tested-by: Jenkins +Reviewed-by: Mike Kaganski <[email protected]> +Signed-off-by: Xisco Fauli <[email protected]> +Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130476 +Reviewed-by: Michael Stahl <[email protected]> +--- + sc/qa/extras/macros-test.cxx | 64 +++++++++++++++++++++++++++++++++++++++++++ + sc/source/ui/vba/vbarange.cxx | 6 ++-- + 2 files changed, 67 insertions(+), 3 deletions(-) + +diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx +index 559dd903e4eb..cd4d15f16e8d 100644 +--- a/sc/qa/extras/macros-test.cxx ++++ b/sc/qa/extras/macros-test.cxx +@@ -22,6 +22,7 @@ + #include <document.hxx> + #include <attrib.hxx> + #include <scitems.hxx> ++#include <sortparam.hxx> + + #include <com/sun/star/sheet/XSpreadsheet.hpp> + +@@ -74,6 +75,7 @@ public: + void testTdf130307(); + void testTdf146742(); + void testMacroButtonFormControlXlsxExport(); ++ void testVbaRangeSort(); + + CPPUNIT_TEST_SUITE(ScMacrosTest); + CPPUNIT_TEST(testStarBasic); +@@ -107,6 +109,7 @@ public: + CPPUNIT_TEST(testTdf130307); + CPPUNIT_TEST(testTdf146742); + CPPUNIT_TEST(testMacroButtonFormControlXlsxExport); ++ CPPUNIT_TEST(testVbaRangeSort); + + CPPUNIT_TEST_SUITE_END(); + }; +@@ -1333,6 +1336,67 @@ void ScMacrosTest::testTdf90278() + xDocSh->DoClose(); + } + ++void ScMacrosTest::testVbaRangeSort() ++{ ++ auto xComponent = loadFromDesktop("private:factory/scalc"); ++ ++ css::uno::Reference<css::document::XEmbeddedScripts> xDocScr(xComponent, UNO_QUERY_THROW); ++ auto xLibs = xDocScr->getBasicLibraries(); ++ auto xLibrary = xLibs->createLibrary("TestLibrary"); ++ xLibrary->insertByName( ++ "TestModule", ++ uno::Any(OUString("Option VBASupport 1\n" ++ "Sub TestRangeSort\n" ++ " Range(Cells(1, 1), Cells(3, 1)).Select\n" ++ " Selection.Sort Key1:=Range(\"A1\"), Header:=False\n" ++ "End Sub\n"))); ++ ++ Any aRet; ++ Sequence<sal_Int16> aOutParamIndex; ++ Sequence<Any> aOutParam; ++ ++ SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); ++ ScDocShell* pDocSh = static_cast<ScDocShell*>(pFoundShell); ++ CPPUNIT_ASSERT(pDocSh); ++ ScDocument& rDoc = pDocSh->GetDocument(); ++ ++ rDoc.SetValue(ScAddress(0, 0, 0), 1.0); ++ rDoc.SetValue(ScAddress(0, 1, 0), 0.5); ++ rDoc.SetValue(ScAddress(0, 2, 0), 2.0); ++ ++ // Without the fix in place, this call would have crashed in debug builds with failed assertion ++ ErrCode result = SfxObjectShell::CallXScript( ++ xComponent, ++ "vnd.sun.Star.script:TestLibrary.TestModule.TestRangeSort?language=Basic&location=document", ++ {}, aRet, aOutParamIndex, aOutParam); ++ CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, result); ++ ++ CPPUNIT_ASSERT_EQUAL(0.5, rDoc.GetValue(ScAddress(0, 0, 0))); ++ CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(ScAddress(0, 1, 0))); ++ CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(ScAddress(0, 2, 0))); ++ ++ // Change sheet's first param sorting order ++ ScSortParam aParam; ++ rDoc.GetSortParam(aParam, 0); ++ aParam.maKeyState[0].bAscending = false; ++ rDoc.SetSortParam(aParam, 0); ++ ++ result = SfxObjectShell::CallXScript( ++ xComponent, ++ "vnd.sun.Star.script:TestLibrary.TestModule.TestRangeSort?language=Basic&location=document", ++ {}, aRet, aOutParamIndex, aOutParam); ++ CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, result); ++ ++ // Without the fix in place, this test would have failed in non-debug builds with ++ // - Expected: 2 ++ // - Actual : 0.5 ++ CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(ScAddress(0, 0, 0))); ++ CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(ScAddress(0, 1, 0))); ++ CPPUNIT_ASSERT_EQUAL(0.5, rDoc.GetValue(ScAddress(0, 2, 0))); ++ ++ pDocSh->DoClose(); ++} ++ + ScMacrosTest::ScMacrosTest() + : UnoApiTest("/sc/qa/extras/testdocuments") + { +diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx +index 75ae115ce9d4..28019615eb9d 100644 +--- a/sc/source/ui/vba/vbarange.cxx ++++ b/sc/source/ui/vba/vbarange.cxx +@@ -3412,9 +3412,9 @@ ScVbaRange::Sort( const uno::Any& Key1, const uno::Any& Order1, const uno::Any& + + // set up defaults + +- sal_Int16 nOrder1 = aSortParam.maKeyState[1].bAscending ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending; +- sal_Int16 nOrder2 = aSortParam.maKeyState[2].bAscending ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending; +- sal_Int16 nOrder3 = aSortParam.maKeyState[3].bAscending ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending; ++ sal_Int16 nOrder1 = aSortParam.maKeyState[0].bAscending ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending; ++ sal_Int16 nOrder2 = aSortParam.maKeyState[1].bAscending ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending; ++ sal_Int16 nOrder3 = aSortParam.maKeyState[2].bAscending ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending; + + sal_Int16 nCustom = aSortParam.nUserIndex; + sal_Int16 nSortMethod = excel::XlSortMethod::xlPinYin; +-- +cgit v1.2.1 + Modified: PKGBUILD =================================================================== --- PKGBUILD 2022-03-01 09:57:45 UTC (rev 438259) +++ PKGBUILD 2022-03-01 11:08:05 UTC (rev 438260) @@ -12,7 +12,7 @@ pkgname=('libreoffice-fresh-sdk' 'libreoffice-fresh') _LOver=7.3.0.3 pkgver=7.3.0 -pkgrel=5 +pkgrel=6 arch=('x86_64') license=('LGPL3') url="https://www.libreoffice.org/" @@ -62,6 +62,7 @@ make-pyuno-work-with-system-wide-module-install.diff 0001_drop_the_SolarMutex_before_QApplication.patch 0002_update_kf5_include_lib_check.patch + 0003_tdf147611_fix_indices.patch soffice-template.desktop.in libreoffice-fresh.sh libreoffice-fresh.csh) noextract=(35c94d2df8893241173de1d16b6034c0-swingExSrc.zip @@ -112,6 +113,7 @@ 'c463654a73ecfbc242ff109726fb4faecdbfb3d91affafe919b24bea65afb563' '81a8551aaea0ab1750d36fb8bfbd04340a43eaab349a43c1384d21ef6504ab47' '1cc5aeac9b8e91786701727d97b58039afc3db3dbc7977a3651d3263240798b3' + 'a825f71f71658d18a31f2331351e9310d8996501cab79f411a0c7b9c1b53c70c' 'd0be8099cbee3c9dfda694a828149b881c345b204ab68826f317580aafb50879' 'cd1b25ff390e436c6bffa65c6e12382236e3ccbf8d3aae51b1b59bcaed79fd8a' 'de20f36d45f0fecc2d94176dd3ec7226ab07fa8ffb9b0bc73c200349a9273de1') @@ -142,6 +144,10 @@ # https://cgit.freedesktop.org/libreoffice/core/commit/?id=5fd5e42bf28a7910321c6b6d76257e7386839fbc patch -Np1 -i "${srcdir}"/0002_update_kf5_include_lib_check.patch + # https://bugs.archlinux.org/task/73987 + # https://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-7-3&id=e85d2140ae5e9a611754c29aa4e5cdb6ad7fcab0 + patch -Np1 -i "${srcdir}"/0003_tdf147611_fix_indices.patch + #use the CFLAGS but remove the LibO overridden ones for i in $CFLAGS; do case "$i" in
