Control: tags 1146596 + pending

Dear maintainer,

I've prepared an NMU for opendht (versioned as 3.0.1-1.2) and uploaded 
it to DELAYED/1. Please feel free to tell me if I should cancel it.

cu
Adrian
diffstat for opendht-3.0.1 opendht-3.0.1

 changelog                                                   |    8 
 patches/0001-http-fix-service-name-resolution-failure.patch |   42 ++++
 patches/0002-adapt-for-Asio-1.34.patch                      |  126 ++++++++++++
 patches/series                                              |    2 
 4 files changed, 178 insertions(+)

diff -Nru opendht-3.0.1/debian/changelog opendht-3.0.1/debian/changelog
--- opendht-3.0.1/debian/changelog	2024-02-29 14:15:24.000000000 +0200
+++ opendht-3.0.1/debian/changelog	2026-10-17 22:47:08.000000000 +0300
@@ -1,3 +1,11 @@
+opendht (3.0.1-1.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Backport upstream fixes for FTBFS with recent asio.
+    (Closes: #1146596)
+
+ -- Adrian Bunk <[email protected]>  Sat, 17 Oct 2026 22:47:08 +0300
+
 opendht (3.0.1-1.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru opendht-3.0.1/debian/patches/0001-http-fix-service-name-resolution-failure.patch opendht-3.0.1/debian/patches/0001-http-fix-service-name-resolution-failure.patch
--- opendht-3.0.1/debian/patches/0001-http-fix-service-name-resolution-failure.patch	1970-01-01 02:00:00.000000000 +0200
+++ opendht-3.0.1/debian/patches/0001-http-fix-service-name-resolution-failure.patch	2026-10-17 22:47:08.000000000 +0300
@@ -0,0 +1,42 @@
+From 7642674966ecc7f8491b0a39b323d5104a069191 Mon Sep 17 00:00:00 2001
+From: François-Simon Fauteux-Chapleau
+ <[email protected]>
+Date: Mon, 14 Apr 2025 13:25:02 -0400
+Subject: http: fix service name resolution failure
+
+---
+ src/http.cpp | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/src/http.cpp b/src/http.cpp
+index 6b7d4aad..8290268b 100644
+--- a/src/http.cpp
++++ b/src/http.cpp
+@@ -831,10 +831,21 @@ Resolver::add_callback(ResolverCb cb, sa_family_t family)
+ }
+ 
+ void
+-Resolver::resolve(const std::string& host, const std::string& service)
++Resolver::resolve(const std::string& host, const std::string& serviceName)
+ {
+-    asio::ip::tcp::resolver::query query_(host, service);
+-    resolver_.async_resolve(query_, [this, host, service, destroyed = destroyed_]
++    auto service = serviceName;
++    // The async_resolve function used below typically relies on the contents of the
++    // /etc/services (Linux/POSIX) or c:\windows\system32\drivers\etc\services (Windows)
++    // file in order to resolve a descriptive service name into a port number. A
++    // resolution attempt that would otherwise succeed can therefore fail if the file
++    // is inaccessible or corrupted (which is rare but can happen in practice). We
++    // hardcode the port numbers for http and https to prevent this failure mode.
++    if (service == "http") {
++        service = "80";
++    } else if (service == "https") {
++        service = "443";
++    }
++    resolver_.async_resolve(host, service, [this, host, service, destroyed = destroyed_]
+         (const asio::error_code& ec, asio::ip::tcp::resolver::results_type endpoints)
+     {
+         if (ec == asio::error::operation_aborted or *destroyed)
+-- 
+2.47.3
+
diff -Nru opendht-3.0.1/debian/patches/0002-adapt-for-Asio-1.34.patch opendht-3.0.1/debian/patches/0002-adapt-for-Asio-1.34.patch
--- opendht-3.0.1/debian/patches/0002-adapt-for-Asio-1.34.patch	1970-01-01 02:00:00.000000000 +0200
+++ opendht-3.0.1/debian/patches/0002-adapt-for-Asio-1.34.patch	2026-10-17 22:47:08.000000000 +0300
@@ -0,0 +1,126 @@
+From 1fbb12c167b20ab4e297a3b2e76cffa2a6cba7ed Mon Sep 17 00:00:00 2001
+From: Adrien Béraud <>
+Date: Tue, 22 Apr 2025 20:02:37 -0400
+Subject: adapt for Asio 1.34
+
+---
+ src/http.cpp           | 20 ++++++++++----------
+ src/peer_discovery.cpp |  6 +++---
+ 2 files changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/src/http.cpp b/src/http.cpp
+index 8290268b..b0afe65d 100644
+--- a/src/http.cpp
++++ b/src/http.cpp
+@@ -496,7 +496,7 @@ Connection::set_ssl_verification(const std::string& hostname, const asio::ssl::v
+                     }
+ 
+                     // starts from CA and goes down the presented chain
+-                    auto verifier = asio::ssl::rfc2818_verification(hostname);
++                    auto verifier = asio::ssl::host_name_verification(hostname);
+                     bool verified = verifier(preverified, ctx);
+                     auto verify_ec = X509_STORE_CTX_get_error(ctx.native_handle());
+                     if (verify_ec != 0 /*X509_V_OK*/ and logger)
+@@ -668,12 +668,12 @@ Connection::async_write(BytesHandlerCb cb)
+ {
+     std::lock_guard<std::mutex> lock(mutex_);
+     if (!is_open()) {
+-        if (cb) ctx_.post([cb](){ cb(asio::error::broken_pipe, 0); });
++        if (cb) asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
+         return;
+     }
+     if (ssl_socket_)  asio::async_write(*ssl_socket_, write_buf_, wrapCallback(std::move(cb)));
+     else if (socket_) asio::async_write(*socket_, write_buf_, wrapCallback(std::move(cb)));
+-    else if (cb)      ctx_.post([cb](){ cb(asio::error::operation_aborted, 0); });
++    else if (cb)      asio::post(ctx_, [cb](){ cb(asio::error::operation_aborted, 0); });
+ }
+ 
+ void
+@@ -681,12 +681,12 @@ Connection::async_read_until(const char* delim, BytesHandlerCb cb)
+ {
+     std::lock_guard<std::mutex> lock(mutex_);
+     if (!is_open()) {
+-        if (cb) ctx_.post([cb](){ cb(asio::error::broken_pipe, 0); });
++        asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
+         return;
+     }
+     if (ssl_socket_)  asio::async_read_until(*ssl_socket_, read_buf_, delim, wrapCallback(std::move(cb)));
+     else if (socket_) asio::async_read_until(*socket_, read_buf_, delim, wrapCallback(std::move(cb)));
+-    else if (cb)      ctx_.post([cb](){ cb(asio::error::operation_aborted, 0); });
++    else if (cb)      asio::post(ctx_, [cb](){ cb(asio::error::operation_aborted, 0); });
+ }
+ 
+ void
+@@ -694,12 +694,12 @@ Connection::async_read_until(char delim, BytesHandlerCb cb)
+ {
+     std::lock_guard<std::mutex> lock(mutex_);
+     if (!is_open()) {
+-        if (cb) ctx_.post([cb](){ cb(asio::error::broken_pipe, 0); });
++        if (cb) asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
+         return;
+     }
+     if (ssl_socket_)  asio::async_read_until(*ssl_socket_, read_buf_, delim, wrapCallback(std::move(cb)));
+     else if (socket_) asio::async_read_until(*socket_, read_buf_, delim, wrapCallback(std::move(cb)));
+-    else if (cb)      ctx_.post([cb](){ cb(asio::error::operation_aborted, 0); });
++    else if (cb)      asio::post(ctx_, [cb](){ cb(asio::error::operation_aborted, 0); });
+ }
+ 
+ void
+@@ -707,12 +707,12 @@ Connection::async_read(size_t bytes, BytesHandlerCb cb)
+ {
+     std::lock_guard<std::mutex> lock(mutex_);
+     if (!is_open()) {
+-        if (cb) ctx_.post([cb](){ cb(asio::error::broken_pipe, 0); });
++        if (cb) asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
+         return;
+     }
+     if (ssl_socket_)  asio::async_read(*ssl_socket_, read_buf_, asio::transfer_exactly(bytes), wrapCallback(std::move(cb)));
+     else if (socket_) asio::async_read(*socket_, read_buf_, asio::transfer_exactly(bytes), wrapCallback(std::move(cb)));
+-    else if (cb)      ctx_.post([cb](){ cb(asio::error::operation_aborted, 0); });
++    else if (cb)      asio::post(ctx_, [cb](){ cb(asio::error::operation_aborted, 0); });
+ }
+ 
+ void
+@@ -720,7 +720,7 @@ Connection::async_read_some(size_t bytes, BytesHandlerCb cb)
+ {
+     std::lock_guard<std::mutex> lock(mutex_);
+     if (!is_open()) {
+-        if (cb) ctx_.post([cb](){ cb(asio::error::broken_pipe, 0); });
++        if (cb) asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
+         return;
+     }
+     auto buf = read_buf_.prepare(bytes);
+diff --git a/src/peer_discovery.cpp b/src/peer_discovery.cpp
+index 6fec07ae..0887c8e1 100644
+--- a/src/peer_discovery.cpp
++++ b/src/peer_discovery.cpp
+@@ -83,7 +83,7 @@ PeerDiscovery::DomainPeerDiscovery::DomainPeerDiscovery(asio::ip::udp domain, in
+     : logger_(logger)
+     , ioContext_(ioContext)
+     , sockFd_(*ioContext_, domain)
+-    , sockAddrSend_(asio::ip::address::from_string(domain.family() == AF_INET ? MULTICAST_ADDRESS_IPV4
++    , sockAddrSend_(asio::ip::make_address(domain.family() == AF_INET ? MULTICAST_ADDRESS_IPV4
+                                                                               : MULTICAST_ADDRESS_IPV6), port)
+ {
+     try {
+@@ -110,7 +110,7 @@ PeerDiscovery::DomainPeerDiscovery::startDiscovery(const std::string &type, Serv
+     callbackmap_[type] = callback;
+     if (not drunning_) {
+         drunning_ = true;
+-        ioContext_->post([this] () {
++        asio::post(*ioContext_, [this] () {
+                     loopListener();
+                     query(sockAddrSend_);
+                 });
+@@ -216,7 +216,7 @@ PeerDiscovery::DomainPeerDiscovery::startPublish(const std::string &type, const
+     messages_[type] = std::move(pack_buf_c);
+     reloadMessages();
+     lrunning_ = true;
+-    ioContext_->post([this] () { publish(sockAddrSend_); });
++    asio::post(*ioContext_, [this] () { publish(sockAddrSend_); });
+ }
+ 
+ bool
+-- 
+2.47.3
+
diff -Nru opendht-3.0.1/debian/patches/series opendht-3.0.1/debian/patches/series
--- opendht-3.0.1/debian/patches/series	2024-01-19 06:19:50.000000000 +0200
+++ opendht-3.0.1/debian/patches/series	2026-10-17 22:47:08.000000000 +0300
@@ -1,3 +1,5 @@
 1000-cmake-fix-no-atomic-64.patch
 2000-cmake-python-no-build-install.patch
 2010-install-dhtnode-http.patch
+0001-http-fix-service-name-resolution-failure.patch
+0002-adapt-for-Asio-1.34.patch

Reply via email to