summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gentoo.org>2016-08-19 11:59:57 -0400
committerTim Harder <radhermit@gentoo.org>2016-08-19 11:59:57 -0400
commit1aa0ef91ef6ff4a91b84298221aa5ec4382b81dd (patch)
tree308aabea085cc3e978e220de1e43413b3d901dba /net-news/newsbeuter
parentdev-util/pycharm-professional: Version bump (bug 589840). (diff)
downloadgentoo-1aa0ef91ef6ff4a91b84298221aa5ec4382b81dd.tar.gz
gentoo-1aa0ef91ef6ff4a91b84298221aa5ec4382b81dd.tar.bz2
gentoo-1aa0ef91ef6ff4a91b84298221aa5ec4382b81dd.zip
net-news/newsbeuter: revision bump to fix various segfaults/memleaks
Diffstat (limited to 'net-news/newsbeuter')
-rw-r--r--net-news/newsbeuter/files/newsbeuter-2.9-fix-mem-leak.patch88
-rw-r--r--net-news/newsbeuter/files/newsbeuter-2.9-fix-segfault.patch57
-rw-r--r--net-news/newsbeuter/newsbeuter-2.9-r1.ebuild68
3 files changed, 213 insertions, 0 deletions
diff --git a/net-news/newsbeuter/files/newsbeuter-2.9-fix-mem-leak.patch b/net-news/newsbeuter/files/newsbeuter-2.9-fix-mem-leak.patch
new file mode 100644
index 000000000000..214d8ed9fba1
--- /dev/null
+++ b/net-news/newsbeuter/files/newsbeuter-2.9-fix-mem-leak.patch
@@ -0,0 +1,88 @@
+From cdacfbde9fe3ae2489fc96d35dfb7d263ab03f50 Mon Sep 17 00:00:00 2001
+From: cpubug <admin@crtx.ru>
+Date: Sun, 8 Nov 2015 13:15:25 +0300
+Subject: [PATCH] fixed a memory leak
+
+---
+ include/rss.h | 4 ++--
+ src/rss.cpp | 7 +++++--
+ 2 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/include/rss.h b/include/rss.h
+index bc0ef03..f8c87f2 100644
+--- a/include/rss.h
++++ b/include/rss.h
+@@ -117,7 +117,7 @@ class rss_item : public matchable {
+
+ void set_feedptr(std::shared_ptr<rss_feed> ptr);
+ inline std::shared_ptr<rss_feed> get_feedptr() {
+- return feedptr;
++ return feedptr_.lock();
+ }
+
+ inline bool deleted() const {
+@@ -167,7 +167,7 @@ class rss_item : public matchable {
+ bool enqueued_;
+ std::string flags_;
+ std::string oldflags_;
+- std::shared_ptr<rss_feed> feedptr;
++ std::weak_ptr<rss_feed> feedptr_;
+ bool deleted_;
+ unsigned int idx;
+ std::string base;
+diff --git a/src/rss.cpp b/src/rss.cpp
+index 1687cbe..9cf0cce 100644
+--- a/src/rss.cpp
++++ b/src/rss.cpp
+@@ -27,7 +27,6 @@ rss_item::rss_item(cache * c) : pubDate_(0), unread_(true), ch(c), enqueued_(fal
+ }
+
+ rss_item::~rss_item() {
+- feedptr.reset();
+ // LOG(LOG_CRITICAL, "delete rss_item");
+ }
+
+@@ -91,6 +90,7 @@ void rss_item::set_unread_nowrite(bool u) {
+
+ void rss_item::set_unread_nowrite_notify(bool u, bool notify) {
+ unread_ = u;
++ std::shared_ptr<rss_feed> feedptr = feedptr_.lock();
+ if (feedptr && notify) {
+ feedptr->get_item_by_guid(guid_)->set_unread_nowrite(unread_); // notify parent feed
+ }
+@@ -100,6 +100,7 @@ void rss_item::set_unread(bool u) {
+ if (unread_ != u) {
+ bool old_u = unread_;
+ unread_ = u;
++ std::shared_ptr<rss_feed> feedptr = feedptr_.lock();
+ if (feedptr)
+ feedptr->get_item_by_guid(guid_)->set_unread_nowrite(unread_); // notify parent feed
+ try {
+@@ -243,6 +244,7 @@ bool rss_item::has_attribute(const std::string& attribname) {
+ return true;
+
+ // if we have a feed, then forward the request
++ std::shared_ptr<rss_feed> feedptr = feedptr_.lock();
+ if (feedptr)
+ return feedptr->rss_feed::has_attribute(attribname);
+
+@@ -276,6 +278,7 @@ std::string rss_item::get_attribute(const std::string& attribname) {
+ return utils::to_string<unsigned int>(idx);
+
+ // if we have a feed, then forward the request
++ std::shared_ptr<rss_feed> feedptr = feedptr_.lock();
+ if (feedptr)
+ return feedptr->rss_feed::get_attribute(attribname);
+
+@@ -563,7 +566,7 @@ void rss_feed::set_feedptrs(std::shared_ptr<rss_feed> self) {
+ }
+
+ void rss_item::set_feedptr(std::shared_ptr<rss_feed> ptr) {
+- feedptr = ptr;
++ feedptr_ = std::weak_ptr<rss_feed>(ptr);
+ }
+
+ std::string rss_feed::get_status() {
+--
+2.9.3
+
diff --git a/net-news/newsbeuter/files/newsbeuter-2.9-fix-segfault.patch b/net-news/newsbeuter/files/newsbeuter-2.9-fix-segfault.patch
new file mode 100644
index 000000000000..aa6d1b2a817d
--- /dev/null
+++ b/net-news/newsbeuter/files/newsbeuter-2.9-fix-segfault.patch
@@ -0,0 +1,57 @@
+diff --git a/include/poddlthread.h b/include/poddlthread.h
+index a10b9e7..cf0f1da 100644
+--- a/include/poddlthread.h
++++ b/include/poddlthread.h
+@@ -7,6 +7,7 @@
+
+ #include <sys/time.h>
+ #include <time.h>
++#include <memory>
+
+ #include <configcontainer.h>
+
+@@ -24,7 +25,7 @@ class poddlthread {
+ private:
+ void mkdir_p(const char * file);
+ download * dl;
+- std::ofstream *f;
++ std::shared_ptr<std::ofstream> f;
+ timeval tv1;
+ timeval tv2;
+ size_t bytecount;
+diff --git a/src/pb_controller.cpp b/src/pb_controller.cpp
+index 09b5e89..da8ffcb 100644
+--- a/src/pb_controller.cpp
++++ b/src/pb_controller.cpp
+@@ -287,6 +287,7 @@ void pb_controller::start_downloads() {
+ if (it->status() == DL_QUEUED) {
+ std::thread t {poddlthread(&(*it), cfg)};
+ --dl2start;
++ t.detach();
+ }
+ }
+ }
+diff --git a/src/pb_view.cpp b/src/pb_view.cpp
+index fb61c72..f3cb478 100644
+--- a/src/pb_view.cpp
++++ b/src/pb_view.cpp
+@@ -111,6 +111,7 @@ void pb_view::run(bool auto_download) {
+ if (idx != -1) {
+ if (ctrl->downloads()[idx].status() != DL_DOWNLOADING) {
+ std::thread t {poddlthread(&ctrl->downloads()[idx], ctrl->get_cfgcont())};
++ t.detach();
+ }
+ }
+ }
+diff --git a/src/poddlthread.cpp b/src/poddlthread.cpp
+index 583481e..3a1b390 100644
+--- a/src/poddlthread.cpp
++++ b/src/poddlthread.cpp
+@@ -22,7 +22,6 @@ poddlthread::poddlthread(download * dl_, newsbeuter::configcontainer * c) : dl(d
+ }
+
+ poddlthread::~poddlthread() {
+- delete f;
+ }
+
+ void poddlthread::operator()() {
diff --git a/net-news/newsbeuter/newsbeuter-2.9-r1.ebuild b/net-news/newsbeuter/newsbeuter-2.9-r1.ebuild
new file mode 100644
index 000000000000..a7b24b167fcb
--- /dev/null
+++ b/net-news/newsbeuter/newsbeuter-2.9-r1.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit toolchain-funcs
+
+DESCRIPTION="A RSS/Atom feed reader for the text console"
+HOMEPAGE="http://www.newsbeuter.org/index.html"
+SRC_URI="http://www.${PN}.org/downloads/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="test"
+
+RDEPEND="
+ >=dev-db/sqlite-3.5:3
+ >=dev-libs/stfl-0.21
+ >=net-misc/curl-7.18.0
+ >=dev-libs/json-c-0.11:=
+ dev-libs/libxml2
+ sys-libs/ncurses:0=[unicode]
+"
+DEPEND="${RDEPEND}
+ dev-lang/perl
+ virtual/pkgconfig
+ sys-devel/gettext
+ test? (
+ dev-libs/boost
+ sys-devel/bc
+ )
+"
+
+# tests require network access
+RESTRICT="test"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.9-ncurses6.patch
+ "${FILESDIR}"/${PN}-2.9-fix-mem-leak.patch
+ "${FILESDIR}"/${PN}-2.9-fix-segfault.patch
+)
+
+src_prepare() {
+ default
+ sed -i 's:-ggdb::' Makefile || die
+}
+
+src_configure() {
+ ./config.sh || die
+}
+
+src_compile() {
+ emake prefix="/usr" CXX="$(tc-getCXX)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)"
+}
+
+src_test() {
+ emake test
+ # Tests fail if in ${S} rather than in ${S}/test
+ cd "${S}"/test
+ ./test || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" prefix="/usr" PACKAGE="${PF}" install
+ dodoc AUTHORS README CHANGES
+}