-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Strip any trailing /
in -datadir and -blocksdir paths
#20080
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
So if we could really now use the 1.58 that approach here concept tACK, since i might have choose this also if i was sure we had 1.58 and after the comment from @promag TyI: i still find in the compile cache after
But that's probably just trash form old version compiles? |
You need something like
Yes, it is a cache from your old compiles. |
review ACK de37a1d |
ACK, Could add a test with trailing /? |
I wrote a test when I reviewed this, btw: diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
index 241c56934e..e9f2ba8e13 100644
--- a/src/test/util_tests.cpp
+++ b/src/test/util_tests.cpp
@@ -42,6 +42,17 @@ namespace BCLog {
BOOST_FIXTURE_TEST_SUITE(util_tests, BasicTestingSetup)
+BOOST_AUTO_TEST_CASE(util_datadir)
+{
+ ClearDatadirCache();
+ const fs::path dd_norm = GetDataDir();
+ {
+ gArgs.ForceSetArg("-datadir", dd_norm.string() + "/");
+ ClearDatadirCache();
+ BOOST_CHECK_EQUAL(dd_norm, GetDataDir());
+ }
+}
+
BOOST_AUTO_TEST_CASE(util_check)
{
// Check that Assert can forward It fails on master:
Should pass on this branch. |
Thanks @MarcoFalke! Test added. |
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 b7c5a94.
review ACK b7c5a94 💥 Show signature and timestampSignature:
Timestamp of file with hash |
Updated b7c5a94 -> 3cd0a16 (pr20080.02 -> pr20080.03):
|
Sorry I may be confused about the boost versions that this requires, but if this needs boost 1.58, it can't actually be backported to the branches tagged can it? This works on master but only the alternative #19933 could be backported? |
There is a discussion above. |
Concept ACK While I was testing few things with wallet names on Windows and Ubuntu, I found that user can create wallets with names:
It creates the wallet in |
@prayank23
Good idea for a new pr. |
re-ACK 3cd0a16 , only change is adding even more tests 🦉 Show signature and timestampSignature:
Timestamp of file with hash |
Updated 1c55140 -> ad5cef5 (pr20080.06 -> pr20080.07, diff):
|
review ACK ad5cef5 🔙 Show signature and timestampSignature:
Timestamp of file with hash |
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 ad5cef5.
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 + test run ACK ad5cef5
Github-Pull: bitcoin#20080 Rebased-From: ad5cef5
Added to #20166 for backporting to 0.20. |
7566af4 doc: Update data directory path comments (Hennadii Stepanov) 09261de util: Add StripRedundantLastElementsOfPath function (Hennadii Stepanov) 8ef0dac macOS deploy: use the new plistlib API (Jonas Schnelli) 314e795 build: fix mutex detection when building bdb on macOS (fanquake) 1f67a30 random: fixes read buffer resizing in RandAddSeedPerfmon (Ethan Heilman) 6113b54 net: Send post-verack handshake messages at most once (MarcoFalke) bdf15d0 rpc: Adjust witness-tx deserialize error message (MarcoFalke) 731502a rpc: Properly deserialize txs with witness before signing (MarcoFalke) ee0082b Avoid the use of abs64 in timedata (Pieter Wuille) 05bd0c2 docs: Correct description for getblockstats's txs field (Nadav Ivgi) Pull request description: Backports the following PRs to the 0.20 branch: * #19777 - docs: Correct description for getblockstats's txs field * #19836 - rpc: Properly deserialize txs with witness before signing * #20080 - Strip any trailing `/` in -datadir and -blocksdir paths * #20082 - [bugfix] random: fixes read buffer to use min rather than max * #20141 - Avoid the use of abs64 in timedata * #20146 - net: Send post-verack handshake messages at most once * #20195 - build: fix mutex detection when building bdb on macOS * #20298 - macOS deploy: use the new plistlib API Will add additional commits as they become available. ACKs for top commit: MarcoFalke: review ACK 7566af4 🗡 Tree-SHA512: add6bb978313c12c3e07bc232636ae9d1ab0edd0b816705c5c70eeb1cc04097165fd5e29d60c706886943ceb1f749a422020766b4aa2d23be51e9f839157a4bb
…oot directory d44a261 Fix issues when `walletdir` is root directory (unknown) Pull request description: + Remove one character less from wallet path + After testing lot of random strings with special chars in `wallet_name`, I found that the issue was not related to special characters in the name. Reviewing PR bitcoin/bitcoin#21907 helped me resolve the issue. **Real issue**: If the path mentioned in `walletdir` is a root directory, first character of the wallet name or path is removed **Solution**: `if` statement to check `walletdir` is a root directory Fixes: bitcoin/bitcoin#21510 bitcoin/bitcoin#21501 Related PR: bitcoin/bitcoin#20080 Consider the wallet directories `w1` and `w2` saved in `D:\`. Run `bitcoind.exe -walletdir=D:\`, Results for `bitcoin-cli.exe listwalletdir`: Before this PR: ``` { "wallets": [ { "name": "1" }, { "name": "2" } ] } ``` After this PR: ``` "wallets": [ { "name": "w1" }, { "name": "w2" } ] } ``` ACKs for top commit: ryanofsky: Code review ACK d44a261 meshcollider: utACK d44a261 Tree-SHA512: b09b00f727407e3771c8694861dae1bfd29d97a0d51ddcb5d9c0111dc618b3fff2f75829cbb4361c54457ee564e94fcefd9e2928262a1c918a2b6bbad724eb55
…ctory d44a261 Fix issues when `walletdir` is root directory (unknown) Pull request description: + Remove one character less from wallet path + After testing lot of random strings with special chars in `wallet_name`, I found that the issue was not related to special characters in the name. Reviewing PR bitcoin#21907 helped me resolve the issue. **Real issue**: If the path mentioned in `walletdir` is a root directory, first character of the wallet name or path is removed **Solution**: `if` statement to check `walletdir` is a root directory Fixes: bitcoin#21510 bitcoin#21501 Related PR: bitcoin#20080 Consider the wallet directories `w1` and `w2` saved in `D:\`. Run `bitcoind.exe -walletdir=D:\`, Results for `bitcoin-cli.exe listwalletdir`: Before this PR: ``` { "wallets": [ { "name": "1" }, { "name": "2" } ] } ``` After this PR: ``` "wallets": [ { "name": "w1" }, { "name": "w2" } ] } ``` ACKs for top commit: ryanofsky: Code review ACK d44a261 meshcollider: utACK d44a261 Tree-SHA512: b09b00f727407e3771c8694861dae1bfd29d97a0d51ddcb5d9c0111dc618b3fff2f75829cbb4361c54457ee564e94fcefd9e2928262a1c918a2b6bbad724eb55
Summary: This fixes a bug causing `listwalletdir` to strip lead char of wallet name is datadir has a trailing '/' Co-authored-by: saibato <saibato.naga@pm.me> Co-authored-by: MarcoFalke <falke.marco@gmail.com> This is a backport of [[bitcoin/bitcoin#20080 | core#20080]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10693
…ctory d44a261 Fix issues when `walletdir` is root directory (unknown) Pull request description: + Remove one character less from wallet path + After testing lot of random strings with special chars in `wallet_name`, I found that the issue was not related to special characters in the name. Reviewing PR bitcoin#21907 helped me resolve the issue. **Real issue**: If the path mentioned in `walletdir` is a root directory, first character of the wallet name or path is removed **Solution**: `if` statement to check `walletdir` is a root directory Fixes: bitcoin#21510 bitcoin#21501 Related PR: bitcoin#20080 Consider the wallet directories `w1` and `w2` saved in `D:\`. Run `bitcoind.exe -walletdir=D:\`, Results for `bitcoin-cli.exe listwalletdir`: Before this PR: ``` { "wallets": [ { "name": "1" }, { "name": "2" } ] } ``` After this PR: ``` "wallets": [ { "name": "w1" }, { "name": "w2" } ] } ``` ACKs for top commit: ryanofsky: Code review ACK d44a261 meshcollider: utACK d44a261 Tree-SHA512: b09b00f727407e3771c8694861dae1bfd29d97a0d51ddcb5d9c0111dc618b3fff2f75829cbb4361c54457ee564e94fcefd9e2928262a1c918a2b6bbad724eb55
…ctory d44a261 Fix issues when `walletdir` is root directory (unknown) Pull request description: + Remove one character less from wallet path + After testing lot of random strings with special chars in `wallet_name`, I found that the issue was not related to special characters in the name. Reviewing PR bitcoin#21907 helped me resolve the issue. **Real issue**: If the path mentioned in `walletdir` is a root directory, first character of the wallet name or path is removed **Solution**: `if` statement to check `walletdir` is a root directory Fixes: bitcoin#21510 bitcoin#21501 Related PR: bitcoin#20080 Consider the wallet directories `w1` and `w2` saved in `D:\`. Run `bitcoind.exe -walletdir=D:\`, Results for `bitcoin-cli.exe listwalletdir`: Before this PR: ``` { "wallets": [ { "name": "1" }, { "name": "2" } ] } ``` After this PR: ``` "wallets": [ { "name": "w1" }, { "name": "w2" } ] } ``` ACKs for top commit: ryanofsky: Code review ACK d44a261 meshcollider: utACK d44a261 Tree-SHA512: b09b00f727407e3771c8694861dae1bfd29d97a0d51ddcb5d9c0111dc618b3fff2f75829cbb4361c54457ee564e94fcefd9e2928262a1c918a2b6bbad724eb55
…ctory d44a261 Fix issues when `walletdir` is root directory (unknown) Pull request description: + Remove one character less from wallet path + After testing lot of random strings with special chars in `wallet_name`, I found that the issue was not related to special characters in the name. Reviewing PR bitcoin#21907 helped me resolve the issue. **Real issue**: If the path mentioned in `walletdir` is a root directory, first character of the wallet name or path is removed **Solution**: `if` statement to check `walletdir` is a root directory Fixes: bitcoin#21510 bitcoin#21501 Related PR: bitcoin#20080 Consider the wallet directories `w1` and `w2` saved in `D:\`. Run `bitcoind.exe -walletdir=D:\`, Results for `bitcoin-cli.exe listwalletdir`: Before this PR: ``` { "wallets": [ { "name": "1" }, { "name": "2" } ] } ``` After this PR: ``` "wallets": [ { "name": "w1" }, { "name": "w2" } ] } ``` ACKs for top commit: ryanofsky: Code review ACK d44a261 meshcollider: utACK d44a261 Tree-SHA512: b09b00f727407e3771c8694861dae1bfd29d97a0d51ddcb5d9c0111dc618b3fff2f75829cbb4361c54457ee564e94fcefd9e2928262a1c918a2b6bbad724eb55
…ctory d44a261 Fix issues when `walletdir` is root directory (unknown) Pull request description: + Remove one character less from wallet path + After testing lot of random strings with special chars in `wallet_name`, I found that the issue was not related to special characters in the name. Reviewing PR bitcoin#21907 helped me resolve the issue. **Real issue**: If the path mentioned in `walletdir` is a root directory, first character of the wallet name or path is removed **Solution**: `if` statement to check `walletdir` is a root directory Fixes: bitcoin#21510 bitcoin#21501 Related PR: bitcoin#20080 Consider the wallet directories `w1` and `w2` saved in `D:\`. Run `bitcoind.exe -walletdir=D:\`, Results for `bitcoin-cli.exe listwalletdir`: Before this PR: ``` { "wallets": [ { "name": "1" }, { "name": "2" } ] } ``` After this PR: ``` "wallets": [ { "name": "w1" }, { "name": "w2" } ] } ``` ACKs for top commit: ryanofsky: Code review ACK d44a261 meshcollider: utACK d44a261 Tree-SHA512: b09b00f727407e3771c8694861dae1bfd29d97a0d51ddcb5d9c0111dc618b3fff2f75829cbb4361c54457ee564e94fcefd9e2928262a1c918a2b6bbad724eb55
…ctory d44a261 Fix issues when `walletdir` is root directory (unknown) Pull request description: + Remove one character less from wallet path + After testing lot of random strings with special chars in `wallet_name`, I found that the issue was not related to special characters in the name. Reviewing PR bitcoin#21907 helped me resolve the issue. **Real issue**: If the path mentioned in `walletdir` is a root directory, first character of the wallet name or path is removed **Solution**: `if` statement to check `walletdir` is a root directory Fixes: bitcoin#21510 bitcoin#21501 Related PR: bitcoin#20080 Consider the wallet directories `w1` and `w2` saved in `D:\`. Run `bitcoind.exe -walletdir=D:\`, Results for `bitcoin-cli.exe listwalletdir`: Before this PR: ``` { "wallets": [ { "name": "1" }, { "name": "2" } ] } ``` After this PR: ``` "wallets": [ { "name": "w1" }, { "name": "w2" } ] } ``` ACKs for top commit: ryanofsky: Code review ACK d44a261 meshcollider: utACK d44a261 Tree-SHA512: b09b00f727407e3771c8694861dae1bfd29d97a0d51ddcb5d9c0111dc618b3fff2f75829cbb4361c54457ee564e94fcefd9e2928262a1c918a2b6bbad724eb55
Wallet names in
listwalletdir
RPC are correct now, even if the-datadir
path has any number of trailing/
.This PR is an alternative to #19933.
Fixes #19928.