Skip to content

Plugin installer can leave a plugin in a broken state on failed upgrade #64790

Description

@wonder-sk

What is the bug or the crash?

If a plugin is getting upgraded, and any existing file from the plugin's directory is write-protected, the upgrade will fail half-way through, leaving the plugin in a broken state with some files from the old version and other files from the new version.

This is because right now, the installer does the following steps:

  1. extract ZIP package to the existing plugin directory - this is just a test whether the ZIP is not broken
  2. remove the existing plugin directory
  3. extract ZIP package again, to the now clean plugin directory

If the step 1 fails (due to a write-protected file), then the whole upgrade will fail and leave the plugin files in broken state.

https://github.com/qgis/QGIS/blob/master/python/pyplugin_installer/qgsplugininstallerinstallingdialog.py#L196

Steps to reproduce the issue

  1. set a file in a plugin that can be upgraded to write protected
  2. try to upgrade that plugin

Versions

All QGIS versions

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

Metadata

Metadata

Assignees

Labels

BugEither a bug report, or a bug fix. Let's hope for the latter!Plugin manager

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions