refactor: Replace fs::unique_path with GetUniquePath(path) calls#21052
refactor: Replace fs::unique_path with GetUniquePath(path) calls#21052laanwj merged 1 commit intobitcoin:masterfrom
Conversation
|
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. |
|
Concept ACK However, this introduces a circular dependency right now: |
f83bb3a to
805f888
Compare
| BOOST_CHECK_EQUAL(tmpfolder, p3.parent_path()); | ||
|
|
||
| // Ensure that generated paths are actually different. | ||
| BOOST_CHECK(p1 != p2); |
There was a problem hiding this comment.
I have left this intentionally very simple. One can certainly come up with many different ways to make this more robust but I would like to solicit for feedback for this.
I have changed the implementation. So this is fixed. |
…tem::unique_path() which is not available in std::filesystem.
0e1b085 to
1bca2aa
Compare
|
Concept ACK Thanks for paving the way for further Boost removal! |
| } | ||
|
|
||
| BOOST_AUTO_TEST_SUITE_END() | ||
| BOOST_AUTO_TEST_SUITE_END() No newline at end of file |
There was a problem hiding this comment.
In commit "Introduce GetUniquePath(base) helper method to replace boost::filesystem::unique_path() which is not available in std::filesystem." (1bca2aa)
Not a problem but there is an extraneous whitespace change here
|
Code review ACK 1bca2aa |
…Path(path) calls 1bca2aa Introduce GetUniquePath(base) helper method to replace boost::filesystem::unique_path() which is not available in std::filesystem. (Kiminuo) Pull request description: This PR makes it easier in bitcoin#20744 to remove our dependency on the `boost::filesystem::unique_path()` function which does not have a direct equivalent in C++17. This PR attempts to re-implement `boost::filesystem::unique_path()` as `GetUniquePath(path)` but the implementations are not meant to be the same. Note: * Boost 1.75.0 implementation of `unique_path`: https://github.com/boostorg/filesystem/blob/9cab675b71e98706886a87afe7c19eb9da568961/src/unique_path.cpp#L235 * In the previous implementation, I attempted to add: ```cpp fs::path GetUniquePath(const fs::path& base) { FastRandomContext rnd; fs::path tmpFile = base / HexStr(rnd.randbytes(8)); return tmpFile; } ``` to `fs.cpp` but this leads to a circular dependency: "fs -> random -> logging -> fs". That is why the modified implementation adds a new file. ACKs for top commit: laanwj: Code review ACK 1bca2aa ryanofsky: Code review ACK 1bca2aa. It's a simple change and extra test coverage is nice Tree-SHA512: f324bdf0e254160c616b5033c3ece33d87db23eb0135acee99346ade7b5cf0d30f3ceefe359a25a8e9b53ba8e4419f459c2bdd369e10fc0152ce95031d1f221c
merge bitcoin#16117, bitcoin#18358, bitcoin#17383, bitcoin#21052, bitcoin#14424, bitcoin#15159, bitcoin#14689, bitcoin#14978, partial bitcoin#16908, bitcoin#14978, bitcoin#13932: Auxillary Backports
This was missed in bitcoin#21052.
69a439b doc: add missing copyright header to getuniquepath.cpp (fanquake) Pull request description: This was missed in #21052. ACKs for top commit: hebasto: ACK 69a439b, but a scripted-diff using `copyright_header.py insert` looks preferable. Tree-SHA512: 1a75ffd93fa8e5e83821e1fe984353422740ebf9e203dc873debf4dffec0e23f55a1e31f806dd2d66087d3620f6dc447af69f9124f0bcc6676ef91ee35374832
…th.cpp 69a439b doc: add missing copyright header to getuniquepath.cpp (fanquake) Pull request description: This was missed in bitcoin#21052. ACKs for top commit: hebasto: ACK 69a439b, but a scripted-diff using `copyright_header.py insert` looks preferable. Tree-SHA512: 1a75ffd93fa8e5e83821e1fe984353422740ebf9e203dc873debf4dffec0e23f55a1e31f806dd2d66087d3620f6dc447af69f9124f0bcc6676ef91ee35374832
…th.cpp 69a439b doc: add missing copyright header to getuniquepath.cpp (fanquake) Pull request description: This was missed in bitcoin#21052. ACKs for top commit: hebasto: ACK 69a439b, but a scripted-diff using `copyright_header.py insert` looks preferable. Tree-SHA512: 1a75ffd93fa8e5e83821e1fe984353422740ebf9e203dc873debf4dffec0e23f55a1e31f806dd2d66087d3620f6dc447af69f9124f0bcc6676ef91ee35374832
…th.cpp 69a439b doc: add missing copyright header to getuniquepath.cpp (fanquake) Pull request description: This was missed in bitcoin#21052. ACKs for top commit: hebasto: ACK 69a439b, but a scripted-diff using `copyright_header.py insert` looks preferable. Tree-SHA512: 1a75ffd93fa8e5e83821e1fe984353422740ebf9e203dc873debf4dffec0e23f55a1e31f806dd2d66087d3620f6dc447af69f9124f0bcc6676ef91ee35374832
This PR makes it easier in #20744 to remove our dependency on the
boost::filesystem::unique_path()function which does not have a direct equivalent in C++17.This PR attempts to re-implement
boost::filesystem::unique_path()asGetUniquePath(path)but the implementations are not meant to be the same.Note:
Boost 1.75.0 implementation of
unique_path: https://github.com/boostorg/filesystem/blob/9cab675b71e98706886a87afe7c19eb9da568961/src/unique_path.cpp#L235In the previous implementation, I attempted to add:
to
fs.cppbut this leads to a circular dependency: "fs -> random -> logging -> fs". That is why the modified implementation adds a new file.