wallet: Fix detection of symlinks on Windows #34603

pull achow101 wants to merge 14 commits into bitcoin:master from achow101:fix-listwallet-recursion-detect-symlinks changing 7 files +218 −139
  1. achow101 commented at 0:34 am on February 17, 2026: member

    This PR implements symlink detection for Windows, since GCC doesn’t support symlinks on Windows. This is used by the wallet’s ListDatabases in order to detect symlinks and avoid recursing them. It’s also used in wallet path validation since that is also checking whether paths are symlinks, and we should properly detect symlinks on Windows.

    Under the hood, the IsSymlink function uses std::filesystem::is_symlink for non-Windows systems. On Windows, it checks a file’s attributes to determine if it is a reparse point. Strictly speaking, this will also catch files that aren’t symlinks, such as directories that are Onedrive mounts. I think it’s fine to not be recursively searching such directories.

    This is based on #34418 for the multiwallet test and CI changes that it enables. The last commit also removes the skipping of the symlink checks so that we are testing that the symlink handling behavior on Windows matches that on Linux and MacOS.

  2. refactor(qa): Remove unused option
    Last use was removed in 0d32d661481f099af572e7a08a50e17bcc165c44.
    268b2ae5ee
  3. scripted-diff: self.nodes[0] => node
    -BEGIN VERIFY SCRIPT-
    sed --in-place 's/self\.nodes\[0\]/node/g; s/node \= node/node \= self\.nodes\[0\]/' ./test/functional/wallet_multiwallet.py
    -END VERIFY SCRIPT-
    57d53e1918
  4. refactor(qa): Lift out functions to outer scopes
    This prepares for later breaking apart of run_test().
    
    Note that the "wallet" lambda was renamed to "get_wallet" since otherwise the Python interpreter emitted:
    "UnboundLocalError: cannot access local variable 'wallet' where it is not associated with a value"
    e071b7997b
  5. move-only(qa): Move wallet creation check down to others
    Makes the functions broken out from run_test() in the next commit more cohesive.
    b0ced9eab4
  6. refactor(qa): Break apart ginormous run_test() 91fc42ebdc
  7. qa: Check for platform-independent part of error message
    On Windows one gets different exception messages depending on whether running a native build or cross build.
    9c67d88e71
  8. qa: Test scanning errors individually
    This change ensures that each condition potentially triggering the
    "Error while scanning" log message is tested independently, avoiding
    false positives.
    
    Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
    149df598cc
  9. qa: Disable parts of the test when running under Windows or root
    test_scanning_sub_dir():
    - Remove try/finally - we don't need to clean up after a failed test (done in this commit to maintain indentation).
    
    Regarding symlinks: https://github.com/bitcoin/bitcoin/pull/31410#issuecomment-3554721014
    
    Co-authored-by: Ava Chow <github@achow101.com>
    7d542ad0fd
  10. ci: Enable `wallet_multiwallet.py` in "Windows, test cross-built" job
    Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
    956e3e2162
  11. qa: Avoid duplicating output in case the diff is the same 49a40336e3
  12. DrahtBot added the label Wallet on Feb 17, 2026
  13. DrahtBot commented at 0:35 am on February 17, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    LLM Linter (✨ experimental)

    Possible typos and grammar issues:

    • windows -> Windows [proper noun should be capitalized]
    • explicilty -> explicitly [spelling error]

    2026-02-17 03:01:05

  14. DrahtBot added the label CI failed on Feb 17, 2026
  15. fs: Add IsSymlink which can check for Windows symlinks
    GCC lacks detection of symlinks on Windows. IsSymlink implements this
    detection on Windows, and utilizes std::filesystem::is_symlink for other
    systems.
    f507a31eec
  16. wallet: Use IsSymlink to detect symlinks and disable recursing them
    When searching the wallets directory for wallets, we want to avoid
    recursing symlinks. Although recursive_directory_iterator already
    doesn't recurse symlinks, since GCC doesn't implement symlink detection
    on Windows, we need to use IsSymlink to detect symlinks on Windows in
    order to avoid recursing them.
    202df36b80
  17. wallet: Detect Windows symlinks in GetWalletPath
    Since GCC lacks symlink detection, we need to use IsSymlink to detect
    symlinks on Windows. Additionally, symlinks to files are reported as
    being regular files rather symlnks, so we need to explicitly check with
    IsSymlink that a regular file is not actually a symlink.
    64cc644a73
  18. test: Test multiwallet symlinks on Windows 677297e852
  19. achow101 force-pushed on Feb 17, 2026

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-02-17 06:13 UTC

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