Skip to content

fix(updater): remove leftover installer during config version migration - #10680

Merged
mgallien merged 1 commit into
nextcloud:masterfrom
chrip:fix/7009-installer-cleanup-on-migration
Sep 2, 2026
Merged

fix(updater): remove leftover installer during config version migration#10680
mgallien merged 1 commit into
nextcloud:masterfrom
chrip:fix/7009-installer-cleanup-on-migration

Conversation

@chrip

@chrip chrip commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Resolves

#7009

Summary

Every update leaves its installer (~200 MB) and msi.log behind 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() calls ConfigFile::cleanUpdaterConfiguration() (application.cpp:161-164), which drops Updater/updateAvailable — the only record of where the installer is — before main() reaches NSISUpdater::handleStartup() (main.cpp:104 vs :142). Both wipeUpdateData() 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.cfg versus 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, one MIRALL_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 and msi.log before dropping the keys, and NSISUpdater::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

testLeftoverInstallerIsRemovedAfterVersionChange fails on master and passes with the fix.

before after
Windows, version change, real nextcloud.exe Version changed… logged, no removal, both files survive two Removed leftover updater file: lines, both files gone
Windows, pending update, no version change untouched untouched (must not regress)
Windows ctest 78/78 78/78
Linux ctest 79/79 79/79

All 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::remove failing under an antivirus or open handle), which logs a warning and leaves the file.

Checklist

AI (if applicable)

@mgallien
mgallien force-pushed the fix/7009-installer-cleanup-on-migration branch from 4253651 to 3dab671 Compare August 28, 2026 11:21
@mgallien mgallien self-assigned this Aug 28, 2026
@mgallien mgallien added this to the 35.0.0 milestone Aug 28, 2026

@mgallien mgallien left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks
one small change only

Comment thread src/gui/updater/ocupdater.cpp Outdated
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>
@chrip
chrip force-pushed the fix/7009-installer-cleanup-on-migration branch from 58efae1 to d53bb2d Compare September 1, 2026 07:35
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Artifact containing the AppImage: nextcloud-appimage-pr-10680.zip

Digest: sha256:64f1095ef91cd992fb38e237794554640c4dd21843d02193f85a6a15568c4c75

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.

@mgallien
mgallien merged commit 68daf11 into nextcloud:master Sep 2, 2026
17 of 18 checks passed
@mgallien

mgallien commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

/backport to stable-34.0 please

@backportbot

backportbot Bot commented Sep 2, 2026

Copy link
Copy Markdown

The backport to stable-34.0 failed. Please do this backport manually.

# 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.0

Error: Failed to clone repository: Failed to create working tree: error: RPC failed; HTTP 401 curl 22 The requested URL returned error: 401
fatal: expected flush after ref listing


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@mgallien mgallien mentioned this pull request Sep 2, 2026
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants