1 minor finding · 3 suggestions
Earlier concerns neither republished nor resolved: 1 minor finding. See the Run archive for their assessments.
Findings
[minor] · Top-level BDB symlinks appear in wallet lists but cannot be migrated on MinGW
On MinGW builds, a top-level symlink to a legacy BDB file can be listed and offered for migration, but migratewallet rejects it; wallet data is unaffected.
Location: src/wallet/db.cpp:34 (head).
Details and suggested fix
On MinGW builds using libstdc++, symlink_status follows links, so a top-level symlink to a BDB data file not named wallet.dat can report as a regular file. The symlink check at line 34 disables recursion but does not exclude the entry from the depth-zero branch at line 47. That branch follows the link through IsBDBFile and lists the alias as a BDB wallet. listwalletdir marks it for migration, and the GUI offers it in the Migrate Wallet menu, but MigrateLegacyToDescriptor then fails because GetWalletPath rejects the symlink as an invalid -wallet path. Before this change, MinGW builds both listed and accepted the alias. On POSIX and MSVC, symlink_status reports it as a symlink, so it is neither listed nor accepted. Keep the result of the line-34 check and exclude symlinks from the line-47 condition so discovery and validation agree. No checked-in code creates top-level symlinks to BDB files, so the production frequency is unconfirmed.
Optional improvements
[suggestion] · Wallet-path validation rejects some Windows reparse-point data files
On Windows, top-level data-file wallets on deduplicated, WOF-compressed, or similar storage can no longer be loaded, migrated, or dumped; whether this restriction is intended is unclear.
Location: src/wallet/wallet.cpp:2974 (head).
Details and suggested fix
IsSymlink returns true for any FILE_ATTRIBUTE_REPARSE_POINT. The new !IsSymlink(wallet_path) condition therefore rejects case 4 of GetWalletPath: a backward-compatible name for an existing data file in -walletdir. This affects loadwallet and -wallet, migratewallet, and bitcoin-wallet commands such as dump. Directory wallets are unaffected because they pass the directory branch. The PR description justifies the broad predicate for skipping recursion, while the added comment describes detecting a regular file that is actually a symlink. On MSVC builds, symlink_status already identifies real file symlinks, so this condition can reject files that are not symlinks. Data Deduplication and WOF compression attach reparse tags to ordinary files; cloud-file placeholders may also have the attribute, depending on placeholder compatibility mode. If these files should remain loadable, retain the broad check for recursion and use a tag-aware check here, such as IO_REPARSE_TAG_SYMLINK from FindFirstFileW's dwReserved0. Otherwise, document the restriction. No checked-in code creates such wallet files, so the compatibility impact is unconfirmed.
[suggestion] · Windows attribute lookup failures lose the underlying OS error
When a wallet-directory scan cannot read file attributes on Windows, its warning reports “Invalid argument” instead of the actual error, such as access denied.
Location: src/util/fs_helpers.cpp:352 (head).
Details and suggested fix
When GetFileAttributesW fails, IsSymlink throws a filesystem_error using std::errc::invalid_argument, losing the value of GetLastError(). ListDatabases calls IsSymlink for each Windows directory entry before status(), so lookup failures reach the catch at db.cpp:64–66 and are logged as “Invalid argument” regardless of the cause. Capture GetLastError() immediately after the failed call and construct the error code with std::system_category(). Pass path itself to filesystem_error rather than fs::PathToString(path), which converts the UTF-8 string back through std::filesystem::path using the current code page on Windows. The existing throw-and-skip behavior can remain.
[suggestion] · Wallet scans warn about supported symlinked wallet directories
Every wallet listing adds a warning-level debug.log line for supported symlinked wallet directories, including when the GUI wallet menus are opened.
Location: src/wallet/db.cpp:35 (head).
Details and suggested fix
The new LogWarning runs for every symlink entry on every ListDatabases call, including a symlink to a wallet directory, which GetWalletPath documents as valid and the functional test exercises. On POSIX, the recursive directory iterator already does not follow directory symlinks by default, so the only change there is the warning. ListDatabases runs for each listwalletdir call and whenever the GUI Open Wallet or Migrate Wallet menu is shown. Developer notes reserve LogWarning for severe problems that administrators should address, while skipping recursion here is expected behavior. Keep it.disable_recursion_pending(), but use LogDebug(BCLog::WALLETDB, ...) or remove the message.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [minor]: Check dangling links before accepting missing wallet paths