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

[Qt] add startup option to reset Qt settings #7006

Merged
merged 2 commits into from
Nov 25, 2015

Conversation

jonasschnelli
Copy link
Contributor

Fixes #6749. can cure issues like #6749.

Setting a invalid Proxy (-proxy) or TorProxy (-onion) over the GUI settings panel will result in an InitError() (terminate the app) during the next app startup. Qt stores its settings in the windows registry and similar infrastructures and are therefore non-trivial to flush.

This PR adds a startup argument -resetguisettings which resets all GUI settings and reenable a smooth startup.
This does not affect the bitcoin.conf file (different settings layer).

I'm not entirely happy with this solution because some (most?) non expert users have problems starting bitcoin-qt with a command line argument because it involves opening a shell (cmd.exe, etc.).

@paveljanik
Copy link
Contributor

What kind of invalid settings is it? Do we save invalid values or values become invalid by time or by other reasons? Do you have an example?
If we can print "invalid proxy or something", we can also open the relevant dialog setting the proxy and allow the user to fix it. No?

@paveljanik
Copy link
Contributor

Otherwise we have to document this for users so they can find it. But I think it is cleaner to prevent it to happen.

@jonasschnelli
Copy link
Contributor Author

I think having a way of resetting the qt settings is nice, although i agree with @paveljanik that it should not be possible to "save" a invalid proxy over the GUI settings panel.

You can test it yourself by setting a proxy in the GUI settings panel with the IP "0.0.0.0" (port doesn't matter).

Open the settings window and allow the user to change it, would be a invasive change to the startup process. I have though about a "reset setting" button in a error dialog during startup,... but that also feels wrong.

@laanwj
Copy link
Member

laanwj commented Nov 13, 2015

What kind of invalid settings is it? Do we save invalid values or values become invalid by time or by other reasons? Do you have an example?

See #6749.
It's not supposed to happen, but it can happen that the settings in the QSettings are - somehow - unparseable or corrupted. Passing a command line option may be somewhat easier than directing the user to find the settings in regedit.

@paveljanik
Copy link
Contributor

I do not want the user to be redirected to regedit ;-) I think he should end up in our dialog for setting the "corrupted" proxy setting in this case.

But anyway, having this option is good anyway, lets document it :-)

@laanwj
Copy link
Member

laanwj commented Nov 14, 2015

Well yes, a corrupted proxy setting should result in a warning, not a fatal error.

But I suspect that's only one of the things that can go wrong. Having a 'reset to factory settings' can never hurt.

@laanwj
Copy link
Member

laanwj commented Nov 14, 2015

Well yes, a corrupted proxy setting should result in a warning, not a fatal error.

Thinking about this a bit I'm not sure. It makes sense to have this fatal. Or at least have it disable all networking.
Say you set up a proxy to hide your identify.
It happens to be detected as corrupted (for some reason).
Then the last thing you want is to disable it, one such leak can ruin everything.

@paveljanik
Copy link
Contributor

Yes, proxy setting is very sensible (this is why I asked for other examples, because I have heard - and read in #6749 - only about proxy setting so far).

@jonasschnelli
Copy link
Contributor Author

I agree, the proxy setting is very sensible. A better approach would be to check the proxy when entering an IP in the QT settings panel. We shouldn't allow a invalid proxy so it would never lead to a startup error.

@paveljanik
Copy link
Contributor

Jonas: the setting can be invalidated by time, network issues etc...

@paveljanik
Copy link
Contributor

Or it can even be an attack.

@maflcko
Copy link
Member

maflcko commented Nov 14, 2015

It makes sense to have this fatal.

There is more than just fatal and warning. Couldn't we do a prompt with something like

Problem with $[invalid qt setting]
Button("Stop Bitcoin Core")     Button("Reset $[invalid qt setting]")

?

@jonasschnelli
Copy link
Contributor Author

Hmm.. the only check where a invalid proxy can lead to a app startup error & termination is CAddress.isValid() (https://github.com/bitcoin/bitcoin/blob/master/src/init.cpp#L1117). I think changes in the local network or somehow something that influents the local time can't raise a startup issue like #6749. A invalid proxy address can be detected and rejected shortly before storing to the QSettings persistent store.

An attack would be possible, although not much different to an attack to bitcoin.conf. Out of scope for this PR.

However, I think this PR is useful in case of invalid or corrupt Qt settings.

@maflcko
Copy link
Member

maflcko commented Nov 14, 2015

Yes, this PR is useful, but you shouldn't call it "Fixes #6749."

@jonasschnelli
Copy link
Contributor Author

Added a HelpMessageOpt for -resetguisettings.

@jonasschnelli
Copy link
Contributor Author

@MarcoFalke: right. It doesn't fix #6749, i'll just changes the PR description. Will work on a additional fix.

@paveljanik
Copy link
Contributor

-help looks like this now:

  -min
       Start minimized
...
  -resetguisettings
       Reset all settings changes made over the GUI (default: 0)

What about removing (default: 0) completely?

@jonasschnelli
Copy link
Contributor Author

Yes. The default: 0 is somehow useless. Just removed it over a amend force push.

@paveljanik
Copy link
Contributor

ACK

Thanks!

@maflcko
Copy link
Member

maflcko commented Nov 19, 2015

Concept ACK

@maflcko maflcko mentioned this pull request Nov 24, 2015
@jonasschnelli jonasschnelli merged commit f71bfef into bitcoin:master Nov 25, 2015
jonasschnelli added a commit that referenced this pull request Nov 25, 2015
f71bfef add UI help for -resetguisettings (Jonas Schnelli)
ae98388 [Qt] add startup option to reset Qt settings (Jonas Schnelli)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting an invalid proxy in GUI settings prevents program from starting
4 participants