Skip to content

Commit

Permalink
fix(main/transmission): Rebuild against miniupnpc 2.2.8
Browse files Browse the repository at this point in the history
It seems that miniupnpc 2.2.8 broke API compatibility - see
miniupnp/miniupnp#758.

This causes the current transmission package to segfault (#20490) as
well as the build to fail, so we here backport
transmission/transmission#6907 to fix that.

Closes #20490
  • Loading branch information
fornwall committed Jul 7, 2024
1 parent 4c06c3e commit 15408ac
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/transmission/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ TERMUX_PKG_LICENSE="GPL-2.0, GPL-3.0"
TERMUX_PKG_LICENSE_FILE="COPYING, licenses/gpl-2.0.txt, licenses/gpl-3.0.txt"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="4.0.6"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=git+https://github.com/transmission/transmission
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_GIT_BRANCH=$TERMUX_PKG_VERSION
Expand Down
71 changes: 71 additions & 0 deletions packages/transmission/miniupnpc-2.2.8.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
From 3523b928c8c968d0b7bca2c6c3a84a939e908f8c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C5=93ur?= <[email protected]>
Date: Mon, 10 Jun 2024 22:16:06 +0800
Subject: [PATCH 1/5] bump miniupnpc to 2.2.8

---
libtransmission/port-forwarding-upnp.cc | 4 ++++
third-party/miniupnp | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libtransmission/port-forwarding-upnp.cc b/libtransmission/port-forwarding-upnp.cc
index 6d7bbc7f7c2..d805bc18218 100644
--- a/libtransmission/port-forwarding-upnp.cc
+++ b/libtransmission/port-forwarding-upnp.cc
@@ -261,7 +261,11 @@ tr_port_forwarding_state tr_upnpPulse(

FreeUPNPUrls(&handle->urls);
auto lanaddr = std::array<char, TR_ADDRSTRLEN>{};
+#if (MINIUPNPC_API_VERSION >= 18)
+ if (UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1, NULL, 0) ==
+#else
if (UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1) ==
+#endif
UPNP_IGD_VALID_CONNECTED)
{
tr_logAddInfo(fmt::format(_("Found Internet Gateway Device '{url}'"), fmt::arg("url", handle->urls.controlURL)));
diff --git a/libtransmission/port-forwarding-upnp.cc b/libtransmission/port-forwarding-upnp.cc
index d805bc18218..fadf09bb2e5 100644
--- a/libtransmission/port-forwarding-upnp.cc
+++ b/libtransmission/port-forwarding-upnp.cc
@@ -261,12 +261,13 @@ tr_port_forwarding_state tr_upnpPulse(

FreeUPNPUrls(&handle->urls);
auto lanaddr = std::array<char, TR_ADDRSTRLEN>{};
+ if (
#if (MINIUPNPC_API_VERSION >= 18)
- if (UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1, NULL, 0) ==
+ UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1, NULL, 0)
#else
- if (UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1) ==
+ UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1)
#endif
- UPNP_IGD_VALID_CONNECTED)
+ == UPNP_IGD_VALID_CONNECTED)
{
tr_logAddInfo(fmt::format(_("Found Internet Gateway Device '{url}'"), fmt::arg("url", handle->urls.controlURL)));
tr_logAddInfo(fmt::format(_("Local Address is '{address}'"), fmt::arg("address", lanaddr.data())));

From 513327f6f3f216c53086191dc9876dcbe7cbeece Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C5=93ur?= <[email protected]>
Date: Wed, 12 Jun 2024 13:12:24 +0800
Subject: [PATCH 4/5] Update Transmission.xcodeproj/project.pbxproj

Co-authored-by: Mike Gelfand <[email protected]>
---
Transmission.xcodeproj/project.pbxproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libtransmission/port-forwarding-upnp.cc b/libtransmission/port-forwarding-upnp.cc
index fadf09bb2e5..a4146e0df13 100644
--- a/libtransmission/port-forwarding-upnp.cc
+++ b/libtransmission/port-forwarding-upnp.cc
@@ -263,7 +263,7 @@ tr_port_forwarding_state tr_upnpPulse(
auto lanaddr = std::array<char, TR_ADDRSTRLEN>{};
if (
#if (MINIUPNPC_API_VERSION >= 18)
- UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1, NULL, 0)
+ UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1, nullptr, 0)
#else
UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1)
#endif

0 comments on commit 15408ac

Please sign in to comment.