ipc, refactor: use native path separators in test
What changed, and why it matters
This is a small test-only cleanup that changes hardcoded Unix-style forward slashes in a test file to use the operating system's native path separator. It does not change any production code or fix a security bug.
No security action needed; this is a routine portability/refactoring change in test code.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies src/ipc/test/ipc_tests.cpp to replace hardcoded ‘/var/empty/notexist/’ paths with a datadir-derived prefix using fs::PathToString(datadir / ‘’). This makes the ParseAddress unit test portable on Windows by using native path separators. No production IPC parsing logic is changed.
Changed components
src/ipc/test/ipc_tests.cppInspect captured patch +6 / −5
diff --git a/src/ipc/test/ipc_tests.cpp b/src/ipc/test/ipc_tests.cpp
index 75b9544a..08f2aa06 100644
--- a/src/ipc/test/ipc_tests.cpp
+++ b/src/ipc/test/ipc_tests.cpp
@@ -216,12 +216,13 @@ BOOST_AUTO_TEST_CASE(parse_address_test)
}
BOOST_CHECK_EQUAL(address, expect_address);
}};
- check_address("unix", "unix:/var/empty/notexist/test_bitcoin.sock", "");
- check_address("unix:", "unix:/var/empty/notexist/test_bitcoin.sock", "");
- check_address("unix:path.sock", "unix:/var/empty/notexist/path.sock", "");
+ std::string prefix{fs::PathToString(datadir / "")};
+ check_address("unix", "unix:" + prefix + "test_bitcoin.sock", "");
+ check_address("unix:", "unix:" + prefix + "test_bitcoin.sock", "");
+ check_address("unix:path.sock", "unix:" + prefix + "path.sock", "");
check_address("unix:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock",
- "unix:/var/empty/notexist/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock",
- "Unix address path \"/var/empty/notexist/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock\" exceeded maximum socket path length");
+ "unix:" + prefix + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock",
+ "Unix address path \"" + prefix + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock\" exceeded maximum socket path length");
check_address("invalid", "invalid", "Unrecognized address 'invalid'");
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.