From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1303549-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id EDFE213933E
	for <garchives@archives.gentoo.org>; Sat, 17 Jul 2021 20:05:34 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 48091E0B92;
	Sat, 17 Jul 2021 20:05:34 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 220F6E0B92
	for <gentoo-commits@lists.gentoo.org>; Sat, 17 Jul 2021 20:05:34 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id E393F342AE9
	for <gentoo-commits@lists.gentoo.org>; Sat, 17 Jul 2021 20:05:32 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 355D1581
	for <gentoo-commits@lists.gentoo.org>; Sat, 17 Jul 2021 20:05:31 +0000 (UTC)
From: "Georgy Yakovlev" <gyakovlev@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Georgy Yakovlev" <gyakovlev@gentoo.org>
Message-ID: <1626552284.d091935d85df82d49cf2473e21881b7a2e628deb.gyakovlev@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: net-im/telegram-desktop/files/, net-im/telegram-desktop/
X-VCS-Repository: repo/gentoo
X-VCS-Files: net-im/telegram-desktop/files/tdesktop-2.8.9-disable-jemalloc-separately.patch net-im/telegram-desktop/telegram-desktop-2.8.10.ebuild
X-VCS-Directories: net-im/telegram-desktop/ net-im/telegram-desktop/files/
X-VCS-Committer: gyakovlev
X-VCS-Committer-Name: Georgy Yakovlev
X-VCS-Revision: d091935d85df82d49cf2473e21881b7a2e628deb
X-VCS-Branch: master
Date: Sat, 17 Jul 2021 20:05:31 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: e4eab3cb-a3cc-4b2b-aab9-e6253d3ec62c
X-Archives-Hash: 6d2f10c8fd19beb35fd38ed8ee249766

commit:     d091935d85df82d49cf2473e21881b7a2e628deb
Author:     Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
AuthorDate: Sat Jul 17 10:39:22 2021 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Sat Jul 17 20:04:44 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d091935d

net-im/telegram-desktop: Drop jemalloc patch

Upstream clarified; The glibc allocator causes telegram to use excessive
amounts of memory, and never free it. That's a bug.

See-also: https://github.com/telegramdesktop/tdesktop/issues/16084
See-also: https://github.com/desktop-app/cmake_helpers/pull/91#issuecomment-881788003
Closes: https://github.com/gentoo/gentoo/pull/21688
Signed-off-by: Esteve Varela Colominas <esteve.varela <AT> gmail.com>
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 ...desktop-2.8.9-disable-jemalloc-separately.patch | 100 ---------------------
 .../telegram-desktop-2.8.10.ebuild                 |  10 +--
 2 files changed, 3 insertions(+), 107 deletions(-)

diff --git a/net-im/telegram-desktop/files/tdesktop-2.8.9-disable-jemalloc-separately.patch b/net-im/telegram-desktop/files/tdesktop-2.8.9-disable-jemalloc-separately.patch
deleted file mode 100644
index dff2455d4e3..00000000000
--- a/net-im/telegram-desktop/files/tdesktop-2.8.9-disable-jemalloc-separately.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-Allow controlling the use of jemalloc
-
-Jemalloc is often controlled through USE=jemalloc in Gentoo. Removing or
-replacing it is trivial, and I'm not aware of any particular advantages that
-come with using this allocator, especially for an IM client. Benchmarks
-regarding this allocator provide a huge variety of results depending on the
-workload and system, so it's hard to establish when this allocator provides any
-tangible advantage.
-
-Considering things like Hardened Gentoo, the user might prefer to use a more
-exploit-resistant allocator, like GrapheneOS/hardened_malloc, and I've heard
-Musl is hardening their allocator as well.
-
-I trust the user can better judge if they need this in their particular setup.
-
-If a telegram dev is reading this, feel free to drop me a message (metadata.xml
-contains the maintainer's address), if you believe it should be forced due to
-usability concerns, or if you can provide me with some context I might be
-missing. Jemalloc is currently enabled by default.
-
---- tdesktop-2.8.9-full.orig/Telegram/SourceFiles/platform/linux/specific_linux.cpp
-+++ tdesktop-2.8.9-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp
-@@ -48,7 +48,10 @@
- #include <gio/gio.h>
- #include <glibmm.h>
- #include <giomm.h>
-+
-+#ifndef DESKTOP_APP_DISABLE_JEMALLOC
- #include <jemalloc/jemalloc.h>
-+#endif // !DESKTOP_APP_DISABLE_JEMALLOC
- 
- #include <sys/stat.h>
- #include <sys/types.h>
-@@ -727,8 +730,10 @@
- namespace Platform {
- 
- void start() {
-+#ifndef DESKTOP_APP_DISABLE_JEMALLOC
- 	auto backgroundThread = true;
- 	mallctl("background_thread", nullptr, nullptr, &backgroundThread, sizeof(bool));
-+#endif // !DESKTOP_APP_DISABLE_JEMALLOC
- 
- 	LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
- 
---- tdesktop-2.8.9-full.orig/cmake/external/CMakeLists.txt
-+++ tdesktop-2.8.9-full/cmake/external/CMakeLists.txt
-@@ -37,7 +37,7 @@
- 	add_checked_subdirectory(hunspell)
- endif()
- add_checked_subdirectory(iconv)
--if (LINUX)
-+if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC)
-     add_checked_subdirectory(jemalloc)
- endif()
- add_checked_subdirectory(jpeg)
---- tdesktop-2.8.9-full.orig/cmake/options.cmake
-+++ tdesktop-2.8.9-full/cmake/options.cmake
-@@ -56,6 +56,13 @@
-     )
- endif()
- 
-+if (DESKTOP_APP_DISABLE_JEMALLOC)
-+    target_compile_definitions(common_options
-+    INTERFACE
-+        DESKTOP_APP_DISABLE_JEMALLOC
-+    )
-+endif()
-+
- if (DESKTOP_APP_USE_PACKAGED)
-     target_compile_definitions(common_options
-     INTERFACE
---- tdesktop-2.8.9-full.orig/cmake/options_linux.cmake
-+++ tdesktop-2.8.9-full/cmake/options_linux.cmake
-@@ -58,10 +58,12 @@
-     endif()
- endif()
- 
--target_link_libraries(common_options
--INTERFACE
--    desktop-app::external_jemalloc
--)
-+if (NOT DESKTOP_APP_DISABLE_JEMALLOC)
-+    target_link_libraries(common_options
-+    INTERFACE
-+        desktop-app::external_jemalloc
-+    )
-+endif()
- 
- if (DESKTOP_APP_USE_PACKAGED)
-     find_library(ATOMIC_LIBRARY atomic)
---- tdesktop-2.8.9-full.orig/cmake/variables.cmake
-+++ tdesktop-2.8.9-full/cmake/variables.cmake
-@@ -38,6 +38,7 @@
- option(DESKTOP_APP_USE_PACKAGED_FFMPEG_STATIC "Link ffmpeg statically in packaged mode." OFF)
- option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." ${osx_special_target})
- option(DESKTOP_APP_DISABLE_WEBKIT "Disable WebkitGTK library (Linux only)." OFF)
-+option(DESKTOP_APP_DISABLE_JEMALLOC "Disable use of the jemalloc allocator (Linux only)." OFF)
- option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no_special_target})
- option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate})
- option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF)

diff --git a/net-im/telegram-desktop/telegram-desktop-2.8.10.ebuild b/net-im/telegram-desktop/telegram-desktop-2.8.10.ebuild
index 69bfb7c3a17..e738b91f41d 100644
--- a/net-im/telegram-desktop/telegram-desktop-2.8.10.ebuild
+++ b/net-im/telegram-desktop/telegram-desktop-2.8.10.ebuild
@@ -16,7 +16,7 @@ SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${
 LICENSE="BSD GPL-3-with-openssl-exception LGPL-2+"
 SLOT="0"
 KEYWORDS="~amd64 ~ppc64"
-IUSE="+dbus enchant +gtk +hunspell +jemalloc +spell wayland webkit +X"
+IUSE="+dbus enchant +gtk +hunspell +spell wayland webkit +X"
 REQUIRED_USE="
 	spell? (
 		^^ ( enchant hunspell )
@@ -29,6 +29,7 @@ RDEPEND="
 	!net-im/telegram-desktop-bin
 	app-arch/lz4:=
 	dev-cpp/glibmm:2
+	dev-libs/jemalloc:=
 	dev-libs/xxhash
 	>=dev-qt/qtcore-5.15:5
 	>=dev-qt/qtgui-5.15:5[dbus?,jpeg,png,wayland?,X(-)?]
@@ -53,7 +54,6 @@ RDEPEND="
 	enchant? ( app-text/enchant:= )
 	gtk? ( x11-libs/gtk+:3[X?,wayland?] )
 	hunspell? ( >=app-text/hunspell-1.7:= )
-	jemalloc? ( dev-libs/jemalloc:= )
 	wayland? ( kde-frameworks/kwayland:= )
 	webkit? ( net-libs/webkit-gtk:= )
 	X? ( x11-libs/libxcb:= )
@@ -74,9 +74,6 @@ PATCHES=(
 	# https://github.com/desktop-app/cmake_helpers/pull/91
 	# https://github.com/desktop-app/lib_webview/pull/2
 	"${FILESDIR}/tdesktop-2.8.9-disable-webkit-separately.patch"
-	# Not going to attempt upstreaming this after the reaction to
-	#  "disable-webkit-separately"
-	"${FILESDIR}/tdesktop-2.8.9-disable-jemalloc-separately.patch"
 	# Not a proper fix, not upstreamed
 	"${FILESDIR}/tdesktop-2.8.9-webview-fix-glib.patch"
 )
@@ -110,7 +107,6 @@ src_configure() {
 		-DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=$(usex dbus OFF ON)
 		-DDESKTOP_APP_DISABLE_GTK_INTEGRATION=$(usex gtk OFF ON)
 		-DDESKTOP_APP_DISABLE_WEBKIT=$(usex webkit OFF ON)
-		-DDESKTOP_APP_DISABLE_JEMALLOC=$(usex jemalloc OFF ON)
 		-DDESKTOP_APP_DISABLE_SPELLCHECK=$(usex spell OFF ON)  # enables hunspell (recommended)
 		-DDESKTOP_APP_USE_ENCHANT=$(usex enchant ON OFF)  # enables enchant and disables hunspell
 	)
@@ -143,5 +139,5 @@ src_configure() {
 
 pkg_postinst() {
 	xdg_pkg_postinst
-	use gtk || elog "enable 'gtk' useflag if you have image copy-paste problems"
+	use gtk || elog "enable the 'gtk' useflag if you have image copy-paste problems"
 }