summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-01-23 14:20:51 +0100
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-01-23 17:33:38 +0100
commitedf4ad7d9f3f09e5f47993c305451c4fc86359d3 (patch)
tree5afe97e66bff5e5ed680d61de8019463951e61cc /external
parent8718e362d8bb6fe3ac285ef355fc29d5756e1e92 (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>
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 @@