From: Alex Rousskov Date: Thu, 25 Dec 2025 11:28:42 +0000 (+0000) Subject: Bug 5528: tests/testRock fails on Solaris (#2324) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50dfbab286077270faa7327985e4e8b094c44331;p=thirdparty%2Fsquid.git Bug 5528: tests/testRock fails on Solaris (#2324) with stub time| FATAL: Ipc::Mem::Segment::create failed to shm_open(squid-0-tr_rebuild_stats.shm): (22) Invalid argument Instance::NamePrefix() stub implementation ignored `head` and `tail` arguments, resulting in malformed shared memory segment names on Solaris. Other tested OSes tolerate the lack of a leading "/" character. Linux shm_open(3) recommends "/somename" format "for portable use". Simply adding `head` and `tail` to `NamePrefix()` result fixes tests on Solaris but breaks tests on MacOS. We shortened the result (by removing pid_filename hash component mimicking) to avoid that breakage and detailed the problem in a C++ comment. More work is needed to replace human-friendly name components with shorter hashes [on MacOS]. --- diff --git a/src/tests/stub_Instance.cc b/src/tests/stub_Instance.cc index 72fa443065..7a21e08fab 100644 --- a/src/tests/stub_Instance.cc +++ b/src/tests/stub_Instance.cc @@ -8,7 +8,7 @@ #include "squid.h" #include "Instance.h" -#include "sbuf/SBuf.h" +#include "sbuf/Stream.h" #define STUB_API "Instance.cc" #include "tests/STUB.h" @@ -16,5 +16,11 @@ void Instance::ThrowIfAlreadyRunning() STUB void Instance::WriteOurPid() STUB pid_t Instance::Other() STUB_RETVAL({}) -SBuf Instance::NamePrefix(const char *, const char *) STUB_RETVAL_NOP(SBuf("squid-0")) +// Return what Instance.cc NamePrefix() would return using default service_name +// and no pid_filename hash value. XXX: Mimicking pid_filename hashing triggers +// ENAMETOOLONG errors on MacOS due to 31-character PSHMNAMLEN limit. We want to +// use "squid-0000" here, but even `/squid-0-tr_rebuild_versions.shm` is one +// character too long! The same limit also affects some Instance.cc NamePrefix() +// callers -- Squid SMP caching support on MacOS is incomplete. +SBuf Instance::NamePrefix(const char * const head, const char * const tail) STUB_RETVAL_NOP(ToSBuf(head, "squid", (tail ? tail : "")))