Add-on handler: current install/uninstall order causes removal of add-on-specific information the add-on installer has added
Hi,
Reported by @DerekRiemer and subsequently confirmed:
If an add-on performs operation such as adding DLL's to path environment variable, migrating settings after an install and what not, these information will be lost when NVDA restarts.
STR:
- Create an add-on that performs actions such as adding its path to path environment variables while running onInstall function, and removes this very info via onUninstall function.
- Install this add-on.
- After restarting NVDA, upgrade (reinstall) the add-on.
Expected: information added in install function should be kept. Actual: information is removed via uninstall function. Cause: install/uninstall order.
Technical: onInstall function is run when an add-on is installed. During an upgrade, onInstall is called. When NVDA restarts, onUninstall function is called, undoing the work the instlal function has performed. This causes issues such as loss of just added path, migration being canceled and so on.
Solutions:
- Let add-ons detect loss of functionality and mitigate workarounds such as manually adding its path.
- Create a new function (onPostInstall) that'll let add-ons take care of this very scenario.
- Create a mechanism for add-ons to specify that onUninstall should not be called when upgrading.
Thanks.
Technical, this isn't a bug, as much as very unexpected behavior. See https://github.com/dictationbridge/dictationbridge-nvda/issues/16 I agree that some sort of postInstall or onUpdateUninstall or onUpdatePreviousUninstall, or onOnlyRemove method be created to allow code to choose whether to run the uninstaller on update. This would look like run onUpdateUninstall if old addon exists.
cc: @feerrenrut, @michaelDCurran
cc: @CyrilleB79, @seanbudd this issue very probably still exists in NVDA 2023.2 right?
@josephsl is this still an issue in NVDA 2024.1 with the current add-on store?
We didn't get any updates from Joseph upon request since many years on this, I am closing as abandoned. if you are still having this issue, please comment and we can reopen.
@josephsl, @derekriemer: if this issue is still relevant with NVDA 2024.1, please comment here so that this issue be reopened.