wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree#15583
wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree#15583laanwj merged 1 commit intobitcoin:masterfrom
Conversation
|
Fixes #15555 (comment). |
|
Concept ACK. |
ryanofsky
left a comment
There was a problem hiding this comment.
utACK 8de53d5097c7e0936a15ec738e2580814ee0de9b. Nice fix. I wouldn't have expected incrementing the iterator to throw.
If there's an easy way to add a test, it could be nice to have. But if it requires adding something platform-specific, probably better to skip.
I'd like to confirm a gitian build first, cc @MarcoFalke. |
|
Thanks @fanquake! |
|
Thanks for catching this @kiv06041992. I was able to reproduce with v0.18.0rc1 binary, as well as when building master from source. This commit fixes it, so tACK 8de53d5097 (test would be nice). I'm even able to create a new wallet and use it, and the wallet will be hidden next time you start (no idea why one would want that). @promag can you copy the steps to reproduce to the description? |
Done. |
df3d9d2 to
4c61be6
Compare
|
Although I agree that the current behavior is undesirable, I don't like ignoring errors either. In my experience this makes troubleshooting as good as impossible when something unexpected happens. Please handle the error or at least log it. |
|
@laanwj agree, I'll log. |
|
EDIT: It looks like failing to increment shouldn't cause infinite loops since |
|
Now logging the error and the respective path. Also log error in |
ryanofsky
left a comment
There was a problem hiding this comment.
utACK d595965c599161b14346a2552867eb2869a097c7. Only change since last review is adding logging. Current PR description ("Log errors in ListWalletDir and IsBerkeleyBtree") seems misleading, though. Main change is not the logging, but making listwalletdir not throw exceptions.
|
Gitian builds for commit c3b1cb9 (master):
Gitian builds for commit dab434cdc7d30fef582530766a8d93b93da3ee66 (master and this pull):
|
Thank you, looks good to me now, utACK after squash |
d595965 to
15c69b1
Compare
|
Reworded and squashed, thanks. |
…rkeleyBtree 15c69b1 wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree (João Barbosa) Pull request description: Use the `noexcept` members of `boost::filesystem::recursive_directory_iterator` in order to ignore `boost::filesystem::directory_iterator::construct: Permission denied` errors. The errors are logged though. Steps to reproduce the issue: ```sh # 1. create directory for -walletdir without read access: mkdir /tmp/foo && chmod a-r /tmp/foo # 2. run bitcoin-qt and should print an error, but continues running: /Volumes/Bitcoin-Core/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt -regtest -walletdir=/tmp/foo /private/tmp/foo: Permission denied # 4. go to File -> Open Wallet and should segfault: EXCEPTION: N5boost10filesystem16filesystem_errorE boost::filesystem::directory_iterator::construct: Permission denied: "/private/tmp/foo" bitcoin in Runaway exception ``` Tree-SHA512: 37e8bf5a1e0defc331030fd511bf9cac2765d01dfbf23e7233f37506e85b8ad07edcde9ba6dae7a2c95700c78d28c7dd248153607381852da96273cb159c4934
|
Gitian builds for commit 8e1704c (master):
Gitian builds for commit f5095fb13a91f7a5eccb7230803bb7aeaf686ab9 (master and this pull):
|
Github-Pull: bitcoin#15583 Rebased-From: 15c69b1 Tree-SHA512: edef7cafc5a2cb8d3355591a7742ef61454a5dedbb1dc22f6cc6bae42329d887f3f4a054f2aeedf31180051f50b6478d09e204066205699dabc0cb67b0ce4a96
…sBerkeleyBtree Summary: wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree (João Barbosa) Pull request description: Use the `noexcept` members of `boost::filesystem::recursive_directory_iterator` in order to ignore `boost::filesystem::directory_iterator::construct: Permission denied` errors. The errors are logged though. Steps to reproduce the issue: ```sh # 1. create directory for -walletdir without read access: mkdir /tmp/foo && chmod a-r /tmp/foo # 2. run bitcoin-qt and should print an error, but continues running: /Volumes/Bitcoin-Core/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt -regtest -walletdir=/tmp/foo /private/tmp/foo: Permission denied # 4. go to File -> Open Wallet and should segfault: EXCEPTION: N5boost10filesystem16filesystem_errorE boost::filesystem::directory_iterator::construct: Permission denied: "/private/tmp/foo" bitcoin in Runaway exception ``` --- Backport of Core [[bitcoin/bitcoin#15583 | PR15583]] Test Plan: ninja check check-functional run bitcoin-qt with a read-only -walletdir, do not segfault when hovering over 'create wallet' Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D7350
…nd IsBerkeleyBtree 15c69b1 wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree (João Barbosa) Pull request description: Use the `noexcept` members of `boost::filesystem::recursive_directory_iterator` in order to ignore `boost::filesystem::directory_iterator::construct: Permission denied` errors. The errors are logged though. Steps to reproduce the issue: ```sh # 1. create directory for -walletdir without read access: mkdir /tmp/foo && chmod a-r /tmp/foo # 2. run bitcoin-qt and should print an error, but continues running: /Volumes/Bitcoin-Core/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt -regtest -walletdir=/tmp/foo /private/tmp/foo: Permission denied # 4. go to File -> Open Wallet and should segfault: EXCEPTION: N5boost10filesystem16filesystem_errorE boost::filesystem::directory_iterator::construct: Permission denied: "/private/tmp/foo" bitcoin in Runaway exception ``` Tree-SHA512: 37e8bf5a1e0defc331030fd511bf9cac2765d01dfbf23e7233f37506e85b8ad07edcde9ba6dae7a2c95700c78d28c7dd248153607381852da96273cb159c4934
Use the
noexceptmembers ofboost::filesystem::recursive_directory_iteratorin order to ignoreboost::filesystem::directory_iterator::construct: Permission deniederrors. The errors are logged though.Steps to reproduce the issue: