Compare commits

..

8 Commits

Author SHA1 Message Date
Ruoyu Zhong
77bcc73ebb Makefile: correctly handle version suffixes on macOS
On macOS, the version suffix of a shared library comes before the
`.dylib` suffix, which is different from the convention on other
systems. Currently, the Makefile only overrides `DYLIB_MINOR_NAME` for
macOS, but does not handle the other similar variables, namely
`DYLIB_MAJOR_NAME`, `SSL_DYLIB_MINOR_NAME`, and `SSL_DYLIB_MAJOR_NAME`.

This commit fixes the issue by overriding all these variables for macOS.

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2025-02-10 14:10:17 -08:00
Cristian Rodríguez
ab8c75ebcb Do not explicitly initialize openSSL in newer versions 2025-02-05 08:39:58 -08:00
David W. Dougherty
8d8703ee61 Update old link for modules-api-ref.md 2024-11-04 09:20:07 -08:00
Orion Poplawski
e0f48202aa Make test.sh use REDIS_SERVER everywhere 2024-08-27 18:45:18 -07:00
michael-grunder
329346bb64 Test for both EAGAIN and EINPROGRESS for AF_UNIX sockets.
Reading the manpage it seems like we only need to test for `EAGAIN` but
testing for both seems more prudent since this may be subtly different
on more esoteric kernels (SunOS, AIX, BSD, etc).

Fixes #1260
2024-08-21 08:56:21 -07:00
michael-grunder
0c63e3f396 Fix timing based macOS CI failure.
Signed-off-by: michael-grunder <michael.grunder@gmail.com>
2024-08-13 08:03:06 -07:00
michael-grunder
45b7820dc3 CentOS 7 is EOL
CentOS 7 reached EOL of even maintinance updates on 2024-06-30.
2024-08-06 14:14:19 -07:00
michael-grunder
643dddafab Clarify macos adapter and example license.
Fixes #1271
2024-08-06 14:11:56 -07:00
7 changed files with 11 additions and 48 deletions

View File

@ -37,42 +37,6 @@ jobs:
# TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full # TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
# run: $GITHUB_WORKSPACE/test.sh # run: $GITHUB_WORKSPACE/test.sh
centos7:
name: CentOS 7
runs-on: ubuntu-latest
container: centos:7
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y --enablerepo=remi install redis
yum -y install gcc gcc-c++ make openssl openssl-devel cmake3 valgrind libevent-devel
- name: Build using cmake
env:
EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON -DENABLE_SSL_TESTS:BOOL=ON -DENABLE_ASYNC_TESTS:BOOL=ON
CFLAGS: -Werror
CXXFLAGS: -Werror
run: mkdir build && cd build && cmake3 .. && make
- name: Build using Makefile
run: USE_SSL=1 TEST_ASYNC=1 make
- name: Run tests
env:
SKIPS_AS_FAILS: 1
TEST_SSL: 1
run: $GITHUB_WORKSPACE/test.sh
- name: Run tests under valgrind
env:
SKIPS_AS_FAILS: 1
TEST_SSL: 1
TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
run: $GITHUB_WORKSPACE/test.sh
centos8: centos8:
name: RockyLinux 8 name: RockyLinux 8
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -141,7 +141,10 @@ endif
ifeq ($(uname_S),Darwin) ifeq ($(uname_S),Darwin)
DYLIBSUFFIX=dylib DYLIBSUFFIX=dylib
DYLIB_MINOR_NAME=$(LIBNAME).$(HIREDIS_SONAME).$(DYLIBSUFFIX) DYLIB_MINOR_NAME=$(LIBNAME).$(HIREDIS_SONAME).$(DYLIBSUFFIX)
DYLIB_MAJOR_NAME=$(LIBNAME).$(HIREDIS_MAJOR).$(DYLIBSUFFIX)
DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS) DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS)
SSL_DYLIB_MINOR_NAME=$(SSL_LIBNAME).$(HIREDIS_SONAME).$(DYLIBSUFFIX)
SSL_DYLIB_MAJOR_NAME=$(SSL_LIBNAME).$(HIREDIS_MAJOR).$(DYLIBSUFFIX)
SSL_DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(SSL_DYLIB_MINOR_NAME) -o $(SSL_DYLIBNAME) $(LDFLAGS) $(SSL_LDFLAGS) SSL_DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(SSL_DYLIB_MINOR_NAME) -o $(SSL_DYLIBNAME) $(LDFLAGS) $(SSL_LDFLAGS)
DYLIB_PLUGIN=-Wl,-undefined -Wl,dynamic_lookup DYLIB_PLUGIN=-Wl,-undefined -Wl,dynamic_lookup
endif endif

View File

@ -478,7 +478,7 @@ static int __redisGetSubscribeCallback(redisAsyncContext *ac, redisReply *reply,
/* Match reply with the expected format of a pushed message. /* Match reply with the expected format of a pushed message.
* The type and number of elements (3 to 4) are specified at: * The type and number of elements (3 to 4) are specified at:
* https://redis.io/topics/pubsub#format-of-pushed-messages */ * https://redis.io/docs/latest/develop/interact/pubsub/#format-of-pushed-messages */
if ((reply->type == REDIS_REPLY_ARRAY && !(c->flags & REDIS_SUPPORTS_PUSH) && reply->elements >= 3) || if ((reply->type == REDIS_REPLY_ARRAY && !(c->flags & REDIS_SUPPORTS_PUSH) && reply->elements >= 3) ||
reply->type == REDIS_REPLY_PUSH) { reply->type == REDIS_REPLY_PUSH) {
assert(reply->element[0]->type == REDIS_REPLY_STRING); assert(reply->element[0]->type == REDIS_REPLY_STRING);

2
net.c
View File

@ -668,7 +668,7 @@ int redisContextConnectUnix(redisContext *c, const char *path, const struct time
sa->sun_family = AF_UNIX; sa->sun_family = AF_UNIX;
strncpy(sa->sun_path, path, sizeof(sa->sun_path) - 1); strncpy(sa->sun_path, path, sizeof(sa->sun_path) - 1);
if (connect(c->fd, (struct sockaddr*)sa, sizeof(*sa)) == -1) { if (connect(c->fd, (struct sockaddr*)sa, sizeof(*sa)) == -1) {
if (errno == EINPROGRESS && !blocking) { if ((errno == EAGAIN || errno == EINPROGRESS) && !blocking) {
/* This is ok. */ /* This is ok. */
} else { } else {
if (redisContextWaitReady(c,timeout_msec) != REDIS_OK) if (redisContextWaitReady(c,timeout_msec) != REDIS_OK)

2
ssl.c
View File

@ -167,8 +167,8 @@ static int initOpensslLocks(void) {
int redisInitOpenSSL(void) int redisInitOpenSSL(void)
{ {
SSL_library_init();
#ifdef HIREDIS_USE_CRYPTO_LOCKS #ifdef HIREDIS_USE_CRYPTO_LOCKS
SSL_library_init();
initOpensslLocks(); initOpensslLocks();
#endif #endif

10
test.c
View File

@ -1276,15 +1276,13 @@ static void test_blocking_connection_timeouts(struct config config) {
redisContext *c; redisContext *c;
redisReply *reply; redisReply *reply;
ssize_t s; ssize_t s;
const char *sleep_cmd = "DEBUG SLEEP 3\r\n"; const char *sleep_cmd = "DEBUG SLEEP 1\r\n";
struct timeval tv; struct timeval tv = {.tv_sec = 0, .tv_usec = 10000};
c = do_connect(config); c = do_connect(config);
test("Successfully completes a command when the timeout is not exceeded: "); test("Successfully completes a command when the timeout is not exceeded: ");
reply = redisCommand(c,"SET foo fast"); reply = redisCommand(c,"SET foo fast");
freeReplyObject(reply); freeReplyObject(reply);
tv.tv_sec = 0;
tv.tv_usec = 10000;
redisSetTimeout(c, tv); redisSetTimeout(c, tv);
reply = redisCommand(c, "GET foo"); reply = redisCommand(c, "GET foo");
test_cond(reply != NULL && reply->type == REDIS_REPLY_STRING && memcmp(reply->str, "fast", 4) == 0); test_cond(reply != NULL && reply->type == REDIS_REPLY_STRING && memcmp(reply->str, "fast", 4) == 0);
@ -1302,8 +1300,6 @@ static void test_blocking_connection_timeouts(struct config config) {
sdsfree(c->obuf); sdsfree(c->obuf);
c->obuf = sdsempty(); c->obuf = sdsempty();
tv.tv_sec = 0;
tv.tv_usec = 10000;
redisSetTimeout(c, tv); redisSetTimeout(c, tv);
reply = redisCommand(c, "GET foo"); reply = redisCommand(c, "GET foo");
#ifndef _WIN32 #ifndef _WIN32
@ -1316,7 +1312,7 @@ static void test_blocking_connection_timeouts(struct config config) {
freeReplyObject(reply); freeReplyObject(reply);
// wait for the DEBUG SLEEP to complete so that Redis server is unblocked for the following tests // wait for the DEBUG SLEEP to complete so that Redis server is unblocked for the following tests
millisleep(3000); millisleep(1100);
} else { } else {
test_skipped(); test_skipped();
} }

View File

@ -11,7 +11,7 @@ SKIPS_ARG=${SKIPS_ARG:-}
REDIS_DOCKER=${REDIS_DOCKER:-} REDIS_DOCKER=${REDIS_DOCKER:-}
# We need to enable the DEBUG command for redis-server >= 7.0.0 # We need to enable the DEBUG command for redis-server >= 7.0.0
REDIS_MAJOR_VERSION="$(redis-server --version|awk -F'[^0-9]+' '{ print $2 }')" REDIS_MAJOR_VERSION="$(${REDIS_SERVER} --version|awk -F'[^0-9]+' '{ print $2 }')"
if [ "$REDIS_MAJOR_VERSION" -gt "6" ]; then if [ "$REDIS_MAJOR_VERSION" -gt "6" ]; then
ENABLE_DEBUG_CMD="enable-debug-command local" ENABLE_DEBUG_CMD="enable-debug-command local"
fi fi
@ -98,7 +98,7 @@ if [ -n "${REDIS_DOCKER}" ] ; then
-p ${REDIS_SSL_PORT}:${REDIS_SSL_PORT} \ -p ${REDIS_SSL_PORT}:${REDIS_SSL_PORT} \
-v ${tmpdir}:${tmpdir} \ -v ${tmpdir}:${tmpdir} \
${REDIS_DOCKER} \ ${REDIS_DOCKER} \
redis-server ${tmpdir}/redis.conf ${REDIS_SERVER} ${tmpdir}/redis.conf
else else
${REDIS_SERVER} ${tmpdir}/redis.conf ${REDIS_SERVER} ${tmpdir}/redis.conf
fi fi