HomePhabricator

[backport#15583] wallet: Log and ignore errors in ListWalletDir and…

Description

[backport#15583] wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree

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 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

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Mar 14 2019, 17:57
majcostaCommitted on Sep 4 2020, 02:03
majcostaPushed on Sep 4 2020, 02:03
Reviewer
Restricted Project
Differential Revision
D7350: [backport#15583] wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree
Parents
rABC6b18a015f4fc: Port the abcbot code into this repository
Branches
Unknown
Tags
Unknown