Skip to content

Commit 50dfbab

Browse files
rousskovsquid-anubis
authored andcommitted
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].
1 parent dd4a733 commit 50dfbab

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/tests/stub_Instance.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@
88

99
#include "squid.h"
1010
#include "Instance.h"
11-
#include "sbuf/SBuf.h"
11+
#include "sbuf/Stream.h"
1212

1313
#define STUB_API "Instance.cc"
1414
#include "tests/STUB.h"
1515

1616
void Instance::ThrowIfAlreadyRunning() STUB
1717
void Instance::WriteOurPid() STUB
1818
pid_t Instance::Other() STUB_RETVAL({})
19-
SBuf Instance::NamePrefix(const char *, const char *) STUB_RETVAL_NOP(SBuf("squid-0"))
2019

20+
// Return what Instance.cc NamePrefix() would return using default service_name
21+
// and no pid_filename hash value. XXX: Mimicking pid_filename hashing triggers
22+
// ENAMETOOLONG errors on MacOS due to 31-character PSHMNAMLEN limit. We want to
23+
// use "squid-0000" here, but even `/squid-0-tr_rebuild_versions.shm` is one
24+
// character too long! The same limit also affects some Instance.cc NamePrefix()
25+
// callers -- Squid SMP caching support on MacOS is incomplete.
26+
SBuf Instance::NamePrefix(const char * const head, const char * const tail) STUB_RETVAL_NOP(ToSBuf(head, "squid", (tail ? tail : "")))

0 commit comments

Comments
 (0)