CVS commit: pkgsrc/net

"Taylor R Campbell" <[email protected]>
Newsgroups gmane.os.netbsd.devel.pkgsrc.cvs
Message-ID <[email protected]>
Module Name:	pkgsrc
Committed By:	riastradh
Date:		Tue Aug 11 14:21:47 UTC 2026

Modified Files:
	pkgsrc/net/transmission: Makefile distinfo
	pkgsrc/net/transmission-common: Makefile
	pkgsrc/net/transmission-gtk: Makefile
	pkgsrc/net/transmission-qt: Makefile
Added Files:
	pkgsrc/net/transmission/patches: patch-libtransmission_crypto-utils.cc
	    patch-libtransmission_file-win32.cc
	    patch-libtransmission_torrent-files.cc
	    patch-libtransmission_utils.cc patch-libtransmission_utils.h
	    patch-libtransmission_web-utils.cc patch-utils_remote.cc

Log Message:
net/transmission: Fix ctype abuse.

Excluding the third-party/ directory for now -- lot more patching to do
for that.

PR pkg/60574: transmission-daemon etc. abort on invalid toupper(3) call


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 pkgsrc/net/transmission/Makefile
cvs rdiff -u -r1.30 -r1.31 pkgsrc/net/transmission/distinfo
cvs rdiff -u -r1.19 -r1.20 pkgsrc/net/transmission-common/Makefile
cvs rdiff -u -r1.88 -r1.89 pkgsrc/net/transmission-gtk/Makefile
cvs rdiff -u -r1.102 -r1.103 pkgsrc/net/transmission-qt/Makefile
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/net/transmission/patches/patch-libtransmission_crypto-utils.cc \
    pkgsrc/net/transmission/patches/patch-libtransmission_file-win32.cc \
    pkgsrc/net/transmission/patches/patch-libtransmission_torrent-files.cc \
    pkgsrc/net/transmission/patches/patch-libtransmission_utils.cc \
    pkgsrc/net/transmission/patches/patch-libtransmission_utils.h \
    pkgsrc/net/transmission/patches/patch-libtransmission_web-utils.cc \
    pkgsrc/net/transmission/patches/patch-utils_remote.cc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
(unnamed) (text/x-diff, 12 KB)
Modified files:

Index: pkgsrc/net/transmission/Makefile
diff -u pkgsrc/net/transmission/Makefile:1.54 pkgsrc/net/transmission/Makefile:1.55
--- pkgsrc/net/transmission/Makefile:1.54	Mon Jun 22 17:36:27 2026
+++ pkgsrc/net/transmission/Makefile	Tue Aug 11 14:21:47 2026
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile,v 1.54 2026/06/22 17:36:27 dogcow Exp $
+# $NetBSD: Makefile,v 1.55 2026/08/11 14:21:47 riastradh Exp $
+
+PKGREVISION=	1
 
 DEPENDS+=	transmission-common>=${VERSION}:../../net/transmission-common
 

Index: pkgsrc/net/transmission/distinfo
diff -u pkgsrc/net/transmission/distinfo:1.30 pkgsrc/net/transmission/distinfo:1.31
--- pkgsrc/net/transmission/distinfo:1.30	Fri Jul 10 03:39:42 2026
+++ pkgsrc/net/transmission/distinfo	Tue Aug 11 14:21:47 2026
@@ -1,5 +1,12 @@
-$NetBSD: distinfo,v 1.30 2026/07/10 03:39:42 dogcow Exp $
+$NetBSD: distinfo,v 1.31 2026/08/11 14:21:47 riastradh Exp $
 
 BLAKE2s (transmission-4.1.3.tar.xz) = a86e81e79f0614955afd97db9d559101ab45b8746995140d675560071f6b7fe1
 SHA512 (transmission-4.1.3.tar.xz) = 19deb0570a655e75ecb170d43b7761826bf54d3bfd1d6fe8d9d9fe1924820d71e99cb0241e8e45e8dde38f3f087a35e97730718ef8bc639975d232d5e9af0aa2
 Size (transmission-4.1.3.tar.xz) = 11845312 bytes
+SHA1 (patch-libtransmission_crypto-utils.cc) = a88acf0231b61fd62b869b1d0da5164acb32688c
+SHA1 (patch-libtransmission_file-win32.cc) = d35b7b2e73b043be2ce8aaf67e0581202cf69d66
+SHA1 (patch-libtransmission_torrent-files.cc) = 64bad2df3a9571280bb938e4b55e4a86dfe805fe
+SHA1 (patch-libtransmission_utils.cc) = eecc15a7431a86055d129c179351cae637c51711
+SHA1 (patch-libtransmission_utils.h) = f4523002cb2dece74c5900a3ef458fd7154fc7dd
+SHA1 (patch-libtransmission_web-utils.cc) = b4311ab83b3170603d7f87923a19a316305f587d
+SHA1 (patch-utils_remote.cc) = 4c7a38385bc13675a2328e6a5a7a880437d42208

Index: pkgsrc/net/transmission-common/Makefile
diff -u pkgsrc/net/transmission-common/Makefile:1.19 pkgsrc/net/transmission-common/Makefile:1.20
--- pkgsrc/net/transmission-common/Makefile:1.19	Mon Jun 22 17:36:27 2026
+++ pkgsrc/net/transmission-common/Makefile	Tue Aug 11 14:21:46 2026
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.19 2026/06/22 17:36:27 dogcow Exp $
+# $NetBSD: Makefile,v 1.20 2026/08/11 14:21:46 riastradh Exp $
 
 PKGNAME=	transmission-common-${VERSION}
+PKGREVISION=	1
 COMMENT=	Free, lightweight BitTorrent client (shared files)
 
 # do not add nb* to this - 4.0.0nb1 does not conflict

Index: pkgsrc/net/transmission-gtk/Makefile
diff -u pkgsrc/net/transmission-gtk/Makefile:1.88 pkgsrc/net/transmission-gtk/Makefile:1.89
--- pkgsrc/net/transmission-gtk/Makefile:1.88	Mon Jun 22 17:36:27 2026
+++ pkgsrc/net/transmission-gtk/Makefile	Tue Aug 11 14:21:46 2026
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.88 2026/06/22 17:36:27 dogcow Exp $
+# $NetBSD: Makefile,v 1.89 2026/08/11 14:21:46 riastradh Exp $
 
 PKGNAME=	transmission-gtk-${VERSION}
+PKGREVISION=	1
 COMMENT=	Free, lightweight BitTorrent client (GTK version)
 
 DEPENDS+=	transmission-common>=${VERSION}:../../net/transmission-common

Index: pkgsrc/net/transmission-qt/Makefile
diff -u pkgsrc/net/transmission-qt/Makefile:1.102 pkgsrc/net/transmission-qt/Makefile:1.103
--- pkgsrc/net/transmission-qt/Makefile:1.102	Mon Jul 13 04:36:26 2026
+++ pkgsrc/net/transmission-qt/Makefile	Tue Aug 11 14:21:47 2026
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.102 2026/07/13 04:36:26 wiz Exp $
+# $NetBSD: Makefile,v 1.103 2026/08/11 14:21:47 riastradh Exp $
 
 PKGNAME=	transmission-qt-${VERSION}
-PKGREVISION=	1
+PKGREVISION=	2
 COMMENT=	Free, lightweight BitTorrent client (QT version)
 
 DEPENDS+=	transmission-common>=${VERSION}:../../net/transmission-common

Added files:

Index: pkgsrc/net/transmission/patches/patch-libtransmission_crypto-utils.cc
diff -u /dev/null pkgsrc/net/transmission/patches/patch-libtransmission_crypto-utils.cc:1.1
--- /dev/null	Tue Aug 11 14:21:47 2026
+++ pkgsrc/net/transmission/patches/patch-libtransmission_crypto-utils.cc	Tue Aug 11 14:21:47 2026
@@ -0,0 +1,18 @@
+$NetBSD: patch-libtransmission_crypto-utils.cc,v 1.1 2026/08/11 14:21:47 riastradh Exp $
+
+Fix ctype(3) abuse.
+https://gnats.NetBSD.org/60574
+
+--- libtransmission/crypto-utils.cc.orig	2024-05-29 01:38:35.000000000 +0000
++++ libtransmission/crypto-utils.cc
+@@ -179,8 +179,8 @@ constexpr void tr_hex_to_binary(char con
+ 
+     for (size_t i = 0; i < byte_length; ++i)
+     {
+-        auto const upper_nibble = Hex.find(std::tolower(*input++));
+-        auto const lower_nibble = Hex.find(std::tolower(*input++));
++        auto const upper_nibble = Hex.find(std::tolower(static_cast<unsigned char>(*input++)));
++        auto const lower_nibble = Hex.find(std::tolower(static_cast<unsigned char>(*input++)));
+         *output++ = (uint8_t)((upper_nibble << 4) | lower_nibble);
+     }
+ }
Index: pkgsrc/net/transmission/patches/patch-libtransmission_file-win32.cc
diff -u /dev/null pkgsrc/net/transmission/patches/patch-libtransmission_file-win32.cc:1.1
--- /dev/null	Tue Aug 11 14:21:47 2026
+++ pkgsrc/net/transmission/patches/patch-libtransmission_file-win32.cc	Tue Aug 11 14:21:47 2026
@@ -0,0 +1,46 @@
+$NetBSD: patch-libtransmission_file-win32.cc,v 1.1 2026/08/11 14:21:47 riastradh Exp $
+
+--- libtransmission/file-win32.cc.orig	2026-06-29 23:12:56.000000000 +0000
++++ libtransmission/file-win32.cc
+@@ -118,14 +118,14 @@ bool is_valid_path(std::string_view path
+ {
+     if (is_unc_path(path))
+     {
+-        if (path[2] != '\0' && isalnum(path[2]) == 0)
++        if (path[2] != '\0' && isalnum(static_cast<unsigned char>(path[2])) == 0)
+         {
+             return false;
+         }
+     }
+     else if (auto const pos = path.find(':'); pos != std::string_view::npos)
+     {
+-        if (pos != 1 || isalpha(path[0]) == 0)
++        if (pos != 1 || isalpha(static_cast<unsigned char>(path[0])) == 0)
+         {
+             return false;
+         }
+@@ -448,13 +448,13 @@ bool tr_sys_path_is_relative(std::string
+     }
+ 
+     /* Local path: `X:` */
+-    if (std::size(path) == 2 && isalpha(path[0]) != 0 && path[1] == ':')
++    if (std::size(path) == 2 && isalpha(static_cast<unsigned char>(path[0])) != 0 && path[1] == ':')
+     {
+         return false;
+     }
+ 
+     /* Local path: `X:\...`. */
+-    if (std::size(path) > 2 && isalpha(path[0]) != 0 && path[1] == ':' && is_slash(path[2]))
++    if (std::size(path) > 2 && isalpha(static_cast<unsigned char>(path[0])) != 0 && path[1] == ':' && is_slash(path[2]))
+     {
+         return false;
+     }
+@@ -561,7 +561,7 @@ namespace
+ {
+ [[nodiscard]] bool isWindowsDeviceRoot(char ch) noexcept
+ {
+-    return isalpha(static_cast<int>(ch)) != 0;
++    return isalpha(static_cast<unsigned char>(ch)) != 0;
+ }
+ 
+ [[nodiscard]] constexpr bool isPathSeparator(char ch) noexcept
Index: pkgsrc/net/transmission/patches/patch-libtransmission_torrent-files.cc
diff -u /dev/null pkgsrc/net/transmission/patches/patch-libtransmission_torrent-files.cc:1.1
--- /dev/null	Tue Aug 11 14:21:47 2026
+++ pkgsrc/net/transmission/patches/patch-libtransmission_torrent-files.cc	Tue Aug 11 14:21:47 2026
@@ -0,0 +1,23 @@
+$NetBSD: patch-libtransmission_torrent-files.cc,v 1.1 2026/08/11 14:21:47 riastradh Exp $
+
+Fix ctype(3) abuse.
+https://gnats.NetBSD.org/60574
+
+--- libtransmission/torrent-files.cc.orig	2024-05-29 01:38:35.000000000 +0000
++++ libtransmission/torrent-files.cc
+@@ -335,13 +335,13 @@ namespace
+     // Shortcut to avoid extra work below.
+     // All the paths below involve filenames that begin with one of these chars
+     static auto constexpr ReservedFilesBeginWithOneOf = "ACLNP"sv;
+-    if (ReservedFilesBeginWithOneOf.find(toupper(in.front())) == std::string_view::npos)
++    if (ReservedFilesBeginWithOneOf.find(toupper(static_cast<unsigned char>(in.front()))) == std::string_view::npos)
+     {
+         return false;
+     }
+ 
+     auto in_upper = tr_pathbuf{ in };
+-    std::transform(std::begin(in_upper), std::end(in_upper), std::begin(in_upper), [](auto ch) { return toupper(ch); });
++    std::transform(std::begin(in_upper), std::end(in_upper), std::begin(in_upper), [](auto ch) { return toupper(static_cast<unsigned char>(ch)); });
+     auto const in_upper_sv = in_upper.sv();
+ 
+     static auto constexpr ReservedNames = std::array<std::string_view, 22>{
Index: pkgsrc/net/transmission/patches/patch-libtransmission_utils.cc
diff -u /dev/null pkgsrc/net/transmission/patches/patch-libtransmission_utils.cc:1.1
--- /dev/null	Tue Aug 11 14:21:47 2026
+++ pkgsrc/net/transmission/patches/patch-libtransmission_utils.cc	Tue Aug 11 14:21:47 2026
@@ -0,0 +1,13 @@
+$NetBSD: patch-libtransmission_utils.cc,v 1.1 2026/08/11 14:21:47 riastradh Exp $
+
+--- libtransmission/utils.cc.orig	2026-06-29 23:12:56.000000000 +0000
++++ libtransmission/utils.cc
+@@ -383,7 +383,7 @@ std::string tr_win32_format_message(uint
+     LocalFree(wide_text);
+ 
+     // Most (all?) messages contain "\r\n" in the end, chop it
+-    while (!std::empty(text) && isspace(text.back()) != 0)
++    while (!std::empty(text) && isspace(static_cast<unsigned char>(text.back())) != 0)
+     {
+         text.resize(text.size() - 1);
+     }
Index: pkgsrc/net/transmission/patches/patch-libtransmission_utils.h
diff -u /dev/null pkgsrc/net/transmission/patches/patch-libtransmission_utils.h:1.1
--- /dev/null	Tue Aug 11 14:21:47 2026
+++ pkgsrc/net/transmission/patches/patch-libtransmission_utils.h	Tue Aug 11 14:21:47 2026
@@ -0,0 +1,22 @@
+$NetBSD: patch-libtransmission_utils.h,v 1.1 2026/08/11 14:21:47 riastradh Exp $
+
+--- libtransmission/utils.h.orig	2026-06-29 23:12:56.000000000 +0000
++++ libtransmission/utils.h
+@@ -94,7 +94,7 @@ template<typename T>
+ [[nodiscard]] std::string tr_strlower(T in)
+ {
+     auto out = std::string{ std::move(in) };
+-    std::for_each(std::begin(out), std::end(out), [](char& ch) { ch = std::tolower(ch); });
++    std::for_each(std::begin(out), std::end(out), [](char& ch) { ch = std::tolower(static_cast<unsigned char>(ch)); });
+     return out;
+ }
+ 
+@@ -102,7 +102,7 @@ template<typename T>
+ [[nodiscard]] std::string tr_strupper(T in)
+ {
+     auto out = std::string{ std::move(in) };
+-    std::for_each(std::begin(out), std::end(out), [](char& ch) { ch = std::toupper(ch); });
++    std::for_each(std::begin(out), std::end(out), [](char& ch) { ch = std::toupper(static_cast<unsigned char>(ch)); });
+     return out;
+ }
+ 
Index: pkgsrc/net/transmission/patches/patch-libtransmission_web-utils.cc
diff -u /dev/null pkgsrc/net/transmission/patches/patch-libtransmission_web-utils.cc:1.1
--- /dev/null	Tue Aug 11 14:21:47 2026
+++ pkgsrc/net/transmission/patches/patch-libtransmission_web-utils.cc	Tue Aug 11 14:21:47 2026
@@ -0,0 +1,16 @@
+$NetBSD: patch-libtransmission_web-utils.cc,v 1.1 2026/08/11 14:21:47 riastradh Exp $
+
+Fix ctype(3) abuse.
+https://gnats.NetBSD.org/60574
+
+--- libtransmission/web-utils.cc.orig	2024-05-29 01:38:35.000000000 +0000
++++ libtransmission/web-utils.cc
+@@ -447,7 +447,7 @@ std::string tr_urlPercentDecode(std::str
+         }
+ 
+         in.remove_prefix(pos);
+-        if (std::size(in) >= 3 && in[0] == '%' && (std::isxdigit(in[1]) != 0) && (std::isxdigit(in[2]) != 0))
++        if (std::size(in) >= 3 && in[0] == '%' && (std::isxdigit(static_cast<unsigned char>(in[1])) != 0) && (std::isxdigit(static_cast<unsigned char>(in[2])) != 0))
+         {
+             auto hexstr = std::array<char, 3>{ in[1], in[2], '\0' };
+             auto const hex = strtoul(std::data(hexstr), nullptr, 16);
Index: pkgsrc/net/transmission/patches/patch-utils_remote.cc
diff -u /dev/null pkgsrc/net/transmission/patches/patch-utils_remote.cc:1.1
--- /dev/null	Tue Aug 11 14:21:47 2026
+++ pkgsrc/net/transmission/patches/patch-utils_remote.cc	Tue Aug 11 14:21:47 2026
@@ -0,0 +1,16 @@
+$NetBSD: patch-utils_remote.cc,v 1.1 2026/08/11 14:21:47 riastradh Exp $
+
+Fix ctype(3) abuse.
+https://gnats.NetBSD.org/60574
+
+--- utils/remote.cc.orig	2026-06-29 23:12:56.000000000 +0000
++++ utils/remote.cc
+@@ -623,7 +623,7 @@ void add_id_arg(tr_variant::Map& params,
+ 
+         for (auto const& ch : id_str)
+         {
+-            is_num = is_num && isdigit(ch);
++            is_num = is_num && isdigit(static_cast<unsigned char>(ch));
+         }
+ 
+         if (is_num || is_list)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.