fix(updater): remove leftover installer during config version migration - #10680
Conversation
4253651 to
3dab671
Compare
mgallien
left a comment
There was a problem hiding this comment.
thanks
one small change only
Application::configVersionMigration() clears the Updater/* keys on the first start of a newly installed version, before NSISUpdater::handleStartup() gets a chance to see them and clean up the downloaded installer. The installer and msi.log are then orphaned in the config folder with nothing left to find them by, repeating on every update. ConfigFile::cleanUpdaterConfiguration() now deletes the installer and msi.log before dropping the keys, so both the migration path and the updater's own cleanup remove the file. NSISUpdater::wipeUpdateData() delegates to it instead of duplicating the removal logic. Reported by @tgebler as still reproducing after nextcloud#8980: nextcloud#8980 (comment) Closes nextcloud#7009. Assisted-by: ClaudeCode:claude-sonnet-5 Co-authored-by: Matthieu Gallien <matthieu_gallien@yahoo.fr> Signed-off-by: chrip <christoph.schaefer@nextcloud.com>
58efae1 to
d53bb2d
Compare
|
Artifact containing the AppImage: nextcloud-appimage-pr-10680.zip Digest: To test this change/fix you can download the above artifact file, unzip it, and run it. Please make sure to quit your existing Nextcloud app and backup your data. |
|
/backport to stable-34.0 please |
|
The backport to # Switch to the target branch and update it
git checkout stable-34.0
git pull origin stable-34.0
# Create the new backport branch
git checkout -b backport/10680/stable-34.0
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick d53bb2d7
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/10680/stable-34.0Error: Failed to clone repository: Failed to create working tree: error: RPC failed; HTTP 401 curl 22 The requested URL returned error: 401 Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. |
Resolves
#7009
Summary
Every update leaves its installer (~200 MB) and
msi.logbehind in%APPDATA%\Nextcloud, one file per release.#8980 did not take effect in practice. On the first start of a newly installed version,
Application::configVersionMigration()callsConfigFile::cleanUpdaterConfiguration()(application.cpp:161-164), which dropsUpdater/updateAvailable— the only record of where the installer is — beforemain()reachesNSISUpdater::handleStartup()(main.cpp:104vs:142). BothwipeUpdateData()call sites then sit behind a guard that can no longer be true, and the file is orphaned with nothing left to find it by.The trigger is the version number in
nextcloud.cfgversus the one compiled into the running binary. They differ on every real update, and are identical when the same version is reinstalled — which is why this passes local testing, and why CI cannot express the case at all (one binary, oneMIRALL_VERSION_STRING). It regressed in v3.16.0 with b3886ed (#7807); before that the main flow cleaned up correctly and only unusual paths leaked.ConfigFile::cleanUpdaterConfiguration()now deletes the installer andmsi.logbefore dropping the keys, andNSISUpdater::wipeUpdateData()delegates to it instead of duplicating the same four key removals. Startup ordering is untouched, so #7807's intent is preserved.Deliberately not included: installers that have already accumulated (no recorded path remains, so they need a directory sweep) and the download location itself.
Tests
testLeftoverInstallerIsRemovedAfterVersionChangefails on master and passes with the fix.nextcloud.exeVersion changed…logged, no removal, both files surviveRemoved leftover updater file:lines, both files gonectestctestAll seven paths the updater can take were driven against the real binary — the five dialog outcomes ("New update ready" → Cancel / OK; "Update Failed" → Ask again later / Restart and update / Update manually) plus the two non-interactive ones (version change, external install).
Deletion happens only in the two cases where the update is genuinely finished, and in none of the five where a decision is still pending — a pending installer is never removed.
Built and verified on Windows (Craft/MSVC 2022) and Linux (Qt 6.10.2). Not tested: the locked-file case (
QFile::removefailing under an antivirus or open handle), which logs a warning and leaves the file.Checklist
AI (if applicable)