external/onlineupdate/lo.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+)
New commits: commit dec29bf4c7844d6cc3231b93ca1bb56243caabfe Author: Stephan Bergmann <stephan.bergm...@allotropia.de> AuthorDate: Tue Jan 23 14:20:51 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Tue Jan 23 23:22:51 2024 +0100 MAR update, too big to (not) fail On Windows, when a MAR update generated by create-partial-info contains very many patches (as easily happens with LibreOffice), applying it would fail with "failed: 7" (aka WRITE_ERROR, see workdir/UnpackedTarball/onlineupdate/onlineupdate/source/update/common/updatererror.h) because in workdir/UnpackedTarball/onlineupdate/onlineupdate/source/update/updater/updater.cpp PatchFile::mPatchStream holds open one FILE instance per patch from PatchFile::Prepare to PatchFile::Execute (and which can't easily be reworked because of the Lock/UnlockFile done on the underlying HANDLE "so it can't be messed with [in] between"), so calling NS_tfopen in PatchFile::Prepare will eventually start to fail with EMFILE. To avoid that, try to raise the limit to its maximum (but don't fail immediately if that fails, in case the given MAR update wouldn't run into the issue of too many patches, anyway), and keep fingers crossed. (See <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/setmaxstdio?view=msvc-170> "_setmaxstdio" for details: "By default, up to 512 files can be open simultaneously at the stream I/O level. This level includes files opened and accessed using the fopen, fgetc, and fputc family of functions. The limit of 512 open files at the stream I/O level can be increased to a maximum of 8,192 by use of the _setmaxstdio function.") Change-Id: I6b3499f0f6c2060628418a15f5e36021bfe7dd18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162442 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> (cherry picked from commit 4582da4ad473e256975c86054033eb7d238d464e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162455 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/external/onlineupdate/lo.patch b/external/onlineupdate/lo.patch index debb7a5b3bbf..35dfb2f80fb8 100644 --- a/external/onlineupdate/lo.patch +++ b/external/onlineupdate/lo.patch @@ -223,6 +223,19 @@ LOG_WARN(("Install directory updater could not be determined.")); result = FALSE; } +--- onlineupdate/source/update/updater/updater.cpp ++++ onlineupdate/source/update/updater/updater.cpp +@@ -4174,6 +4174,10 @@ + NS_tmkdir(gDeleteDirPath, 0755); + } + } ++ ++ if (_setmaxstdio(8192) == -1) { ++ LOG(("_setmaxstdio failed")); ++ } + #endif /* XP_WIN */ + + // Run update process on a background thread. ShowProgressUI may return --- tools/update-packaging/common.sh +++ tools/update-packaging/common.sh @@ -76,17 +76,8 @@