Page MenuHomePhabricator

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

Authored by majcosta on Sep 3 2020, 22:18.

Details

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'

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

majcosta requested review of this revision.Sep 3 2020, 22:18

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

This revision is now accepted and ready to land.Sep 4 2020, 01:09