-
Notifications
You must be signed in to change notification settings - Fork 37.7k
refactor: Extract util/fs from util/system #27254
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. 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. |
b67efe7
to
ea27809
Compare
Thanks for the review! Updated b67efe7 -> ea27809 (splitSystemFs_0 -> splitSystemFs_1, compare) to address review comments. |
Agree these functions should not be combined into existing |
ea27809
to
dac4d1d
Compare
Updated ea27809 -> c4f2b6d (splitSystemFs_1 -> splitSystemFs_2, compare) to rename Added commit dac4d1d (splitSystemFs_3) as a scripted diff moving |
dac4d1d
to
b22cf8d
Compare
Updated dac4d1d -> b22cf8d (splitSystemFs_3 -> splitSystemFs_4, compare) to fix a broken rename and include an additional header in |
Besides the remaining CI failure, it looks like the lint job does not support |
I guess it can be added back? No strong opinion. Though, we might want to look into docker image caching to avoid the
Not sure if this should be hidden like this. A separate commit or pull request seems better for this bugfix. Also, could add it to ci iwyu for reviewers to check for other missing includes? |
b22cf8d
to
cc662d0
Compare
Rebased b22cf8d -> cc662d0 (splitSystemFs_4 -> splitSystemFs_5, compare) to fix conflicts and update the commit message to exclude the scripted diff. |
{ | ||
WCHAR pszPath[MAX_PATH] = L""; | ||
|
||
if (SHGetSpecialFolderPathW(nullptr, pszPath, nFolder, fCreate)) { |
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.
In commit "refactor: Extract util/fs_helpers from util/system" (59c02e6)
Anybody have advice on easiest way to review changes like this when blocks of code are moving but also changing slightly at the same time?
I find it pretty easy to review blocks of moved code in git with the --color-moved
option, but once code is moved and reformatted at the same time (the {
at the end of this line was previously on its own line) it becomes very tedious to find the matching blocks of old and new code, and then compare them to make sure the differences are not significant.
If there isn't some more convenient way to review changes like this, I would definitely appreciate it if the code could just be moved and not reformatted.
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.
If there isn't some more convenient way to review changes like this, I would definitely appreciate it if the code could just be moved and not reformatted.
ACK, I will stop using clang-format-diff
on all moved code. Thank you for the review!
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.
You could do it in a separate commit, after the move
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.
Code review ACK 3ceb8dd
This is an extraction of filesystem related functions from util/system into their own utility file. The background of this commit is an ongoing effort to decouple the libbitcoinkernel library from the ArgsManager defined in system.h. Moving these functions out of system.h allows including them from a separate source file without including the ArgsManager definitions from system.h.
The inclusion of this header should not depend on the inclusion of other headers that include cstddef themselves.
The inclusion of this header should not depend on the inclusion of other headers that include fs.h themselves.
The fs.* files are already part of the libbitcoin_util library. With the introduction of the fs_helpers.* it makes sense to move fs.* into the util/ directory as well.
3ceb8dd
to
00e9b97
Compare
Updated 3ceb8dd -> 00e9b97 (splitSystemFs_6 -> splitSystemFs_7, compare):
Apologies for going another round here. |
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.
ACK 00e9b97
#include <chainparams.h> | ||
#include <fs.h> | ||
#include <qt/intro.h> | ||
#include <qt/forms/ui_intro.h> | ||
#include <util/fs.h> | ||
|
||
#include <qt/guiconstants.h> | ||
#include <qt/guiutil.h> | ||
#include <qt/optionsmodel.h> | ||
|
||
#include <interfaces/node.h> | ||
#include <util/fs_helpers.h> | ||
#include <util/system.h> | ||
#include <validation.h> |
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:
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -6,16 +6,16 @@
#include <config/bitcoin-config.h>
#endif
-#include <chainparams.h>
#include <qt/intro.h>
#include <qt/forms/ui_intro.h>
-#include <util/fs.h>
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
+#include <chainparams.h>
#include <interfaces/node.h>
+#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/system.h>
#include <validation.h>
…/system be55f54 move-only: Extract common/args and common/config.cpp from util/system (TheCharlatan) Pull request description: This pull request is part of the `libbitcoinkernel` project bitcoin/bitcoin#24303 https://github.com/bitcoin/bitcoin/projects/18 and more specifically its "Step 2: Decouple most non-consensus code from libbitcoinkernel". It is part of a series of patches splitting up the `util/system` files. Its preceding pull request is bitcoin/bitcoin#27254. The pull request contains an extraction of ArgsManager related functions from util/system into their own common/ file. The background of this commit is an ongoing effort to decouple the libbitcoinkernel library from the ArgsManager. The ArgsManager belongs into the common library, since the kernel library should not depend on it. See [doc/design/libraries.md](https://github.com/bitcoin/bitcoin/blob/master/doc/design/libraries.md) for more information on this rationale. ACKs for top commit: MarcoFalke: re-ACK be55f54 🚲 ryanofsky: Code review ACK be55f54. Just small cleanups since the last review. hebasto: ACK be55f54, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: 90eb03334af0155b823030b4f2ecf286d35058d700ee2ddbbaa445be19e31eb0fe982656f35bd14ecee3ad2c3d0db3746855cb8f3777eff7253713e42873e111
3ece0eb build, doc: Adjust comment after PR27254 (Hennadii Stepanov) Pull request description: This is a follow up for bitcoin/bitcoin#27254. ACKs for top commit: TheCharlatan: ACK 3ece0eb Tree-SHA512: 36c627524304f0ea964383488acb9b16d0b553cc9cf3bce7a12aec65a7905b13e4582b7b7ec6d1efa32cd3c623969bc00f805ff31d9e6eec86a614e75796c8ff
3ece0eb build, doc: Adjust comment after PR27254 (Hennadii Stepanov) Pull request description: This is a follow up for bitcoin#27254. ACKs for top commit: TheCharlatan: ACK 3ece0eb Tree-SHA512: 36c627524304f0ea964383488acb9b16d0b553cc9cf3bce7a12aec65a7905b13e4582b7b7ec6d1efa32cd3c623969bc00f805ff31d9e6eec86a614e75796c8ff
…ibrary, interface_ui from validation. 7d3b350 refactor: Move system from util to common library (TheCharlatan) 7eee356 refactor: Split util::AnyPtr into its own file (TheCharlatan) 44de325 refactor: Split util::insert into its own file (TheCharlatan) 9ec5da3 refactor: Move ScheduleBatchPriority to its own file (TheCharlatan) f871c69 kernel: Add warning method to notifications (TheCharlatan) 4452707 kernel: Add progress method to notifications (TheCharlatan) 84d7145 kernel: Add headerTip method to notifications (TheCharlatan) 447761c kernel: Add notification interface (TheCharlatan) Pull request description: This pull request is part of the `libbitcoinkernel` project bitcoin/bitcoin#27587 https://github.com/bitcoin/bitcoin/projects/18 and more specifically its "Step 2: Decouple most non-consensus code from libbitcoinkernel". --- It removes the kernel library's dependency on `util/system` and `interface_ui`. `util/system` contains networking and shell-related code that should not be part of the kernel library. The following pull requests prepared `util/system` for this final step: bitcoin/bitcoin#27419 bitcoin/bitcoin#27254 bitcoin/bitcoin#27238. `interface_ui` defines functions for a more general node interface and has a dependency on `boost/signals2`. After applying the patches from this pull request, the kernel's reliance on boost is down to `boost::multiindex`. The approach implemented here introduces some indirection, which makes the code a bit harder to read. Any suggestions for improving or reworking this pull request to make it more concise, or even reworking it into a more proper interface, are appreciated. ACKs for top commit: MarcoFalke: re-ACK 7d3b350 (no change) 🎋 stickies-v: Code Review ACK 7d3b350 hebasto: re-ACK 7d3b350, only last two commits dropped since my [recent](bitcoin/bitcoin#27636 (review)) review. Tree-SHA512: c8cfc698dc9d78e20191c444708f2d957501229abe95e5806106d1126fb9c5fbcee686fb55645658c0107ce71f10646f37a2fdf7fde16bbf22cbf1ac885dd08d
This pull request is part of the
libbitcoinkernel
project #24303 https://github.com/bitcoin/bitcoin/projects/18 and more specifically its "Step 2: Decouple most non-consensus code from libbitcoinkernel". This commit was originally authored by empact and is taken from its parent PR #25152.Context
There is an ongoing effort to decouple the
ArgsManager
used for command line parsing user-provided arguments from the libbitcoinkernel library (#25290, #25487, #25527, #25862, #26177, and #27125). TheArgsManager
is defined insystem.h
. A similar pull request extracting functionality fromsystem.h
has been merged in #27238.Changes
Next to providing better code organization, this PR removes some reliance of the tree of libbitcoinkernel header includes on
system.h
(and thus theArgsManager
definition) by moving filesystem related functions out of thesystem.*
files.There is already a pair of
fs.h
/fs.cpp
in the top-levelsrc/
directory. They were not combined with the files introduced here, to keep the patch cleaner and more importantly because they are often included without the utility functions. The new files are therefore namedfs_helpers
and the existingfs
files are moved into the util directory.Further commits splitting more functionality out of
system.h
are still in #25152 and will be submitted in separate PRs once this PR has been processed.