-
Notifications
You must be signed in to change notification settings - Fork 38.7k
wallet: Correct dir iteration error handling #32736
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
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32736. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
https://cirrus-ci.com/task/6556243914915840?logs=ci#L4845: [09:50:58.842] AssertionError: [node 0] Expected messages "['Error scanning directory entries under']" does not partially match log: |
ab65c62 to
6ed17c7
Compare
maflcko
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.
The code looks correct, matches the upstream docs, and passes the tests. I left some nits.
review ACK 6ed17c7dca35ec820dc1c0500ef32a132c641fa5 🤜
Show signature
Signature:
untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: review ACK 6ed17c7dca35ec820dc1c0500ef32a132c641fa5 🤜
8C1jo8YtfwmG7YDw/SkVQcm33apByQ744hTZUTZRr1uCttPMiBfHDSd3YQ0UxkMDHOvAMpU1SIwUm5b4tAV8AQ==
Seems to have been broken since conversion from Boost in bitcoin#20744. The std::filesystem iteration aborts upon failure while Boost might have allowed skipping over faulty entries.
6ed17c7 to
272cd09
Compare
|
ACK 272cd09 |
|
re-ACK 272cd09 🍽 Show signatureSignature: |
rkrux
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.
tACK 272cd09
| assert_equal(result, {'wallets': []}) | ||
| self.stop_node(0) | ||
| # Restore permissions | ||
| os.chmod(data_dir('wallets'), stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) |
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:
- os.chmod(data_dir('wallets'), stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
+ os.chmod(data_dir('wallets'), stat.S_IRWXU)Initially, I thought of fetching the stat modes from os.stat and using those to set them back in chmod here. But RWXU is the most common, so fine.
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.
Neat! Maybe something that could be done in #31410 now this one merged?
| elif os.geteuid() == 0: | ||
| self.log.warning('Skipping test involving chmod as it requires a non-root user.') |
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.
Nice checking for the effective user ID, was the intention to add it as a safety check?
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.
Nice checking for the effective user ID, was the intention to add it as a safety check?
no, the test would not pass when this check/skip is removed. See #32736 (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.
To elaborate, we probably run tests under root on CI in some cases to enable tracing:
bitcoin/test/functional/test_framework/test_framework.py
Lines 971 to 975 in 272cd09
| def skip_if_no_bpf_permissions(self): | |
| """Skip the running test if we don't have permissions to do BPF syscalls and load BPF maps.""" | |
| # check for 'root' permissions | |
| if os.geteuid() != 0: | |
| raise SkipTest("no permissions to use BPF (please review the tests carefully before running them with higher privileges)") |
Make wallet DB properly detect and report failure to scan wallet directory. Seems to have been broken since moving from Boost to
std::filesystem.Found while reviewing: #31410 (review)