corrade icon indicating copy to clipboard operation
corrade copied to clipboard

5 tests fail on FreeBSD

Open yurivict opened this issue 1 year ago • 2 comments

Here is the log.

clang-18 FreeBSD 14.1

yurivict avatar Nov 09 '24 07:11 yurivict

Tough problems, huh.

The PluginManager error is because I assume the tests get run under root, and the root's home directory isn't /root. I attempted to make that detection more robust with 420bf38848d8038e5b7f8b70c65e4c42f53143e0, hopefully that's enough?

The Pair errors aren't really important, it's just comparing to the std::pair implementation, yet I'd like to know why they happen -- these don't happen on any system or CI I've tried on, and definitely not on Clang / libc++ 18.1.8. I looked into libc++ commit log for any clues, but apart from https://github.com/llvm/llvm-project/commit/f9dd885cb6e6b70deff935689bb0dfb7d5b6a1a4 which is an inverse of this problem. What's the exact clang and libc++ version that's used there? I'm printing that info in 6c64d4c455c47bb427097d0aa062380fb26e2ed7 in case it's easier for you to just re-run the tests.

The GrowableArray failure was an interesting one. I think I understand why it happened, and hopefully the mitigation in b4e667871d9bc1bd89f4743936ecfad3afd20a50 makes it no longer happen. Let me know if it does.

The Path::executableLocation() code is coming from be614b914a1724a2426a2703e9dd4afa89c5de08, which was one of the patches referenced in #171 but I didn't have a followup confirmation that it actually works. I was looking at https://man.freebsd.org/cgi/man.cgi?sysctl(3) but just coudn't find anything about whether the returned size is including the null terminator or excluding, and given that it fails because the returned path contains a \0 I suppose I was wrong in the initial assumption. Can you try the following patch on your end and confirm that it fixes the issue? Thank you.

diff --git a/src/Corrade/Utility/Path.cpp b/src/Corrade/Utility/Path.cpp
index 5bf13da77..76295b53f 100644
--- a/src/Corrade/Utility/Path.cpp
+++ b/src/Corrade/Utility/Path.cpp
@@ -603,13 +603,14 @@ Containers::Optional<Containers::String> executableLocation() {
 
     /* FreeBSD */
     #elif defined(__FreeBSD__)
-    /* Get path size, it's returned excluding the null terminator */
+    /* Get path size. It's returned including the null terminator, thus we have
+       to make the string one byte shorter to not have a second \0 there. */
     std::size_t size;
     constexpr int mib[4]{CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
     sysctl(mib, 4, nullptr, &size, nullptr, 0);
 
     /* Allocate a string of proper size and retreive the path into it */
-    Containers::String path{NoInit, size};
+    Containers::String path{NoInit, size - 1};
     sysctl(mib, 4, path.data(), &size, nullptr, 0);
     return path;
 

mosra avatar Nov 16 '24 13:11 mosra

@yurivict just a reminder in case this fell through in your notifications -- would you have a chance to look at the above and tell me which of the fixes made it work, and which not? Thanks a lot!

mosra avatar Dec 31 '24 13:12 mosra