Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 tests fail on FreeBSD #189

Open
yurivict opened this issue Nov 9, 2024 · 1 comment
Open

5 tests fail on FreeBSD #189

yurivict opened this issue Nov 9, 2024 · 1 comment
Milestone

Comments

@yurivict
Copy link
Contributor

yurivict commented Nov 9, 2024

Here is the log.

clang-18
FreeBSD 14.1

@mosra mosra added this to the 2024.0a milestone Nov 16, 2024
@mosra
Copy link
Owner

mosra commented Nov 16, 2024

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 420bf38, 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 llvm/llvm-project@f9dd885 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 6c64d4c 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 b4e6678 makes it no longer happen. Let me know if it does.

The Path::executableLocation() code is coming from be614b9, 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;
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants