wallet: Avoid logging no_such_file_or_directory error #15917

pull promag wants to merge 1 commits into bitcoin:master from promag:2019-04-fix-15912 changing 1 files +2 −0
  1. promag commented at 11:12 PM on April 28, 2019: member

    Avoid logging IsBerkeleyBtree: No such file or directory .... The result of IsBerkeleyBtree is the same since fs::file_size() returns 0 for non existent files.

    Fix #15912.

  2. wallet: Avoid logging no_such_file_or_directory error 70c1cf8c1c
  3. fanquake added the label Wallet on Apr 28, 2019
  4. practicalswift commented at 7:03 AM on April 29, 2019: contributor

    utACK 70c1cf8c1c07091544d060191715027282e87b57

  5. jonasschnelli commented at 7:09 AM on April 29, 2019: contributor

    utACK 70c1cf8c1c07091544d060191715027282e87b57

  6. MarcoFalke merged this on Apr 29, 2019
  7. MarcoFalke closed this on Apr 29, 2019

  8. MarcoFalke referenced this in commit 150be1c7b3 on Apr 29, 2019
  9. in src/wallet/walletutil.cpp:34 in 70c1cf8c1c
      30 | @@ -31,6 +31,8 @@ fs::path GetWalletDir()
      31 |  
      32 |  static bool IsBerkeleyBtree(const fs::path& path)
      33 |  {
      34 | +    if (!fs::exists(path)) return false;
    


    ryanofsky commented at 2:48 PM on April 29, 2019:

    I don't understand this fix. When is this condition expected? Why not just drop the log statement entirely if we don't care about these errors?


    ryanofsky commented at 2:55 PM on April 29, 2019:

    If this behavior actually does make sense, a more readable and efficient way to implement it would be to drop this new access and change:

    -if (ec) LogPrintf(...)
    +if (ec && ec != errc::no_such_file_or_directory) LogPrintf(...)
    

    below


    promag commented at 3:21 PM on April 29, 2019:

    It happens here:

    https://github.com/bitcoin/bitcoin/blob/8da1aa471eb9f062c99c3134d6151961619e9da5/src/wallet/walletutil.cpp#L74

    when it->path() == "... /regtest/wallets/database".

    If this behavior actually does make sense, a more readable and efficient way to implement it would be to drop this new access and change:

    I had like that but though early checking is more clear.

    I also had the check in L74:

    if (it->status().type() == fs::directory_file && fs::exists(it->path() / "wallet.dat") && IsBerkeleyBtree(it->path() / "wallet.dat")) {
    

    But figure out IsBerkeleyBtree could early return false when the path doesn't exists.

  10. promag deleted the branch on Apr 29, 2019
  11. deadalnix referenced this in commit 8ac51748d6 on Sep 4, 2020
  12. PastaPastaPasta referenced this in commit dc8079eaf0 on Sep 11, 2021
  13. PastaPastaPasta referenced this in commit 17d4be6707 on Sep 11, 2021
  14. PastaPastaPasta referenced this in commit f1520278ed on Sep 12, 2021
  15. DrahtBot locked this on Dec 16, 2021

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: 2026-04-13 18:14 UTC

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