-
Notifications
You must be signed in to change notification settings - Fork 38.7k
qt: Backup former GUI settings on -resetguisettings
#11338
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
Conversation
meshcollider
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 232a108, really good idea 👍
Couple of small nits
src/qt/optionsmodel.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, GetDataDir() argument defaults to true so it'd be clearer to leave it out imo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it the other way around: clearer to leave it in, because it's explicit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally I'd say yes, but in this case it just leaves me wondering what the argument is doing, because in most other cases of GetDataDir in the code, the argument is left out. Personal preference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During the initialization sequence it's really important to get this right. E.g. I had to check the order in src/qt/bitcoin.cpp that calling GetDataDir(true) was allowed at this point.
Agree that boolean arguments are unclear, so are default arguments, so it's kind of choosing between evils here. Instead of an argument to GetDataDir we should have done GetSpecificDataDir and GetRootDataDir or such. Anyhow... I don't think this code is particularly unclear, I'll add 'to chain-specific datadir' in the comment.
src/qt/optionsmodel.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, space between &key and the colon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix
3141a2f to
bb37a03
Compare
bb37a03 to
4e9dc85
Compare
|
Travis was failing. Changed |
|
Added a dst.clear (suggested by @promag) to avoid the edge case of older settings staying behind. |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK modulus nits.
src/qt/optionsmodel.cpp
Outdated
| /** Helper function to copy contents from one QSettings to another. | ||
| * By using allKeys this also covers nested settings in a hierarchy. | ||
| */ | ||
| static void copySettings(QSettings &dst, const QSettings &src) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see the benefit of this function, move the code to backupSettings()? Otherwise & next to type name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is that this is a general function, it could be also e.g. used to restore QSettings from a backup, if that is ever necessary. Would prefer to keep it. Better too much factoring than too little.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok then, just update to CopySettings and move &.
src/qt/optionsmodel.cpp
Outdated
| } | ||
|
|
||
| /** Back up a QSettings to an ini-formatted file. */ | ||
| static void backupSettings(const fs::path &filename, const QSettings &src) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to BackupSettings and & next to type name.
src/qt/optionsmodel.cpp
Outdated
| */ | ||
| static void copySettings(QSettings &dst, const QSettings &src) | ||
| { | ||
| for (const QString &key : src.allKeys()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
& next to type name.
doc/files.md
Outdated
| * wallet.dat: personal wallet (BDB) with keys and transactions | ||
| * .cookie: session RPC authentication cookie (written at start when cookie authentication is used, deleted on shutdown): since 0.12.0 | ||
| * onion_private_key: cached Tor hidden service private key for `-listenonion`: since 0.12.0 | ||
| * guisettings.bak: backup of former GUI settings after `-resetguisettings` is used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.ini.bak?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah why not...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing doc update.
|
Tested ACK f725dbb, needs squash obviously, didn't bother to try to review in-depth for whether this is going to put the guisettings.bak file in a strange datadir (bitcoin.conf-based? the old GUI settings one?) but there isnt a "correct" answer there anyway, so I cant say I care much. |
|
Concept ACK |
|
utACK f725dbb Since this uses |
I think that's handled, it puts it in the new datadir that you have to select when using
Not opposed to restore functionality if there is a pressing use-case, although the intended purpose (as mentioned in OP) is diagnostics. This is much easier with .ini format. Also windows' NativeFormat cannot be exported to an arbitrary file just to other registry paths. |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK. It works even if the file already exists in either INI or other format (it's always overwritten).
There are still some code nits. One small and final thing, for me this is more of a dump than backup.
I don't think there needs to be a way to restore such a backup. This backup is only created when you run |
Or settings are fine and there is a bug? |
|
tACK b28af38 |
|
Found a strange issue while testing this. |
|
@jonasschnelli The embedded commit hash does not match the advertised commit hash on the website of the downloaded gitian binaries. |
|
@MarcoFalke: the commit hash is different because my build script builds it on top of master. I just did everything again and the gtitian version does not create the backup file. |
|
@jonasschnelli I performed my own gitian build and tested it but could not reproduce your issue. It will create I did notice that if you did not have any gui settings to begin with, the file will not be created. Perhaps that's what you are seeing? |
|
@achow101: even with enabling coincontrol I had no success on OSX. |
|
@jonasschnelli I am using Ubuntu 17.04 |
Hm, that's interesting, haven't thought about that. I think that behavior makes sense, though. |
gmaxwell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ut(not very useful at reviewing QT stuff)ACK.
Writes the GUI settings to `guisettings.bak` in the data directory before wiping them. This can be used to retroactively troubleshoot issues (e.g. bitcoin#11262) where `-resetguisettings` solves the problem.
b28af38 to
723aa1b
Compare
723aa1b qt: Backup former GUI settings on `-resetguisettings` (Wladimir J. van der Laan) Pull request description: Writes the GUI settings to `guisettings.bak` in the data directory before wiping them. This can be used to retroactively troubleshoot issues (e.g. #11262) where `-resetguisettings` solves the problem. (as discussed in yesterday's IRC meeting) Tree-SHA512: c64f5052d992eb02057ba285435f143c42d0cc456144a4c565e1c87be833737f9df750d0aee10810f85047c820d9b4f9f22fd94a6f09f4b28a9cf41b63a56586
Writes the GUI settings to `guisettings.bak` in the data directory before wiping them. This can be used to retroactively troubleshoot issues (e.g. bitcoin#11262) where `-resetguisettings` solves the problem. Github-Pull: bitcoin#11338 Rebased-From: 723aa1b
Summary: 723aa1b qt: Backup former GUI settings on `-resetguisettings` (Wladimir J. van der Laan) Pull request description: Writes the GUI settings to `guisettings.bak` in the data directory before wiping them. This can be used to retroactively troubleshoot issues (e.g. #11262) where `-resetguisettings` solves the problem. (as discussed in yesterday's IRC meeting) Tree-SHA512: c64f5052d992eb02057ba285435f143c42d0cc456144a4c565e1c87be833737f9df750d0aee10810f85047c820d9b4f9f22fd94a6f09f4b28a9cf41b63a56586 Backport of Core PR11338 bitcoin/bitcoin#11338 Test Plan: make check ./bitcoin-qt -resetguisettings guisettings.ini.bak should exist in your .bitcoin dir Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D3934
…ings` 723aa1b qt: Backup former GUI settings on `-resetguisettings` (Wladimir J. van der Laan) Pull request description: Writes the GUI settings to `guisettings.bak` in the data directory before wiping them. This can be used to retroactively troubleshoot issues (e.g. bitcoin#11262) where `-resetguisettings` solves the problem. (as discussed in yesterday's IRC meeting) Tree-SHA512: c64f5052d992eb02057ba285435f143c42d0cc456144a4c565e1c87be833737f9df750d0aee10810f85047c820d9b4f9f22fd94a6f09f4b28a9cf41b63a56586
Summary: 723aa1b qt: Backup former GUI settings on `-resetguisettings` (Wladimir J. van der Laan) Pull request description: Writes the GUI settings to `guisettings.bak` in the data directory before wiping them. This can be used to retroactively troubleshoot issues (e.g. #11262) where `-resetguisettings` solves the problem. (as discussed in yesterday's IRC meeting) Tree-SHA512: c64f5052d992eb02057ba285435f143c42d0cc456144a4c565e1c87be833737f9df750d0aee10810f85047c820d9b4f9f22fd94a6f09f4b28a9cf41b63a56586 Backport of Core PR11338 bitcoin/bitcoin#11338 Test Plan: make check ./bitcoin-qt -resetguisettings guisettings.ini.bak should exist in your .bitcoin dir Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D3934
Summary: 723aa1b qt: Backup former GUI settings on `-resetguisettings` (Wladimir J. van der Laan) Pull request description: Writes the GUI settings to `guisettings.bak` in the data directory before wiping them. This can be used to retroactively troubleshoot issues (e.g. #11262) where `-resetguisettings` solves the problem. (as discussed in yesterday's IRC meeting) Tree-SHA512: c64f5052d992eb02057ba285435f143c42d0cc456144a4c565e1c87be833737f9df750d0aee10810f85047c820d9b4f9f22fd94a6f09f4b28a9cf41b63a56586 Backport of Core PR11338 bitcoin/bitcoin#11338 Test Plan: make check ./bitcoin-qt -resetguisettings guisettings.ini.bak should exist in your .bitcoin dir Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D3934
Writes the GUI settings to
guisettings.bakin the data directory before wiping them. This can be used to retroactively troubleshoot issues (e.g. #11262) where-resetguisettingssolves the problem.(as discussed in yesterday's IRC meeting)