Unverified Commit 7f4bb38f authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

jesec-rtorrent: drop (#463566)

parents d2a122eb 7b82f7c2
Loading
Loading
Loading
Loading
+0 −30
Original line number Diff line number Diff line
From dd4a96073d4a60ca8fff55be6ea6b17018de96a8 Mon Sep 17 00:00:00 2001
From: Varun Madiath <git@madiathv.com>
Date: Wed, 19 Jul 2023 15:30:57 -0400
Subject: [PATCH] utils: lockfile: avoid stack overflow for lockfile buffer

Original patch by @cyphar was submitted to rakshasa/rtorrent at
https://github.com/rakshasa/rtorrent/pull/1169.

Observed the segfault on nixos-unstable.
---
 src/utils/lockfile.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/utils/lockfile.cc b/src/utils/lockfile.cc
index 76e4b8f..441f5c8 100644
--- a/src/utils/lockfile.cc
+++ b/src/utils/lockfile.cc
@@ -75,7 +75,8 @@ Lockfile::try_lock() {
   int  pos = ::gethostname(buf, 255);
 
   if (pos == 0) {
-    ::snprintf(buf + std::strlen(buf), 255, ":+%i\n", ::getpid());
+    ssize_t len = std::strlen(buf);
+    ::snprintf(buf + len, 255 - len, ":+%i\n", ::getpid());
     ssize_t __attribute__((unused)) result = ::write(fd, buf, std::strlen(buf));
   }
 
-- 
2.41.0
+0 −77
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  curl,
  gtest,
  libtorrent,
  ncurses,
  jsonRpcSupport ? true,
  nlohmann_json,
  xmlRpcSupport ? true,
  xmlrpc_c,
}:

stdenv.mkDerivation rec {
  pname = "jesec-rtorrent";
  version = "0.9.8-r16";

  src = fetchFromGitHub {
    owner = "jesec";
    repo = "rtorrent";
    rev = "v${version}";
    hash = "sha256-i7c1jSawHshj1kaXl8tdpelIKU24okeg9K5/+ht6t2k=";
  };

  patches = [
    ./avoid-stack-overflow-for-lockfile-buf.patch
  ];

  passthru = {
    inherit libtorrent;
  };

  nativeBuildInputs = [
    cmake
  ];

  buildInputs = [
    curl
    libtorrent
    ncurses
  ]
  ++ lib.optional jsonRpcSupport nlohmann_json
  ++ lib.optional xmlRpcSupport xmlrpc_c;

  cmakeFlags = [
    "-DUSE_RUNTIME_CA_DETECTION=NO"
  ]
  ++ lib.optional (!jsonRpcSupport) "-DUSE_JSONRPC=NO"
  ++ lib.optional (!xmlRpcSupport) "-DUSE_XMLRPC=NO";

  doCheck = true;

  nativeCheckInputs = [
    gtest
  ];

  prePatch = ''
    substituteInPlace src/main.cc \
      --replace "/etc/rtorrent/rtorrent.rc" "${placeholder "out"}/etc/rtorrent/rtorrent.rc"
  '';

  postFixup = ''
    mkdir -p $out/etc/rtorrent
    cp $src/doc/rtorrent.rc $out/etc/rtorrent/rtorrent.rc
  '';

  meta = with lib; {
    description = "Ncurses client for libtorrent, ideal for use with screen, tmux, or dtach (jesec's fork)";
    homepage = "https://github.com/jesec/rtorrent";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ winter ];
    platforms = platforms.linux;
    mainProgram = "rtorrent";
  };
}
+0 −49
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  gtest,
  openssl,
  zlib,
}:

stdenv.mkDerivation rec {
  pname = "jesec-libtorrent";
  version = "0.13.8-r4";

  src = fetchFromGitHub {
    owner = "jesec";
    repo = "libtorrent";
    rev = "v${version}";
    hash = "sha256-jC/hgGSi2qy+ToZgdxl1PhASLYbUL0O8trX0th2v5H0=";
  };

  nativeBuildInputs = [
    cmake
  ];

  buildInputs = [
    openssl
    zlib
  ];

  # Disabled because a test is flaky; see https://github.com/jesec/libtorrent/issues/4.
  # doCheck = true;

  preCheck = ''
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD
  '';

  nativeCheckInputs = [
    gtest
  ];

  meta = with lib; {
    homepage = "https://github.com/jesec/libtorrent";
    description = "BitTorrent library written in C++ for *nix, with focus on high performance and good code (jesec's fork)";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ winter ];
    platforms = platforms.linux;
  };
}
+1 −0
Original line number Diff line number Diff line
@@ -748,6 +748,7 @@ mapAliases {
  jdk23_headless = throw "OpenJDK 23 was removed as it has reached its end of life"; # Added 2025-11-04
  jdk24 = throw "OpenJDK 24 was removed as it has reached its end of life"; # Added 2025-10-04
  jdk24_headless = throw "OpenJDK 24 was removed as it has reached its end of life"; # Added 2025-10-04
  jesec-rtorrent = throw "'jesec-rtorrent' has been removed due to lack of maintenance upstream."; # Added 2025-11-20
  jikespg = throw "'jikespg' has been removed due to lack of maintenance upstream."; # Added 2025-06-10
  jing = jing-trang; # Added 2025-09-18
  joplin = joplin-cli; # Added 2025-11-03
+0 −4
Original line number Diff line number Diff line
@@ -3321,10 +3321,6 @@ with pkgs;
  libportal-qt5 = libportal.override { variant = "qt5"; };
  libportal-qt6 = libportal.override { variant = "qt6"; };

  jesec-rtorrent = callPackage ../applications/networking/p2p/jesec-rtorrent {
    libtorrent = callPackage ../applications/networking/p2p/jesec-rtorrent/libtorrent.nix { };
  };

  librest = callPackage ../development/libraries/librest { };

  librest_1_0 = callPackage ../development/libraries/librest/1.0.nix { };