net-proxy/torsocks: version bump to 2.3.0, bug #680502
authorAnthony G. Basile <blueness@gentoo.org>
Thu, 3 Oct 2019 13:57:24 +0000 (09:57 -0400)
committerAnthony G. Basile <blueness@gentoo.org>
Thu, 3 Oct 2019 13:57:24 +0000 (09:57 -0400)
Closes: https://bugs.gentoo.org/680502
Package-Manager: Portage-2.3.76, Repoman-2.3.16
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
net-proxy/torsocks/Manifest
net-proxy/torsocks/files/torsocks-2.3.0-fix-syscall.patch [new file with mode: 0644]
net-proxy/torsocks/torsocks-2.3.0.ebuild [new file with mode: 0644]

index e91855d4925e0f42dce036a06794bd0ec60c2ba3..8c6d485bcea399fcd8b0c962c639e3752a72ad4f 100644 (file)
@@ -1 +1,2 @@
 DIST torsocks-2.2.0.tar.gz 115269 BLAKE2B e6e376dbe9b248bcb51fb0c3c16346f4888310abd6e84942acca69f67ae15afe5dfeba9a6b3a8d1fa562f87548450af93cea3bea4d899980ca6acb651658cfaa SHA512 903d11d58ece76eaf75ff8fc11a27e4a29f94be530f2d77d1a6f0982d556a4b9c78677a43eed88f2451054d0e985672900ecf73b360fa09e80195c3b9006622b
+DIST torsocks-2.3.0.tar.gz 118033 BLAKE2B a4329ffa5e20204024c4f7dda8619ba2d3e2a5f370727acdc720527688bdb3f8735b0386dfa07758fe59e1890f9ce88bb148a1b0c401bbb5966d2fe17934ca61 SHA512 139f4cf60191632add8bc845b2d68d25a0285e9746988167d832e50cedb8083f2765571429d3a11350fa2d327a1ff0a0ead9b464dac90d897b13ab948f609114
diff --git a/net-proxy/torsocks/files/torsocks-2.3.0-fix-syscall.patch b/net-proxy/torsocks/files/torsocks-2.3.0-fix-syscall.patch
new file mode 100644 (file)
index 0000000..93eb7ad
--- /dev/null
@@ -0,0 +1,94 @@
+From 4c00ec8773fd63fa48ef49e1ccf2adac598427be Mon Sep 17 00:00:00 2001
+From: Alejandro Alvarado <44826516+seisvelas@users.noreply.github.com>
+Date: Mon, 17 Dec 2018 19:25:18 -0600
+Subject: Add getdents / getdents64 support re ticket 28861
+
+---
+ src/common/compat.h |  8 ++++++++
+ src/lib/syscall.c   | 37 +++++++++++++++++++++++++++++++++++++
+ 2 files changed, 45 insertions(+)
+
+diff --git a/src/common/compat.h b/src/common/compat.h
+index a9b73c2..d79301f 100644
+--- a/src/common/compat.h
++++ b/src/common/compat.h
+@@ -129,6 +129,12 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void));
+ #ifndef __NR_memfd_create
+ #define __NR_memfd_create -19
+ #endif
++#ifndef __NR_getdents
++#define __NR_getdents -20
++#endif
++#ifndef __NR_getdents64
++#define __NR_getdents64 -21
++#endif
+ #define TSOCKS_NR_SOCKET    __NR_socket
+ #define TSOCKS_NR_CONNECT   __NR_connect
+@@ -149,6 +155,8 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void));
+ #define TSOCKS_NR_CLOCK_GETTIME __NR_clock_gettime
+ #define TSOCKS_NR_FORK      __NR_fork
+ #define TSOCKS_NR_MEMFD_CREATE __NR_memfd_create
++#define TSOCKS_NR_GETDENTS __NR_getdents
++#define TSOCKS_NR_GETDENTS64 __NR_getdents64
+ /*
+  * Despite glibc providing wrappers for these calls for a long time
+diff --git a/src/lib/syscall.c b/src/lib/syscall.c
+index 7fba580..f793da7 100644
+--- a/src/lib/syscall.c
++++ b/src/lib/syscall.c
+@@ -437,6 +437,37 @@ static LIBC_SYSCALL_RET_TYPE handle_memfd_create(va_list args)
+       return tsocks_libc_syscall(TSOCKS_NR_MEMFD_CREATE, name, flags);
+ }
++/*
++ * Handle getdents(2) syscall.
++ */
++static LIBC_SYSCALL_RET_TYPE handle_getdents(va_list args)
++{
++      unsigned int fd;
++      struct linux_dirent *dirp;
++      unsigned int count;
++
++      fd = va_arg(args, __typeof__(fd));
++      dirp = va_arg(args, __typeof__(dirp));
++      count = va_arg(args, __typeof__(count));
++
++      return tsocks_libc_syscall(TSOCKS_NR_GETDENTS, fd, dirp, count);
++}
++/*
++ * Handle getdents64(2) syscall.
++ */
++static LIBC_SYSCALL_RET_TYPE handle_getdents64(va_list args)
++{
++      unsigned int fd;
++      struct linux_dirent64 *dirp;
++      unsigned int count;
++
++      fd = va_arg(args, __typeof__(fd));
++      dirp = va_arg(args, __typeof__(dirp));
++      count = va_arg(args, __typeof__(count));
++
++      return tsocks_libc_syscall(TSOCKS_NR_GETDENTS64, fd, dirp, count);
++}
++
+ #endif /* __linux__ */
+ /*
+@@ -558,6 +589,12 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int number, va_list args)
+       case TSOCKS_NR_MEMFD_CREATE:
+               ret = handle_memfd_create(args);
+               break;
++      case TSOCKS_NR_GETDENTS:
++              ret = handle_getdents(args);
++              break;
++      case TSOCKS_NR_GETDENTS64:
++              ret = handle_getdents64(args);
++              break;
+ #endif /* __linux__ */
+       default:
+               /*
+-- 
+cgit v1.1
+
diff --git a/net-proxy/torsocks/torsocks-2.3.0.ebuild b/net-proxy/torsocks/torsocks-2.3.0.ebuild
new file mode 100644 (file)
index 0000000..185229c
--- /dev/null
@@ -0,0 +1,48 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools
+
+MY_PV="$(ver_rs 3 -)"
+MY_PF="${PN}-${MY_PV}"
+S=${WORKDIR}/${MY_PF}
+
+DESCRIPTION="Use most socks-friendly applications with Tor"
+HOMEPAGE="https://github.com/dgoulet/torsocks"
+SRC_URI="https://github.com/dgoulet/torsocks/archive/v${MY_PV}.tar.gz -> ${MY_PF}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="static-libs"
+
+# We do not depend on tor which might be running on a different box
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}"/${P}-fix-syscall.patch )
+
+src_prepare() {
+       # Disable tests requiring network access.
+       local test
+       for test in dns fd_passing getpeername; do
+               sed -i -e "/^   test_${test} \\\\\$/d" tests/Makefile.am || \
+                       die "failed to disable network tests"
+       done
+
+       default
+       eautoreconf
+}
+
+src_configure() {
+       econf $(use_enable static-libs static)
+}
+
+src_install() {
+       default
+
+       # Remove libtool .la files
+       find "${D}" -name '*.la' -delete || die
+}