pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/net/mosquitto
Module Name: pkgsrc
Committed By: gdt
Date: Sun Oct 13 14:13:23 UTC 2024
Modified Files:
pkgsrc/net/mosquitto: Makefile distinfo options.mk
pkgsrc/net/mosquitto/patches: patch-lib_CMakeLists.txt
patch-src_CMakeLists.txt
Added Files:
pkgsrc/net/mosquitto: patch-FIX
pkgsrc/net/mosquitto/patches: patch-FIX
Log Message:
net/mosquitto: Update to 2.0.19
packaging changes:
Cherry-pick pending upstream fix for pthread confusion. While
labeled as fixing NetBSD, it is really a consistency rototill for
using pthreads.
Use "websockets" lib instead of the cmake-too-complicated
"websockets_shared" which references an installed file which seems
to have a bug of including -ldl on systems where it doesn't exist.
\todo Resolve within pkgsrc.
upstream changes:
2.0.19 - 2024-10-02
===================
Security:
- Fix mismatched subscribe/unsubscribe with normal/shared topics.
- Fix crash on bridge using remapped topic being sent a crafted packet.
Broker:
- Fix assert failure when loading a persistence file that contains
subscriptions with no client id.
- Fix local bridges being incorrectly expired when
persistent_client_expiration is in use.
- Fix use of CLOCK_BOOTTIME for getting time. Closes #3089.
- Fix mismatched subscribe/unsubscribe with normal/shared topics.
- Fix crash on bridge using remapped topic being sent a crafted packet.
Client library:
- Fix some error codes being converted to string as "unknown". Closes #2579.
- Clear SSL error state to avoid spurious error reporting. Closes #3054.
- Fix "payload format invalid" not being allowed as a PUBREC reason code.
- Don't allow SUBACK with missing reason codes.
Build:
- Thread support is re-enabled on Windows.
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 pkgsrc/net/mosquitto/Makefile
cvs rdiff -u -r1.30 -r1.31 pkgsrc/net/mosquitto/distinfo
cvs rdiff -u -r1.2 -r1.3 pkgsrc/net/mosquitto/options.mk
cvs rdiff -u -r0 -r1.1 pkgsrc/net/mosquitto/patch-FIX
cvs rdiff -u -r0 -r1.1 pkgsrc/net/mosquitto/patches/patch-FIX
cvs rdiff -u -r1.2 -r1.3 \
pkgsrc/net/mosquitto/patches/patch-lib_CMakeLists.txt
cvs rdiff -u -r1.6 -r1.7 \
pkgsrc/net/mosquitto/patches/patch-src_CMakeLists.txt
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/net/mosquitto/Makefile
diff -u pkgsrc/net/mosquitto/Makefile:1.36 pkgsrc/net/mosquitto/Makefile:1.37
--- pkgsrc/net/mosquitto/Makefile:1.36 Sun Aug 25 06:19:07 2024
+++ pkgsrc/net/mosquitto/Makefile Sun Oct 13 14:13:22 2024
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.36 2024/08/25 06:19:07 wiz Exp $
+# $NetBSD: Makefile,v 1.37 2024/10/13 14:13:22 gdt Exp $
-DISTNAME= mosquitto-2.0.18
-PKGREVISION= 1
+DISTNAME= mosquitto-2.0.19
CATEGORIES= net
MASTER_SITES= https://mosquitto.org/files/source/
@@ -15,7 +14,9 @@ TOOL_DEPENDS+= docbook-xsl-[0-9]*:../../
USE_LANGUAGES+= c c++
+# \todo File a bug upstream.
LDFLAGS.SunOS+= -lsocket -lnsl
+
CMAKE_CONFIGURE_ARGS+= -DCMAKE_INSTALL_SYSCONFDIR=${PREFIX}/share/examples
CMAKE_CONFIGURE_ARGS+= -DWITH_PLUGINS=NO
Index: pkgsrc/net/mosquitto/distinfo
diff -u pkgsrc/net/mosquitto/distinfo:1.30 pkgsrc/net/mosquitto/distinfo:1.31
--- pkgsrc/net/mosquitto/distinfo:1.30 Mon Aug 19 19:11:36 2024
+++ pkgsrc/net/mosquitto/distinfo Sun Oct 13 14:13:22 2024
@@ -1,10 +1,11 @@
-$NetBSD: distinfo,v 1.30 2024/08/19 19:11:36 wiz Exp $
+$NetBSD: distinfo,v 1.31 2024/10/13 14:13:22 gdt Exp $
-BLAKE2s (mosquitto-2.0.18.tar.gz) = 19191973bd7b7c299d8ebb478b9c57c57c802a4f80f5d5406069df45113a4486
-SHA512 (mosquitto-2.0.18.tar.gz) = 63f7e2811964bab5856848e6918627c47afc6534ff60aad5ece3d2fa330b407c9df14027610826e343ee68ff7d8d5d93f2459713061251ded478c42766946767
-Size (mosquitto-2.0.18.tar.gz) = 796351 bytes
-SHA1 (patch-lib_CMakeLists.txt) = 81981f812dc38572e727a9a5dfb427b80476702d
+BLAKE2s (mosquitto-2.0.19.tar.gz) = bed44b4f1a969e997b512adb0ba86078c8cfe43ddd1195531d7b6f5273c5563f
+SHA512 (mosquitto-2.0.19.tar.gz) = ea716c1fd8dd7dc60e2f0bf5c2f0f5b98f73d1ea404420c755aff82ba2e70e54e0fe19bd045be8322971d290111ee556830e7f71da7cdcf27917f393d1fa7238
+Size (mosquitto-2.0.19.tar.gz) = 799267 bytes
+SHA1 (patch-FIX) = 32ed3b0775cdee5fb65a99d4b90e1631f9e981e9
+SHA1 (patch-lib_CMakeLists.txt) = a1b1327c81eefc13fcb5249697f7a6bc3c94e308
SHA1 (patch-lib_net__mosq.c) = fdf488984e3b902473f28d6e3482169788c0d517
SHA1 (patch-lib_strings__mosq.c) = fb290d7766328d6aa1e935adec9c0fad2eb11c4b
SHA1 (patch-mosquitto.conf) = 3aa9b02d8bfefa140814c2c70e120331a58a5e11
-SHA1 (patch-src_CMakeLists.txt) = d0425fd674f2cd1a992a36e616dc8b29e130550b
+SHA1 (patch-src_CMakeLists.txt) = aac198d154e85527349302b32f78a7027164422b
Index: pkgsrc/net/mosquitto/options.mk
diff -u pkgsrc/net/mosquitto/options.mk:1.2 pkgsrc/net/mosquitto/options.mk:1.3
--- pkgsrc/net/mosquitto/options.mk:1.2 Sun Aug 25 06:19:07 2024
+++ pkgsrc/net/mosquitto/options.mk Sun Oct 13 14:13:22 2024
@@ -1,4 +1,4 @@
-# $NetBSD: options.mk,v 1.2 2024/08/25 06:19:07 wiz Exp $
+# $NetBSD: options.mk,v 1.3 2024/10/13 14:13:22 gdt Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.mosquitto
PKG_SUPPORTED_OPTIONS= websockets
@@ -6,6 +6,9 @@ PKG_SUGGESTED_OPTIONS= websockets
.include "../../mk/bsd.options.mk"
+# \todo With websockets, mosquitto's build system throws warnings that
+# performance will be terrible. Figure out if this is correct or not
+# and fix or file bugs as appropriate.
.if !empty(PKG_OPTIONS:Mwebsockets)
CMAKE_CONFIGURE_ARGS+= -DWITH_WEBSOCKETS=yes
.include "../../www/libwebsockets/buildlink3.mk"
Index: pkgsrc/net/mosquitto/patches/patch-lib_CMakeLists.txt
diff -u pkgsrc/net/mosquitto/patches/patch-lib_CMakeLists.txt:1.2 pkgsrc/net/mosquitto/patches/patch-lib_CMakeLists.txt:1.3
--- pkgsrc/net/mosquitto/patches/patch-lib_CMakeLists.txt:1.2 Thu Jan 28 19:46:24 2021
+++ pkgsrc/net/mosquitto/patches/patch-lib_CMakeLists.txt Sun Oct 13 14:13:23 2024
@@ -1,14 +1,14 @@
-$NetBSD: patch-lib_CMakeLists.txt,v 1.2 2021/01/28 19:46:24 triaxx Exp $
+$NetBSD: patch-lib_CMakeLists.txt,v 1.3 2024/10/13 14:13:23 gdt Exp $
On NetBSD, do not include librt.
\todo Why? All other "UNIX" does, except Mac.
\todo Consider filing upstream.
---- lib/CMakeLists.txt.orig 2021-01-11 16:49:40.000000000 +0000
+--- lib/CMakeLists.txt.orig 2024-10-02 10:09:25.000000000 +0000
+++ lib/CMakeLists.txt
@@ -61,12 +61,12 @@ set(C_SRC
- set (LIBRARIES ${OPENSSL_LIBRARIES} ${PTHREAD_LIBRARIES})
+ set (LIBRARIES ${OPENSSL_LIBRARIES})
-if (UNIX AND NOT APPLE AND NOT ANDROID)
+if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
Index: pkgsrc/net/mosquitto/patches/patch-src_CMakeLists.txt
diff -u pkgsrc/net/mosquitto/patches/patch-src_CMakeLists.txt:1.6 pkgsrc/net/mosquitto/patches/patch-src_CMakeLists.txt:1.7
--- pkgsrc/net/mosquitto/patches/patch-src_CMakeLists.txt:1.6 Fri Dec 31 09:57:36 2021
+++ pkgsrc/net/mosquitto/patches/patch-src_CMakeLists.txt Sun Oct 13 14:13:23 2024
@@ -1,11 +1,22 @@
-$NetBSD: patch-src_CMakeLists.txt,v 1.6 2021/12/31 09:57:36 triaxx Exp $
+$NetBSD: patch-src_CMakeLists.txt,v 1.7 2024/10/13 14:13:23 gdt Exp $
-\todo Explain this change
+The first hunk avoids some cmake magic, which buggily adds -ldl on NetBSD.
+\todo File a bug against pkgsrc websockets, perhaps cascading to upstream.
-\todo File upstream.
+The second hunk removes linker args on SunOS, for no apparent reason.
+\todo Explain and file a bug upstream; this should not be a pkgsrc change.
--- src/CMakeLists.txt.orig 2020-08-19 13:55:03.000000000 +0000
+++ src/CMakeLists.txt
+@@ -200,7 +200,7 @@
+ link_directories(${mosquitto_SOURCE_DIR})
+ endif (WIN32)
+ else (STATIC_WEBSOCKETS)
+- set (MOSQ_LIBS ${MOSQ_LIBS} websockets_shared)
++ set (MOSQ_LIBS ${MOSQ_LIBS} websockets)
+ endif (STATIC_WEBSOCKETS)
+ endif (WITH_WEBSOCKETS)
+
@@ -213,9 +213,9 @@ target_link_libraries(mosquitto ${MOSQ_L
if (UNIX)
if (APPLE)
Added files:
Index: pkgsrc/net/mosquitto/patch-FIX
diff -u /dev/null pkgsrc/net/mosquitto/patch-FIX:1.1
--- /dev/null Sun Oct 13 14:13:23 2024
+++ pkgsrc/net/mosquitto/patch-FIX Sun Oct 13 14:13:22 2024
@@ -0,0 +1,390 @@
+commit 88b7bb3521cc51cb1e80630395ae736040cc8ff8
+Author: Roger A. Light <roger%atchoo.org@localhost>
+Date: Sat Oct 12 17:00:40 2024 +0100
+
+ Fix NetBSD build
+
+diff --git a/ChangeLog.txt b/ChangeLog.txt
+index a8cecd6a..758fa639 100644
+--- ChangeLog.txt
++++ ChangeLog.txt
+@@ -1,4 +1,4 @@
+-2.0.20 - 2024-10-11
++2.0.20 - 2024-10-xx
+ ===================
+
+ Broker:
+@@ -9,6 +9,9 @@ Broker:
+ Client library:
+ - Fix cmake build on OS X. Closes #3125.
+
++Build:
++- Fix build on NetBSD
++
+
+ 2.0.19 - 2024-10-02
+ ===================
+diff --git a/lib/dummypthread.h b/lib/dummypthread.h
+deleted file mode 100644
+index c0eb2c15..00000000
+--- lib/dummypthread.h
++++ /dev/null
+@@ -1,14 +0,0 @@
+-#ifndef DUMMYPTHREAD_H
+-#define DUMMYPTHREAD_H
+-
+-#define pthread_create(A, B, C, D)
+-#define pthread_join(A, B)
+-#define pthread_cancel(A)
+-#define pthread_testcancel()
+-
+-#define pthread_mutex_init(A, B)
+-#define pthread_mutex_destroy(A)
+-#define pthread_mutex_lock(A)
+-#define pthread_mutex_unlock(A)
+-
+-#endif
+diff --git a/lib/handle_pubackcomp.c b/lib/handle_pubackcomp.c
+index 4568bb40..d70d602d 100644
+--- lib/handle_pubackcomp.c
++++ lib/handle_pubackcomp.c
+@@ -57,9 +57,9 @@ int handle__pubackcomp(struct mosquitto *mosq, const char *type)
+ }
+ }
+
+- pthread_mutex_lock(&mosq->msgs_out.mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgs_out.mutex);
+ util__increment_send_quota(mosq);
+- pthread_mutex_unlock(&mosq->msgs_out.mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgs_out.mutex);
+
+ rc = packet__read_uint16(&mosq->in_packet, &mid);
+ if(rc) return rc;
+diff --git a/lib/mosquitto_internal.h b/lib/mosquitto_internal.h
+index ac71ffbf..31120258 100644
+--- lib/mosquitto_internal.h
++++ lib/mosquitto_internal.h
+@@ -33,11 +33,7 @@ Contributors:
+ #endif
+ #include <stdlib.h>
+
+-#if defined(WITH_THREADING) && !defined(WITH_BROKER)
+-# include <pthread.h>
+-#else
+-# include <dummypthread.h>
+-#endif
++#include <pthread_compat.h>
+
+ #ifdef WITH_SRV
+ # include <ares.h>
+diff --git a/lib/packet_mosq.c b/lib/packet_mosq.c
+index fd716baf..b063eb71 100644
+--- lib/packet_mosq.c
++++ lib/packet_mosq.c
+@@ -129,13 +129,13 @@ void packet__cleanup_all_no_locks(struct mosquitto *mosq)
+
+ void packet__cleanup_all(struct mosquitto *mosq)
+ {
+- pthread_mutex_lock(&mosq->current_out_packet_mutex);
+- pthread_mutex_lock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->out_packet_mutex);
+
+ packet__cleanup_all_no_locks(mosq);
+
+- pthread_mutex_unlock(&mosq->out_packet_mutex);
+- pthread_mutex_unlock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->current_out_packet_mutex);
+ }
+
+
+@@ -151,7 +151,7 @@ int packet__queue(struct mosquitto *mosq, struct mosquitto__packet *packet)
+ packet->to_process = packet->packet_length;
+
+ packet->next = NULL;
+- pthread_mutex_lock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->out_packet_mutex);
+
+ #ifdef WITH_BROKER
+ if(db.config->max_queued_messages > 0 && mosq->out_packet_count >= db.config->max_queued_messages){
+@@ -174,7 +174,7 @@ int packet__queue(struct mosquitto *mosq, struct mosquitto__packet *packet)
+ }
+ mosq->out_packet_last = packet;
+ mosq->out_packet_count++;
+- pthread_mutex_unlock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->out_packet_mutex);
+ #ifdef WITH_BROKER
+ # ifdef WITH_WEBSOCKETS
+ if(mosq->wsi){
+@@ -232,8 +232,8 @@ int packet__write(struct mosquitto *mosq)
+ if(!mosq) return MOSQ_ERR_INVAL;
+ if(mosq->sock == INVALID_SOCKET) return MOSQ_ERR_NO_CONN;
+
+- pthread_mutex_lock(&mosq->current_out_packet_mutex);
+- pthread_mutex_lock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->out_packet_mutex);
+ if(mosq->out_packet && !mosq->current_out_packet){
+ mosq->current_out_packet = mosq->out_packet;
+ mosq->out_packet = mosq->out_packet->next;
+@@ -242,7 +242,7 @@ int packet__write(struct mosquitto *mosq)
+ }
+ mosq->out_packet_count--;
+ }
+- pthread_mutex_unlock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->out_packet_mutex);
+
+ #ifdef WITH_BROKER
+ if(mosq->current_out_packet){
+@@ -252,7 +252,7 @@ int packet__write(struct mosquitto *mosq)
+
+ state = mosquitto__get_state(mosq);
+ if(state == mosq_cs_connect_pending){
+- pthread_mutex_unlock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->current_out_packet_mutex);
+ return MOSQ_ERR_SUCCESS;
+ }
+
+@@ -274,10 +274,10 @@ int packet__write(struct mosquitto *mosq)
+ || errno == WSAENOTCONN
+ #endif
+ ){
+- pthread_mutex_unlock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->current_out_packet_mutex);
+ return MOSQ_ERR_SUCCESS;
+ }else{
+- pthread_mutex_unlock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->current_out_packet_mutex);
+ switch(errno){
+ case COMPAT_ECONNRESET:
+ return MOSQ_ERR_CONN_LOST;
+@@ -296,7 +296,7 @@ int packet__write(struct mosquitto *mosq)
+ if(((packet->command)&0xF6) == CMD_PUBLISH){
+ G_PUB_MSGS_SENT_INC(1);
+ #ifndef WITH_BROKER
+- pthread_mutex_lock(&mosq->callback_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
+ if(mosq->on_publish){
+ /* This is a QoS=0 message */
+ mosq->in_callback = true;
+@@ -309,7 +309,7 @@ int packet__write(struct mosquitto *mosq)
+ mosq->on_publish_v5(mosq, mosq->userdata, packet->mid, 0, NULL);
+ mosq->in_callback = false;
+ }
+- pthread_mutex_unlock(&mosq->callback_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
+ }else if(((packet->command)&0xF0) == CMD_DISCONNECT){
+ do_client_disconnect(mosq, MOSQ_ERR_SUCCESS, NULL);
+ packet__cleanup(packet);
+@@ -321,7 +321,7 @@ int packet__write(struct mosquitto *mosq)
+ }
+
+ /* Free data and reset values */
+- pthread_mutex_lock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->out_packet_mutex);
+ mosq->current_out_packet = mosq->out_packet;
+ if(mosq->out_packet){
+ mosq->out_packet = mosq->out_packet->next;
+@@ -330,7 +330,7 @@ int packet__write(struct mosquitto *mosq)
+ }
+ mosq->out_packet_count--;
+ }
+- pthread_mutex_unlock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->out_packet_mutex);
+
+ packet__cleanup(packet);
+ mosquitto__free(packet);
+@@ -338,9 +338,9 @@ int packet__write(struct mosquitto *mosq)
+ #ifdef WITH_BROKER
+ mosq->next_msg_out = db.now_s + mosq->keepalive;
+ #else
+- pthread_mutex_lock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgtime_mutex);
+ mosq->next_msg_out = mosquitto_time() + mosq->keepalive;
+- pthread_mutex_unlock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgtime_mutex);
+ #endif
+ }
+ #ifdef WITH_BROKER
+@@ -348,7 +348,7 @@ int packet__write(struct mosquitto *mosq)
+ mux__remove_out(mosq);
+ }
+ #endif
+- pthread_mutex_unlock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->current_out_packet_mutex);
+ return MOSQ_ERR_SUCCESS;
+ }
+
+@@ -536,9 +536,9 @@ int packet__read(struct mosquitto *mosq)
+ #ifdef WITH_BROKER
+ keepalive__update(mosq);
+ #else
+- pthread_mutex_lock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgtime_mutex);
+ mosq->last_msg_in = mosquitto_time();
+- pthread_mutex_unlock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgtime_mutex);
+ #endif
+ }
+ return MOSQ_ERR_SUCCESS;
+@@ -571,9 +571,9 @@ int packet__read(struct mosquitto *mosq)
+ #ifdef WITH_BROKER
+ keepalive__update(mosq);
+ #else
+- pthread_mutex_lock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgtime_mutex);
+ mosq->last_msg_in = mosquitto_time();
+- pthread_mutex_unlock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgtime_mutex);
+ #endif
+ return rc;
+ }
+diff --git a/lib/pthread_compat.h b/lib/pthread_compat.h
+new file mode 100644
+index 00000000..ca1f27dc
+--- /dev/null
++++ lib/pthread_compat.h
+@@ -0,0 +1,28 @@
++#ifndef PTHREAD_COMPAT_
++#define PTHREAD_COMPAT_
++
++#if defined(WITH_THREADING) && !defined(WITH_BROKER)
++# include <pthread.h>
++
++# define COMPAT_pthread_create(A, B, C, D) pthread_create((A), (B), (C), (D))
++# define COMPAT_pthread_join(A, B) pthread_join((A), (B))
++# define COMPAT_pthread_cancel(A) pthread_cancel((A))
++# define COMPAT_pthread_testcancel() pthread_testcancel()
++
++# define COMPAT_pthread_mutex_init(A, B) pthread_mutex_init((A), (B))
++# define COMPAT_pthread_mutex_destroy(A) pthread_mutex_init((A))
++# define COMPAT_pthread_mutex_lock(A) pthread_mutex_lock((A))
++# define COMPAT_pthread_mutex_unlock(A) pthread_mutex_unlock((A))
++#else
++# define COMPAT_pthread_create(A, B, C, D)
++# define COMPAT_pthread_join(A, B)
++# define COMPAT_pthread_cancel(A)
++# define COMPAT_pthread_testcancel()
++
++# define COMPAT_pthread_mutex_init(A, B)
++# define COMPAT_pthread_mutex_destroy(A)
++# define COMPAT_pthread_mutex_lock(A)
++# define COMPAT_pthread_mutex_unlock(A)
++#endif
++
++#endif
+diff --git a/lib/util_mosq.c b/lib/util_mosq.c
+index 22f8c4d5..4bebcbd0 100644
+--- lib/util_mosq.c
++++ lib/util_mosq.c
+@@ -87,10 +87,10 @@ int mosquitto__check_keepalive(struct mosquitto *mosq)
+ return MOSQ_ERR_SUCCESS;
+ }
+ #endif
+- pthread_mutex_lock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgtime_mutex);
+ next_msg_out = mosq->next_msg_out;
+ last_msg_in = mosq->last_msg_in;
+- pthread_mutex_unlock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgtime_mutex);
+ if(mosq->keepalive && mosq->sock != INVALID_SOCKET &&
+ (now >= next_msg_out || now - last_msg_in >= mosq->keepalive)){
+
+@@ -98,10 +98,10 @@ int mosquitto__check_keepalive(struct mosquitto *mosq)
+ if(state == mosq_cs_active && mosq->ping_t == 0){
+ send__pingreq(mosq);
+ /* Reset last msg times to give the server time to send a pingresp */
+- pthread_mutex_lock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgtime_mutex);
+ mosq->last_msg_in = now;
+ mosq->next_msg_out = now + mosq->keepalive;
+- pthread_mutex_unlock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgtime_mutex);
+ }else{
+ #ifdef WITH_BROKER
+ # ifdef WITH_BRIDGE
+@@ -118,7 +118,7 @@ int mosquitto__check_keepalive(struct mosquitto *mosq)
+ }else{
+ rc = MOSQ_ERR_KEEPALIVE;
+ }
+- pthread_mutex_lock(&mosq->callback_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
+ if(mosq->on_disconnect){
+ mosq->in_callback = true;
+ mosq->on_disconnect(mosq, mosq->userdata, rc);
+@@ -129,7 +129,7 @@ int mosquitto__check_keepalive(struct mosquitto *mosq)
+ mosq->on_disconnect_v5(mosq, mosq->userdata, rc, NULL);
+ mosq->in_callback = false;
+ }
+- pthread_mutex_unlock(&mosq->callback_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
+
+ return rc;
+ #endif
+@@ -150,11 +150,11 @@ uint16_t mosquitto__mid_generate(struct mosquitto *mosq)
+ uint16_t mid;
+ assert(mosq);
+
+- pthread_mutex_lock(&mosq->mid_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->mid_mutex);
+ mosq->last_mid++;
+ if(mosq->last_mid == 0) mosq->last_mid++;
+ mid = mosq->last_mid;
+- pthread_mutex_unlock(&mosq->mid_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->mid_mutex);
+
+ return mid;
+ }
+@@ -280,14 +280,14 @@ int util__random_bytes(void *bytes, int count)
+
+ int mosquitto__set_state(struct mosquitto *mosq, enum mosquitto_client_state state)
+ {
+- pthread_mutex_lock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->state_mutex);
+ #ifdef WITH_BROKER
+ if(mosq->state != mosq_cs_disused)
+ #endif
+ {
+ mosq->state = state;
+ }
+- pthread_mutex_unlock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->state_mutex);
+
+ return MOSQ_ERR_SUCCESS;
+ }
+@@ -296,9 +296,9 @@ enum mosquitto_client_state mosquitto__get_state(struct mosquitto *mosq)
+ {
+ enum mosquitto_client_state state;
+
+- pthread_mutex_lock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->state_mutex);
+ state = mosq->state;
+- pthread_mutex_unlock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->state_mutex);
+
+ return state;
+ }
+@@ -306,18 +306,18 @@ enum mosquitto_client_state mosquitto__get_state(struct mosquitto *mosq)
+ #ifndef WITH_BROKER
+ void mosquitto__set_request_disconnect(struct mosquitto *mosq, bool request_disconnect)
+ {
+- pthread_mutex_lock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->state_mutex);
+ mosq->request_disconnect = request_disconnect;
+- pthread_mutex_unlock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->state_mutex);
+ }
+
+ bool mosquitto__get_request_disconnect(struct mosquitto *mosq)
+ {
+ bool request_disconnect;
+
+- pthread_mutex_lock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->state_mutex);
+ request_disconnect = mosq->request_disconnect;
+- pthread_mutex_unlock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->state_mutex);
+
+ return request_disconnect;
+ }
Index: pkgsrc/net/mosquitto/patches/patch-FIX
diff -u /dev/null pkgsrc/net/mosquitto/patches/patch-FIX:1.1
--- /dev/null Sun Oct 13 14:13:23 2024
+++ pkgsrc/net/mosquitto/patches/patch-FIX Sun Oct 13 14:13:23 2024
@@ -0,0 +1,377 @@
+$NetBSD: patch-FIX,v 1.1 2024/10/13 14:13:23 gdt Exp $
+
+This patch, cherry-picking an upstream pending patch, is temporary
+until the next release. It cherry-picks an upstream rototill of the
+way pthreads are used or not used.
+
+
+commit 88b7bb3521cc51cb1e80630395ae736040cc8ff8
+Author: Roger A. Light <roger%atchoo.org@localhost>
+Date: Sat Oct 12 17:00:40 2024 +0100
+
+ Fix NetBSD build
+
+diff --git a/lib/dummypthread.h b/lib/dummypthread.h
+deleted file mode 100644
+index c0eb2c15..00000000
+--- lib/dummypthread.h
++++ /dev/null
+@@ -1,14 +0,0 @@
+-#ifndef DUMMYPTHREAD_H
+-#define DUMMYPTHREAD_H
+-
+-#define pthread_create(A, B, C, D)
+-#define pthread_join(A, B)
+-#define pthread_cancel(A)
+-#define pthread_testcancel()
+-
+-#define pthread_mutex_init(A, B)
+-#define pthread_mutex_destroy(A)
+-#define pthread_mutex_lock(A)
+-#define pthread_mutex_unlock(A)
+-
+-#endif
+diff --git a/lib/handle_pubackcomp.c b/lib/handle_pubackcomp.c
+index 4568bb40..d70d602d 100644
+--- lib/handle_pubackcomp.c
++++ lib/handle_pubackcomp.c
+@@ -57,9 +57,9 @@ int handle__pubackcomp(struct mosquitto *mosq, const char *type)
+ }
+ }
+
+- pthread_mutex_lock(&mosq->msgs_out.mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgs_out.mutex);
+ util__increment_send_quota(mosq);
+- pthread_mutex_unlock(&mosq->msgs_out.mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgs_out.mutex);
+
+ rc = packet__read_uint16(&mosq->in_packet, &mid);
+ if(rc) return rc;
+diff --git a/lib/mosquitto_internal.h b/lib/mosquitto_internal.h
+index ac71ffbf..31120258 100644
+--- lib/mosquitto_internal.h
++++ lib/mosquitto_internal.h
+@@ -33,11 +33,7 @@ Contributors:
+ #endif
+ #include <stdlib.h>
+
+-#if defined(WITH_THREADING) && !defined(WITH_BROKER)
+-# include <pthread.h>
+-#else
+-# include <dummypthread.h>
+-#endif
++#include <pthread_compat.h>
+
+ #ifdef WITH_SRV
+ # include <ares.h>
+diff --git a/lib/packet_mosq.c b/lib/packet_mosq.c
+index fd716baf..b063eb71 100644
+--- lib/packet_mosq.c
++++ lib/packet_mosq.c
+@@ -129,13 +129,13 @@ void packet__cleanup_all_no_locks(struct mosquitto *mosq)
+
+ void packet__cleanup_all(struct mosquitto *mosq)
+ {
+- pthread_mutex_lock(&mosq->current_out_packet_mutex);
+- pthread_mutex_lock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->out_packet_mutex);
+
+ packet__cleanup_all_no_locks(mosq);
+
+- pthread_mutex_unlock(&mosq->out_packet_mutex);
+- pthread_mutex_unlock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->current_out_packet_mutex);
+ }
+
+
+@@ -151,7 +151,7 @@ int packet__queue(struct mosquitto *mosq, struct mosquitto__packet *packet)
+ packet->to_process = packet->packet_length;
+
+ packet->next = NULL;
+- pthread_mutex_lock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->out_packet_mutex);
+
+ #ifdef WITH_BROKER
+ if(db.config->max_queued_messages > 0 && mosq->out_packet_count >= db.config->max_queued_messages){
+@@ -174,7 +174,7 @@ int packet__queue(struct mosquitto *mosq, struct mosquitto__packet *packet)
+ }
+ mosq->out_packet_last = packet;
+ mosq->out_packet_count++;
+- pthread_mutex_unlock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->out_packet_mutex);
+ #ifdef WITH_BROKER
+ # ifdef WITH_WEBSOCKETS
+ if(mosq->wsi){
+@@ -232,8 +232,8 @@ int packet__write(struct mosquitto *mosq)
+ if(!mosq) return MOSQ_ERR_INVAL;
+ if(mosq->sock == INVALID_SOCKET) return MOSQ_ERR_NO_CONN;
+
+- pthread_mutex_lock(&mosq->current_out_packet_mutex);
+- pthread_mutex_lock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->out_packet_mutex);
+ if(mosq->out_packet && !mosq->current_out_packet){
+ mosq->current_out_packet = mosq->out_packet;
+ mosq->out_packet = mosq->out_packet->next;
+@@ -242,7 +242,7 @@ int packet__write(struct mosquitto *mosq)
+ }
+ mosq->out_packet_count--;
+ }
+- pthread_mutex_unlock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->out_packet_mutex);
+
+ #ifdef WITH_BROKER
+ if(mosq->current_out_packet){
+@@ -252,7 +252,7 @@ int packet__write(struct mosquitto *mosq)
+
+ state = mosquitto__get_state(mosq);
+ if(state == mosq_cs_connect_pending){
+- pthread_mutex_unlock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->current_out_packet_mutex);
+ return MOSQ_ERR_SUCCESS;
+ }
+
+@@ -274,10 +274,10 @@ int packet__write(struct mosquitto *mosq)
+ || errno == WSAENOTCONN
+ #endif
+ ){
+- pthread_mutex_unlock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->current_out_packet_mutex);
+ return MOSQ_ERR_SUCCESS;
+ }else{
+- pthread_mutex_unlock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->current_out_packet_mutex);
+ switch(errno){
+ case COMPAT_ECONNRESET:
+ return MOSQ_ERR_CONN_LOST;
+@@ -296,7 +296,7 @@ int packet__write(struct mosquitto *mosq)
+ if(((packet->command)&0xF6) == CMD_PUBLISH){
+ G_PUB_MSGS_SENT_INC(1);
+ #ifndef WITH_BROKER
+- pthread_mutex_lock(&mosq->callback_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
+ if(mosq->on_publish){
+ /* This is a QoS=0 message */
+ mosq->in_callback = true;
+@@ -309,7 +309,7 @@ int packet__write(struct mosquitto *mosq)
+ mosq->on_publish_v5(mosq, mosq->userdata, packet->mid, 0, NULL);
+ mosq->in_callback = false;
+ }
+- pthread_mutex_unlock(&mosq->callback_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
+ }else if(((packet->command)&0xF0) == CMD_DISCONNECT){
+ do_client_disconnect(mosq, MOSQ_ERR_SUCCESS, NULL);
+ packet__cleanup(packet);
+@@ -321,7 +321,7 @@ int packet__write(struct mosquitto *mosq)
+ }
+
+ /* Free data and reset values */
+- pthread_mutex_lock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->out_packet_mutex);
+ mosq->current_out_packet = mosq->out_packet;
+ if(mosq->out_packet){
+ mosq->out_packet = mosq->out_packet->next;
+@@ -330,7 +330,7 @@ int packet__write(struct mosquitto *mosq)
+ }
+ mosq->out_packet_count--;
+ }
+- pthread_mutex_unlock(&mosq->out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->out_packet_mutex);
+
+ packet__cleanup(packet);
+ mosquitto__free(packet);
+@@ -338,9 +338,9 @@ int packet__write(struct mosquitto *mosq)
+ #ifdef WITH_BROKER
+ mosq->next_msg_out = db.now_s + mosq->keepalive;
+ #else
+- pthread_mutex_lock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgtime_mutex);
+ mosq->next_msg_out = mosquitto_time() + mosq->keepalive;
+- pthread_mutex_unlock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgtime_mutex);
+ #endif
+ }
+ #ifdef WITH_BROKER
+@@ -348,7 +348,7 @@ int packet__write(struct mosquitto *mosq)
+ mux__remove_out(mosq);
+ }
+ #endif
+- pthread_mutex_unlock(&mosq->current_out_packet_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->current_out_packet_mutex);
+ return MOSQ_ERR_SUCCESS;
+ }
+
+@@ -536,9 +536,9 @@ int packet__read(struct mosquitto *mosq)
+ #ifdef WITH_BROKER
+ keepalive__update(mosq);
+ #else
+- pthread_mutex_lock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgtime_mutex);
+ mosq->last_msg_in = mosquitto_time();
+- pthread_mutex_unlock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgtime_mutex);
+ #endif
+ }
+ return MOSQ_ERR_SUCCESS;
+@@ -571,9 +571,9 @@ int packet__read(struct mosquitto *mosq)
+ #ifdef WITH_BROKER
+ keepalive__update(mosq);
+ #else
+- pthread_mutex_lock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgtime_mutex);
+ mosq->last_msg_in = mosquitto_time();
+- pthread_mutex_unlock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgtime_mutex);
+ #endif
+ return rc;
+ }
+diff --git a/lib/pthread_compat.h b/lib/pthread_compat.h
+new file mode 100644
+index 00000000..ca1f27dc
+--- /dev/null
++++ lib/pthread_compat.h
+@@ -0,0 +1,28 @@
++#ifndef PTHREAD_COMPAT_
++#define PTHREAD_COMPAT_
++
++#if defined(WITH_THREADING) && !defined(WITH_BROKER)
++# include <pthread.h>
++
++# define COMPAT_pthread_create(A, B, C, D) pthread_create((A), (B), (C), (D))
++# define COMPAT_pthread_join(A, B) pthread_join((A), (B))
++# define COMPAT_pthread_cancel(A) pthread_cancel((A))
++# define COMPAT_pthread_testcancel() pthread_testcancel()
++
++# define COMPAT_pthread_mutex_init(A, B) pthread_mutex_init((A), (B))
++# define COMPAT_pthread_mutex_destroy(A) pthread_mutex_init((A))
++# define COMPAT_pthread_mutex_lock(A) pthread_mutex_lock((A))
++# define COMPAT_pthread_mutex_unlock(A) pthread_mutex_unlock((A))
++#else
++# define COMPAT_pthread_create(A, B, C, D)
++# define COMPAT_pthread_join(A, B)
++# define COMPAT_pthread_cancel(A)
++# define COMPAT_pthread_testcancel()
++
++# define COMPAT_pthread_mutex_init(A, B)
++# define COMPAT_pthread_mutex_destroy(A)
++# define COMPAT_pthread_mutex_lock(A)
++# define COMPAT_pthread_mutex_unlock(A)
++#endif
++
++#endif
+diff --git a/lib/util_mosq.c b/lib/util_mosq.c
+index 22f8c4d5..4bebcbd0 100644
+--- lib/util_mosq.c
++++ lib/util_mosq.c
+@@ -87,10 +87,10 @@ int mosquitto__check_keepalive(struct mosquitto *mosq)
+ return MOSQ_ERR_SUCCESS;
+ }
+ #endif
+- pthread_mutex_lock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgtime_mutex);
+ next_msg_out = mosq->next_msg_out;
+ last_msg_in = mosq->last_msg_in;
+- pthread_mutex_unlock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgtime_mutex);
+ if(mosq->keepalive && mosq->sock != INVALID_SOCKET &&
+ (now >= next_msg_out || now - last_msg_in >= mosq->keepalive)){
+
+@@ -98,10 +98,10 @@ int mosquitto__check_keepalive(struct mosquitto *mosq)
+ if(state == mosq_cs_active && mosq->ping_t == 0){
+ send__pingreq(mosq);
+ /* Reset last msg times to give the server time to send a pingresp */
+- pthread_mutex_lock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->msgtime_mutex);
+ mosq->last_msg_in = now;
+ mosq->next_msg_out = now + mosq->keepalive;
+- pthread_mutex_unlock(&mosq->msgtime_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->msgtime_mutex);
+ }else{
+ #ifdef WITH_BROKER
+ # ifdef WITH_BRIDGE
+@@ -118,7 +118,7 @@ int mosquitto__check_keepalive(struct mosquitto *mosq)
+ }else{
+ rc = MOSQ_ERR_KEEPALIVE;
+ }
+- pthread_mutex_lock(&mosq->callback_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
+ if(mosq->on_disconnect){
+ mosq->in_callback = true;
+ mosq->on_disconnect(mosq, mosq->userdata, rc);
+@@ -129,7 +129,7 @@ int mosquitto__check_keepalive(struct mosquitto *mosq)
+ mosq->on_disconnect_v5(mosq, mosq->userdata, rc, NULL);
+ mosq->in_callback = false;
+ }
+- pthread_mutex_unlock(&mosq->callback_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
+
+ return rc;
+ #endif
+@@ -150,11 +150,11 @@ uint16_t mosquitto__mid_generate(struct mosquitto *mosq)
+ uint16_t mid;
+ assert(mosq);
+
+- pthread_mutex_lock(&mosq->mid_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->mid_mutex);
+ mosq->last_mid++;
+ if(mosq->last_mid == 0) mosq->last_mid++;
+ mid = mosq->last_mid;
+- pthread_mutex_unlock(&mosq->mid_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->mid_mutex);
+
+ return mid;
+ }
+@@ -280,14 +280,14 @@ int util__random_bytes(void *bytes, int count)
+
+ int mosquitto__set_state(struct mosquitto *mosq, enum mosquitto_client_state state)
+ {
+- pthread_mutex_lock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->state_mutex);
+ #ifdef WITH_BROKER
+ if(mosq->state != mosq_cs_disused)
+ #endif
+ {
+ mosq->state = state;
+ }
+- pthread_mutex_unlock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->state_mutex);
+
+ return MOSQ_ERR_SUCCESS;
+ }
+@@ -296,9 +296,9 @@ enum mosquitto_client_state mosquitto__get_state(struct mosquitto *mosq)
+ {
+ enum mosquitto_client_state state;
+
+- pthread_mutex_lock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->state_mutex);
+ state = mosq->state;
+- pthread_mutex_unlock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->state_mutex);
+
+ return state;
+ }
+@@ -306,18 +306,18 @@ enum mosquitto_client_state mosquitto__get_state(struct mosquitto *mosq)
+ #ifndef WITH_BROKER
+ void mosquitto__set_request_disconnect(struct mosquitto *mosq, bool request_disconnect)
+ {
+- pthread_mutex_lock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->state_mutex);
+ mosq->request_disconnect = request_disconnect;
+- pthread_mutex_unlock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->state_mutex);
+ }
+
+ bool mosquitto__get_request_disconnect(struct mosquitto *mosq)
+ {
+ bool request_disconnect;
+
+- pthread_mutex_lock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_lock(&mosq->state_mutex);
+ request_disconnect = mosq->request_disconnect;
+- pthread_mutex_unlock(&mosq->state_mutex);
++ COMPAT_pthread_mutex_unlock(&mosq->state_mutex);
+
+ return request_disconnect;
+ }
Home |
Main Index |
Thread Index |
Old Index