Sometimes wallet filenames can get their first character stripped off #19928

issue luke-jr openend this issue on September 9, 2020
  1. luke-jr commented at 6:57 pm on September 9, 2020: member
  2. luke-jr added the label Bug on Sep 9, 2020
  3. Saibato commented at 12:42 pm on September 10, 2020: contributor

    I can confirm and reproduce the bug @2btc10000pizzas and @RawMaterialNYC reported; if we have no wallets dir in conf and datadir is configed by the users with trailing ‘/’ that would strip leading char from walletnames.

    The first char will be striped with in rpc listwallletdir call and in qt gui.

    A possible fix if we have boost > 1.60 might be PR https://github.com/bitcoin/bitcoin/commit/2682e7b186b55a987952778e7635d475a63034ed

     0diff --git a/src/wallet/walletutil.cpp b/src/wallet/walletutil.cpp
     1index e4c72aed9..78a7a82d8 100644
     2--- a/src/wallet/walletutil.cpp
     3+++ b/src/wallet/walletutil.cpp
     4@@ -57,7 +57,6 @@ bool IsBerkeleyBtree(const fs::path& path)
     5 std::vector<fs::path> ListWalletDir()
     6 {
     7     const fs::path wallet_dir = GetWalletDir();
     8-    const size_t offset = wallet_dir.string().size() + 1;
     9     std::vector<fs::path> paths;
    10     boost::system::error_code ec;
    11 
    12@@ -68,8 +67,8 @@ std::vector<fs::path> ListWalletDir()
    13         }
    14 
    15         // Get wallet path relative to walletdir by removing walletdir from the wallet path.
    16-        // This can be replaced by boost::filesystem::lexically_relative once boost is bumped to 1.60.
    17-        const fs::path path = it->path().string().substr(offset);
    18+
    19+        const fs::path path = fs::relative(it->path(), wallet_dir);
    20 
    21         if (it->status().type() == fs::directory_file && IsBerkeleyBtree(it->path() / "wallet.dat")) {
    22             // Found a directory which contains wallet.dat btree file, add it as a wallet.
    
  4. hebasto commented at 6:31 pm on October 4, 2020: member
    @luke-jr @Saibato mind looking into #20080?
  5. meshcollider closed this on Nov 1, 2020

  6. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me