summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-01-23 14:20:51 +0100
committerAndras Timar <andras.timar@collabora.com>2024-01-29 10:30:25 +0100
commit36021c99f16e26ee4d0dcc1f1c4bcf0ef0a24b61 (patch)
treeb8581ffd17dd5ba38303bf8930175b17907a99aa /external
parent7d6b262175629408deca94b997c1217a89c0b093 (diff)
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.bergmann@allotropia.de> (cherry picked from commit 4582da4ad473e256975c86054033eb7d238d464e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162455 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'external')
-rw-r--r--external/onlineupdate/lo.patch13
1 files changed, 13 insertions, 0 deletions
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 @@