Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copying settings to secure screens doesn't warn when all add-ons are disabled #8418

Closed
wants to merge 14 commits into from

Conversation

nvdaes
Copy link
Contributor

@nvdaes nvdaes commented Jun 19, 2018

Link to issue number:

Fixes #8274

Summary of the issue:

NVDA shouldn't give a warning when users choose to copy settings for secure screens, if all add-ons are disabled.

Description of how this pull request fixes the issue:

We check if globalVars.appArgs.disableAddons is False (not globalVars.appArgs.disableAddons) to see if all add-ons are disabled. In this case, the for loop to check if directories contained in the user configuration folder aren't empty, in order to ask confirmation before copying settings, is not performed.

Testing performed:

Unit tests and run NVDA master with this pull request from source.
Due to an error with some libraries on the local computer, this snapshot hasn't been installed for a real test.

Known issues with pull request:

None.
Anyway, this could be improved:

  1. Checking if there are or not running add-ons, to copy just them and show their name to the user.
  2. Remove old plugins and drivers.
  3. Don't warn if they aren't running add-ons though globalVars.appArgs.disableAddons is True (for instance, if they have been disabled individually).

Change log entry:

  • Changes
    NVDA doesn't warn before copying settings for secure screens when all add-ons have been disabled.

@LeonarddeR
Copy link
Collaborator

Thanks for your pr.

What worries me here is that this creates an inconsistency. When add-ons are force disabled, this code does not copy them at all, while as when some are disabled and others are enabled, all addons are still copied regardless of their state.

@nvdaes
Copy link
Contributor Author

nvdaes commented Jun 19, 2018

Yes, I thought about this too, and my idea was that someone could use the feature of disabling add-ons precissely as a temporary way of indicating that they shouldn't be copied, without disabling it the next time NVDA is restarted.
Anyway, for me old plugins should be removed and then a for loop between running add-ons should let to select individual add-ons to copy.

@Brian1Gaff
Copy link

Brian1Gaff commented Jun 19, 2018 via email

@nvdaes
Copy link
Contributor Author

nvdaes commented Jun 19, 2018

@Brian1Gaff , not just add-ons containing syntesizer drivers could take effect in secure screens and may be copied.

@nvdaes
Copy link
Contributor Author

nvdaes commented Jun 19, 2018

Now addonHandler.getRunningAddons() method is used instead.
For each running add-on, its add-on summary is appended to a list named runningAddons. The warning is shown just when there are running add-ons, without looking to app modules, global plugins and drivers, since probably they will be removed and the whole config directory with its subdirs are copied now.
This could be improved, as mentioned in this related issue, where the possibility of selecting what add-ons will be copied to system configuration is requested:
#6305

I have installed this snapshot of NVDA creating a launcher, and have made tests disabling various add-ons and all.
For me results are acceptable. The summary of the running add-ons is shown when the warning is presented.
I think it's better to show summaries and not names, since they are intended to be the name to display and are shown in the list of the add-on manager.
@LeonarddeR and others, if you are interested, please review this or provide more feed-back.
Thanks

@nvdaes
Copy link
Contributor Author

nvdaes commented Jun 20, 2018

Last commit not tested yet.

@@ -1,12 +1,34 @@
> Below you will find NVDA's Github issue template. You might consider swapping to the preview tab in order
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand why this is in the diff, could you please merge most recent master?

import addonHandler
subDirs[:] = [addon.name for addon in addonHandler.getRunningAddons()]
else:
subDirs[:] = subDirs
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is necessary.

runningAddons = []
for addon in addonHandler.getRunningAddons():
runningAddons.append(addon.manifest['summary'])
if len(runningAddons)>0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can easily change this into something like:
if next(addonHandler.getRunningAddons(), None):

Copy link
Collaborator

@LeonarddeR LeonarddeR Jun 21, 2018

Choose a reason for hiding this comment

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

Ugh, that is actually ridiculous.
if any(addonHandler.getRunningAddons()): will suffice

@nvdaes
Copy link
Contributor Author

nvdaes commented Jun 21, 2018

Thanks, @LeonarddeR.
I've merged master and simplified the code of gui following your excellent suggestion.
About the config file, are you sure? According to my tests in Python console, I think that the assignment subDirs[:]=subDirs is necessary. Otherwise, when curSourceDir is "addons", the assignment can be changed causing issues, that is, I think the subDir[:] needs to be restored when curSourceDir is not "addons".
But, if you are sure, I will change it.
About addonHandler, it's imported in other function of config/init.py, but not at module level. I don't know if this could be simplified importing it just once.
Regards.

* This doesn't work as expected testing with an installed copy: no addon is copied.
* (Suggested by @LeonarddeR).
g
@nvdaes
Copy link
Contributor Author

nvdaes commented Jun 21, 2018

Now results are as follows:

  • When trying to copy settings, list of summaries for running add-ons is shown in the message box requesting confirmation.
  • The user config folder is copied, as previously, with all containing subfolders, i.e., non running add-ons are copied, but they can't be enabled on secure screens. This has the dfollowing drawback: it's not useful, the same as other temporary files contained in the user config folder, or possibly dictionaries for synthesizers, which can remain in NVDA even when corresponding voices have been uninstalled, for instance. The advantage could be if NVDA could include a feature for reverting configuration by copying options from system config.
  • Drivers intended to be used for testing, like appModules, globalPlugins, etc., are copied too. Since NVDA doesn't have a proper way to provide a name, description or other tasks of management for this, maybe better not to copy them.
  • I think this shouldn't be merged until the issue about selecting individual add-ons to copy is addressed. Though disabling individual add-ons before copying settings could be a way of selecting them.

Thanks

@josephsl
Copy link
Collaborator

Hi,

Can you rebase this branch to master if possible? Or, we may need to start over from scratch due to #6275 and so many changes since then.

Thanks.

@nvdaes
Copy link
Contributor Author

nvdaes commented Jul 30, 2019

@josephsl, for now I see conflicts to fix in various files. I will get a look at this.

@nvdaes
Copy link
Contributor Author

nvdaes commented Jul 30, 2019

@josephsl, you can test changes. Just a few lines need to be changed in gui/settingsDialogs after merging master into this branch.
scons tests have passed and NVDA runs well.
Thanks

@josephsl
Copy link
Collaborator

Hi,

I think telling users that these add-ons are currently enabled might help, since it now checks if any add-ons are running i.e. enabled. Something to the effect of:

The following add-ons are currently enabled.

Eventually I think a dialog to choose individual add-ons to copy would build on top of this change.

Also, when copying add-ons, copy only add-ons that are running if users said "yes" to the warning, but then again, I think a dialog described above may make things a bit easier.

Thanks.

@nvdaes
Copy link
Contributor Author

nvdaes commented Jul 30, 2019

@josephsl commented:

Eventually I think a dialog to choose individual add-ons to copy would build on top of this change.

This was suggested by @LeonarddeR in issue #6305.

Also, when copying add-ons, copy only add-ons that are running if users said "yes" to the warning.

Maybe discussed, taking account as a drawback that pickle file will contain info for add-ons not copied, and that if the user configuration could be restored to the system configuration, the add-ons not copied couldn't be enabled later.

@josephsl
Copy link
Collaborator

Hi,

Are we ready to get this PR going again?

Thanks.

@feerrenrut feerrenrut added the Abandoned requested reports or updates are missing since more than 1 year, author or users are not available. label Jul 3, 2020
@feerrenrut
Copy link
Contributor

We have decided to close this PR. We would like to see much deeper user control for how add-ons are copied to the system profile. A GUI should be introduced, allowing (but strongly discouraging) users to select which add-ons to use on the system profile. No add-ons should be selected by default.

@feerrenrut feerrenrut closed this Jul 3, 2020
@nvdaes
Copy link
Contributor Author

nvdaes commented Jul 3, 2020 via email

@cary-rowen
Copy link
Contributor

@nvdaes
Do you have any new progress on this PR? Regarding #6305, of course it is not just this closed PR. I hope to see new progress.
Thanks.

@nvdaes
Copy link
Contributor Author

nvdaes commented Jun 16, 2021

@cary-rowen, no, there is not any progress for now. Please see issue #11006

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Abandoned requested reports or updates are missing since more than 1 year, author or users are not available. feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copying settings to secure screens gives a warning about addons even when they are all disabled.
6 participants