Skip to content

Keep the installed configuration when an earlier NVDA installer can't load it - #21031

Open
akj wants to merge 6 commits into
nvaccess:masterfrom
akj:fix-18905-launcher-keeps-config
Open

akj wants to merge 6 commits into
nvaccess:masterfrom
akj:fix-18905-launcher-keeps-config

Conversation

@akj

@akj akj commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #18905

Summary of the issue:

The NVDA installer (launcher) uses the installed copy's configuration.
If that configuration was saved by a newer version of NVDA, an earlier installer may not be able to load it.
The installer then treats the file as corrupted: it renames nvda.ini to nvda.ini.corrupted.bak and continues with factory defaults.
So just running an earlier installer, even only to create a portable copy, resets the installed copy's configuration.

Description of user facing changes:

  • When the installer can't load the configuration, it uses factory defaults without changing the file.
    The startup message says the configuration could not be loaded, possibly because a newer version of NVDA saved it, instead of saying it has been reset.
  • If the user chooses to install that earlier version, the warning about installing an earlier version also says their configuration will be reset to factory defaults.

Description of developer facing changes:

None.

Description of development approach:

  • In ConfigManager._initBaseConf, the launcher loads factory defaults without renaming the file when the configuration can't be loaded.
    It loads the defaults before logging the error, because handling a logged error reads the configuration, which is empty while reverting to the saved configuration.
  • Other copies, including secure mode on the sign-in screen, still back up the file, so the error isn't reported on every start.
  • InstallingOverNewerVersionDialog adds the reset warning when running as the launcher with config.conf.baseConfigError set.
    PortableCopyOverNewerVersionDialog doesn't, as a portable copy has its own configuration.

Testing strategy:

  • Unit tests cover the launcher, a normal copy and secure mode loading an invalid configuration, reverting in the launcher, and the warning text.
  • Manual testing with this PR's launcher, run in Windows Sandbox with NVDA alpha 58175 installed, and an nvda.ini that fails validation:
    • Exit at the launcher dialog: nvda.ini is unchanged and no backup is created.
    • Continue running: the new message appears, and the file is unchanged after exit.
    • Revert to saved configuration, reset to factory defaults, and save: NVDA keeps working and nothing is written.
    • Create a portable copy: the copy is created and the file is unchanged.
    • Install: the warning includes the reset paragraph. With a valid configuration, it doesn't.
    • Replace a newer portable copy: the warning doesn't include the reset paragraph.
    • --secure, and the installed copy's configuration without --config-path: the file is unchanged.
    • Install and proceed: the installed earlier copy resets the configuration and backs up the original, as the warning says.

Known issues with pull request:

  • A normal copy still logs the error before loading factory defaults.
    If its configuration couldn't be backed up at startup, reverting to the saved configuration can leave it without a configuration.
    This predates this PR.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

Created with Claude Opus 5.5 in Claude Code. Reviewed with gpt-6.1-sol.

🤖 Generated with Claude Code

@akj
akj force-pushed the fix-18905-launcher-keeps-config branch from f623cdf to 5a178d8 Compare October 26, 2026 15:09
@akj
akj marked this pull request as ready for review October 27, 2026 11:30
@akj
akj requested a review from a team as a code owner October 27, 2026 11:30
@akj
akj requested a review from SaschaCowley October 27, 2026 11:30
akj and others added 6 commits October 30, 2026 09:02
When the launcher can't load the installed copy's configuration, for
example because it is older than the installed copy, it now uses factory
defaults without renaming nvda.ini to nvda.ini.corrupted.bak. Previously
running an older launcher left the installed copy without its settings.

The startup message no longer claims the configuration was reset when the
file was left alone. The warning shown before installing an earlier version
now says the configuration will be reset, when the launcher could not load it.

Fixes nvaccess#18905

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Secure mode, such as on the sign-in screen, uses its own system configuration.
It keeps backing up a configuration it can't load, so the error isn't reported on every start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverting to the saved configuration in the launcher reloads a configuration it can't load.
Logging that error read the configuration while it was being reset, which raised an exception
and left NVDA without a configuration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Handling a logged error reads the configuration, through the error sound check and the error sound
itself, and the configuration is empty while it is being reset. Recovering first covers every reader,
so the narrower logHandler change is no longer needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@akj
akj force-pushed the fix-18905-launcher-keeps-config branch from fe57cb0 to fe64c5e Compare October 30, 2026 13:02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installers from previous versions of NVDA won't open

1 participant