Add error handling to all boost filesystem functions#18189
Add error handling to all boost filesystem functions#18189uhliksk wants to merge 1 commit intobitcoin:masterfrom
Conversation
| dbwrapper_private::HandleError(result); | ||
| } | ||
| TryCreateDirectories(path); | ||
| assert(TryCreateDirectories(path)); |
There was a problem hiding this comment.
assert(…):s should not have side-effects :)
There was a problem hiding this comment.
Yes, sorry, I was debugging and I forgot to handle this correctly. I'll add proper error handling here in additional commit.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
| LogPrintf("%s: Unable to remove PID file: File does not exist\n", __func__); | ||
| } | ||
| } catch (const fs::filesystem_error& e) { | ||
| LogPrintf("%s: Unable to remove PID file: %s\n", __func__, fsbridge::get_filesystem_error_message(e)); |
There was a problem hiding this comment.
this seems fine as is (catching the error), no?
|
🐙 This pull request conflicts with the target branch and needs rebase. |
|
Hi @uhliksk - pinging for rebase and response to question above. |
|
Hi @adamjonas , sorry for delay, I'll be back on June 1st. |
|
Hi @uhliksk, friendly monthly ping. |
|
Hi @adamjonas, I'm alive but I had to postpone my work again. I'll be back soon. |
|
Going to close this for now. Let us know if/when you have time to work on it again and it can be re-opened. |
All boost filesystem functions should be handled using error code to prevent random crashes caused by inaccesible files or directories. Increment in iterator should use separate error code variable because it have to be handled specifically to prevent infinite loop in diving to inaccessible directories.
To prevent coding errors in future the lint test is added to check if error code parameters are present.
Previous conversation about issue in #18095