-
Notifications
You must be signed in to change notification settings - Fork 38.7k
utils and libraries: Replace deprecated Boost Filesystem functions #15880
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
utils and libraries: Replace deprecated Boost Filesystem functions #15880
Conversation
e5ce5a1 to
8823a11
Compare
ryanofsky
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.
utACK 8823a11988d0d4824a44eb2f34e37632e7a0f09a
8823a11 to
276a674
Compare
|
@ryanofsky |
ryanofsky
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.
utACK 276a67490f795429c1af844966ad7960908576c0. Only change is replacing impossible to reach condition with an assert.
promag
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.
utACK 276a674.
Shouldn't 3edc71674ce79d81f4c5da94663787899f123719 be after 276a67490f795429c1af844966ad7960908576c0?
src/wallet/db.cpp
Outdated
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.
Suggestion, either drop the assertion (GetWalletEnv always returns a plain filename) or make it complete because:
std::cout << path("/").filename(); // outputs "/"
std::cout << path(".").filename(); // outputs "."
std::cout << path("..").filename(); // outputs ".."so for these cases the assertion passes.
SplitWalletPath() garanties the walletFile is a plain filename without a directory.
276a674 to
8d0add4
Compare
|
@promag thank you for your review. Your comments have been addressed:
|
|
utACK 8d0add4. |
Boost Filesystem basename() function is deprecated since v1.36.0. Also, defining BOOST_FILESYSTEM_NO_DEPRECATED before including filesystem headers is strongly recommended. This prevents inadvertent use of old features, particularly legacy function names, that have been replaced and are going to go away in the future.
8d0add4 to
a0a222e
Compare
ryanofsky
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.
utACK a0a222e. Only change is dropping assert and squashing first two commits.
|
utACK a0a222e |
|
utACK a0a222e |
|
utACK a0a222e |
…m functions a0a222e Replace deprecated Boost Filesystem function (Hennadii Stepanov) 4f65af9 Remove dead code for walletFile check (Hennadii Stepanov) Pull request description: Boost Filesystem `basename()` and `extension()` functions are [deprecated since v1.36.0](https://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/reference.html#Convenience-functions). See more: https://lists.boost.org/Archives/boost/2010/01/160905.php Also this PR prevents further use of deprecated Boost Filesystem functions. Ref: https://www.boost.org/doc/libs/1_64_0/libs/filesystem/doc/index.htm#Coding-guidelines Note: On my Linux system Boost 1.65.1 header `/usr/include/boost/filesystem/convenience.hpp` contains: ```c++ # ifndef BOOST_FILESYSTEM_NO_DEPRECATED inline std::string extension(const path & p) { return p.extension().string(); } inline std::string basename(const path & p) { return p.stem().string(); } inline path change_extension( const path & p, const path & new_extension ) { path new_p( p ); new_p.replace_extension( new_extension ); return new_p; } # endif ``` UPDATE: Also removed unused code as [noted](#15880 (comment)) by **ryanofsky**. ACKs for commit a0a222: Empact: utACK a0a222e practicalswift: utACK a0a222e fanquake: utACK a0a222e ryanofsky: utACK a0a222e. Only change is dropping assert and squashing first two commits. Tree-SHA512: bc54355441c49957507eb8d3a5782b92d65674504d69779bc16b1b997b2e7424d5665eb6bfb6e10b430a6cacd2aca70af2f94e5f7f10bea24624202834ad35c7
…lesystem functions a0a222e Replace deprecated Boost Filesystem function (Hennadii Stepanov) 4f65af9 Remove dead code for walletFile check (Hennadii Stepanov) Pull request description: Boost Filesystem `basename()` and `extension()` functions are [deprecated since v1.36.0](https://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/reference.html#Convenience-functions). See more: https://lists.boost.org/Archives/boost/2010/01/160905.php Also this PR prevents further use of deprecated Boost Filesystem functions. Ref: https://www.boost.org/doc/libs/1_64_0/libs/filesystem/doc/index.htm#Coding-guidelines Note: On my Linux system Boost 1.65.1 header `/usr/include/boost/filesystem/convenience.hpp` contains: ```c++ # ifndef BOOST_FILESYSTEM_NO_DEPRECATED inline std::string extension(const path & p) { return p.extension().string(); } inline std::string basename(const path & p) { return p.stem().string(); } inline path change_extension( const path & p, const path & new_extension ) { path new_p( p ); new_p.replace_extension( new_extension ); return new_p; } # endif ``` UPDATE: Also removed unused code as [noted](bitcoin#15880 (comment)) by **ryanofsky**. ACKs for commit a0a222: Empact: utACK bitcoin@a0a222e practicalswift: utACK a0a222e fanquake: utACK a0a222e ryanofsky: utACK a0a222e. Only change is dropping assert and squashing first two commits. Tree-SHA512: bc54355441c49957507eb8d3a5782b92d65674504d69779bc16b1b997b2e7424d5665eb6bfb6e10b430a6cacd2aca70af2f94e5f7f10bea24624202834ad35c7
…stem functions Summary: Replace deprecated Boost Filesystem function (Hennadii Stepanov) Remove dead code for walletFile check (Hennadii Stepanov) Pull request description: Boost Filesystem `basename()` and `extension()` functions are [deprecated since v1.36.0](https://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/reference.html#Convenience-functions). See more: https://lists.boost.org/Archives/boost/2010/01/160905.php Also this PR prevents further use of deprecated Boost Filesystem functions. Ref: https://www.boost.org/doc/libs/1_64_0/libs/filesystem/doc/index.htm#Coding-guidelines Note: On my Linux system Boost 1.65.1 header `/usr/include/boost/filesystem/convenience.hpp` contains: ```c++ # ifndef BOOST_FILESYSTEM_NO_DEPRECATED inline std::string extension(const path & p) { return p.extension().string(); } inline std::string basename(const path & p) { return p.stem().string(); } inline path change_extension( const path & p, const path & new_extension ) { path new_p( p ); new_p.replace_extension( new_extension ); return new_p; } # endif ``` UPDATE: Also removed unused code as [noted](bitcoin/bitcoin#15880 (comment)) by **ryanofsky**. --- Backport of Core [[bitcoin/bitcoin#15880 | PR15880]] and [[bitcoin/bitcoin#17654 | PR17654]] (to unbreak PR15880) Test Plan: ninja check check-functional Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D7362
…lesystem functions a0a222e Replace deprecated Boost Filesystem function (Hennadii Stepanov) 4f65af9 Remove dead code for walletFile check (Hennadii Stepanov) Pull request description: Boost Filesystem `basename()` and `extension()` functions are [deprecated since v1.36.0](https://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/reference.html#Convenience-functions). See more: https://lists.boost.org/Archives/boost/2010/01/160905.php Also this PR prevents further use of deprecated Boost Filesystem functions. Ref: https://www.boost.org/doc/libs/1_64_0/libs/filesystem/doc/index.htm#Coding-guidelines Note: On my Linux system Boost 1.65.1 header `/usr/include/boost/filesystem/convenience.hpp` contains: ```c++ # ifndef BOOST_FILESYSTEM_NO_DEPRECATED inline std::string extension(const path & p) { return p.extension().string(); } inline std::string basename(const path & p) { return p.stem().string(); } inline path change_extension( const path & p, const path & new_extension ) { path new_p( p ); new_p.replace_extension( new_extension ); return new_p; } # endif ``` UPDATE: Also removed unused code as [noted](bitcoin#15880 (comment)) by **ryanofsky**. ACKs for commit a0a222: Empact: utACK bitcoin@a0a222e practicalswift: utACK a0a222e fanquake: utACK a0a222e ryanofsky: utACK a0a222e. Only change is dropping assert and squashing first two commits. Tree-SHA512: bc54355441c49957507eb8d3a5782b92d65674504d69779bc16b1b997b2e7424d5665eb6bfb6e10b430a6cacd2aca70af2f94e5f7f10bea24624202834ad35c7
…lesystem functions a0a222e Replace deprecated Boost Filesystem function (Hennadii Stepanov) 4f65af9 Remove dead code for walletFile check (Hennadii Stepanov) Pull request description: Boost Filesystem `basename()` and `extension()` functions are [deprecated since v1.36.0](https://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/reference.html#Convenience-functions). See more: https://lists.boost.org/Archives/boost/2010/01/160905.php Also this PR prevents further use of deprecated Boost Filesystem functions. Ref: https://www.boost.org/doc/libs/1_64_0/libs/filesystem/doc/index.htm#Coding-guidelines Note: On my Linux system Boost 1.65.1 header `/usr/include/boost/filesystem/convenience.hpp` contains: ```c++ # ifndef BOOST_FILESYSTEM_NO_DEPRECATED inline std::string extension(const path & p) { return p.extension().string(); } inline std::string basename(const path & p) { return p.stem().string(); } inline path change_extension( const path & p, const path & new_extension ) { path new_p( p ); new_p.replace_extension( new_extension ); return new_p; } # endif ``` UPDATE: Also removed unused code as [noted](bitcoin#15880 (comment)) by **ryanofsky**. ACKs for commit a0a222: Empact: utACK bitcoin@a0a222e practicalswift: utACK a0a222e fanquake: utACK a0a222e ryanofsky: utACK a0a222e. Only change is dropping assert and squashing first two commits. Tree-SHA512: bc54355441c49957507eb8d3a5782b92d65674504d69779bc16b1b997b2e7424d5665eb6bfb6e10b430a6cacd2aca70af2f94e5f7f10bea24624202834ad35c7
Boost Filesystem
basename()andextension()functions are deprecated since v1.36.0.See more: https://lists.boost.org/Archives/boost/2010/01/160905.php
Also this PR prevents further use of deprecated Boost Filesystem functions.
Ref: https://www.boost.org/doc/libs/1_64_0/libs/filesystem/doc/index.htm#Coding-guidelines
Note: On my Linux system Boost 1.65.1 header
/usr/include/boost/filesystem/convenience.hppcontains:UPDATE:
Also removed unused code as noted by ryanofsky.