summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Alfredsen <loki_val@gentoo.org>2008-10-22 15:43:21 +0000
committerPeter Alfredsen <loki_val@gentoo.org>2008-10-22 15:43:21 +0000
commit31f4f31acf5525f87dced72a51a433af110da562 (patch)
tree84f6a2f12f09d9f0c17945aa52470d6048955a56 /net-libs
parentmedia-libs/mesa: pkgmove from xf86-video-i810 to xf86-video-intel (diff)
downloadhistorical-31f4f31acf5525f87dced72a51a433af110da562.tar.gz
historical-31f4f31acf5525f87dced72a51a433af110da562.tar.bz2
historical-31f4f31acf5525f87dced72a51a433af110da562.zip
Fix _ZN7torrent9PollEPoll7performEv crash with fix from upstream ticket 1497 by Josef Drexler.
Package-Manager: portage-2.2_rc12/cvs/Linux 2.6.27 x86_64
Diffstat (limited to 'net-libs')
-rw-r--r--net-libs/libtorrent/ChangeLog9
-rw-r--r--net-libs/libtorrent/Manifest4
-rw-r--r--net-libs/libtorrent/files/libtorrent-0.12.3-fix-poll_fd.patch230
-rw-r--r--net-libs/libtorrent/libtorrent-0.12.3-r1.ebuild51
4 files changed, 292 insertions, 2 deletions
diff --git a/net-libs/libtorrent/ChangeLog b/net-libs/libtorrent/ChangeLog
index 74426c9f3398..9ea46ef9ea8c 100644
--- a/net-libs/libtorrent/ChangeLog
+++ b/net-libs/libtorrent/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for net-libs/libtorrent
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-libs/libtorrent/ChangeLog,v 1.129 2008/10/04 12:57:07 ranger Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-libs/libtorrent/ChangeLog,v 1.130 2008/10/22 15:43:20 loki_val Exp $
+
+*libtorrent-0.12.3-r1 (22 Oct 2008)
+
+ 22 Oct 2008; Peter Alfredsen <loki_val@gentoo.org>
+ +files/libtorrent-0.12.3-fix-poll_fd.patch, +libtorrent-0.12.3-r1.ebuild:
+ Fix _ZN7torrent9PollEPoll7performEv crash with fix from upstream ticket
+ 1497 by Josef Drexler.
04 Oct 2008; Brent Baude <ranger@gentoo.org> libtorrent-0.12.2-r4.ebuild:
Marking libtorrent-0.12.2-r4 ppc64 for bug 238611
diff --git a/net-libs/libtorrent/Manifest b/net-libs/libtorrent/Manifest
index f763a2d79da8..6e80ebe01c67 100644
--- a/net-libs/libtorrent/Manifest
+++ b/net-libs/libtorrent/Manifest
@@ -10,12 +10,14 @@ AUX libtorrent-0.12.2-fix_write_datagram.patch 554 RMD160 cbd6d3804fad36b2655f57
AUX libtorrent-0.12.2-lt-ver.patch 578 RMD160 03fc5d5326bd457c6386db791ceda7e187e8bae2 SHA1 2586464297a9ccc0004d99ef99647715e5cd54ff SHA256 14aedb58c898692be6963a582b55d599f93a74733539238a1f2d0f7c14542586
AUX libtorrent-0.12.2-tracker_timer_fix.patch 952 RMD160 ccf4df0575210f95e758ecee92bc9455c6b470d1 SHA1 5f197cf78a80f31c8770d3dcf7fa5eda215bb0a8 SHA256 ac8669a130de34c5ea4a43eef7da439125ca1ff8ccf3c0ac4a77d8717b839d97
AUX libtorrent-0.12.3-fix-epoll-crash.patch 1296 RMD160 1adf575ccd93ed6c21bc6f6ac1eb1cd841110f3a SHA1 444668456fa5aee9f79f69a7799f79e9a39ec91a SHA256 f632014d8a38762c2da0cedf558257469cddae1d0a8d7a3e66b90ce1c7c7f0a8
+AUX libtorrent-0.12.3-fix-poll_fd.patch 8048 RMD160 ed219de71bafad0859bb4bd2a14873618cb992d6 SHA1 74cb2c141c1c6ff0789108d4df725fdffd9f6e7d SHA256 e4b2b67ec8933d5b667d80b7f2d9e0d21f25f9e1016c4a1c5ea52f2a9b7b1a61
DIST libtorrent-0.11.9.tar.gz 545210 RMD160 fb8de66d65791dab67c195356a98de7cf653d3c9 SHA1 d88e754d1c2ff7f8c5fb7544331264bd505870b8 SHA256 71f09218a7784b21ab53cdfcd8fa122da60352e5ca117fda7cd8d2763f908a08
DIST libtorrent-0.12.2.tar.gz 585374 RMD160 88cdc415f98afd8b87fa6d7330906737c3e434fa SHA1 a53d2c671e9f2dd971d0622d5b3672da91c46ef9 SHA256 cf9d2cd667fd6939a3e0bd27e48d0c7f35d9ab2f7affbb3214da03fd2c1360a8
DIST libtorrent-0.12.3.tar.gz 598178 RMD160 a770d3026c88c1f17656243e9060e3bfebdd33c2 SHA1 4f27fb0ab076ee30d14db2378340ffa3b72002e3 SHA256 6044618e37c2925615a08517e8b69ef84147ef5287a222fc451968b36a0a9be7
EBUILD libtorrent-0.11.9.ebuild 1092 RMD160 da7b3481dc661adc564d9fe18b1af41bf9020ec0 SHA1 9d45afa155e37477e94dc9b8ff9d97e9f16a8260 SHA256 66270b7da8e7989c851b569e58f4a342d7080db6470be02998cb4c435120aabe
EBUILD libtorrent-0.12.2-r3.ebuild 1594 RMD160 4b6b696be6342abee4c1a77a4e3e11c69958993e SHA1 23c314c013e5fe6184d4d0dc8754ebbe356885f2 SHA256 3e78d22de16d3d31af3e6897d412ad825e86d3c03f4716d9a28c98788a69d456
EBUILD libtorrent-0.12.2-r4.ebuild 1648 RMD160 9217d7bbecc0c1d4f22aa873d700193d755a96e7 SHA1 06fe08a0b20b4f4b7ebc519eeeb45620ee01b033 SHA256 402523679b0e61106b80faec7c42d25a6b8a0bd1433a56a7776a066b3c1d5d6e
+EBUILD libtorrent-0.12.3-r1.ebuild 1276 RMD160 a615dd60848b3fd4a25f114f858c85a35bed2898 SHA1 203009b57a08e8448e9eb0b6ee052ccee0952eb6 SHA256 866f8a117fd99266f82eaf2f240031d11ff889d9f90362f713cf1999e332e5f0
EBUILD libtorrent-0.12.3.ebuild 1234 RMD160 825795dc4fa983f73a4f512ced2155884d3c89ee SHA1 3308b230458e0c6357c3818a912c52f87907d592 SHA256 ac4cc8e06459733fb8ba514495112607dcd1adf655f23d223398ece89f7c641d
-MISC ChangeLog 19681 RMD160 6469bbd4c443ea2075e590f00810d265994efcb0 SHA1 09d33b5a0800015a9db51fd9d699e02f316aef69 SHA256 072912c973cdc733946c8ecc77a6be030c8bbe4fa63ad143d2f48b52de6e1e65
+MISC ChangeLog 19949 RMD160 733966a2cae0fbf9be5e716ab4a04f23c0503ccb SHA1 7a5fb5fa5b589d7f5f846e2a04123147302ef9aa SHA256 710cb103358d43c7d308f85b9dd1f0d1ce2c14e391fb77448f25196734dcaefe
MISC metadata.xml 436 RMD160 4546e998ce9c6303f4c91d7413b1f732bbb2a8aa SHA1 fb1f2cddef7e268bf64572615fbc3c326ed673fd SHA256 936fb95c2c44078d98c0c74d0b148744036d6a18d40b8b482d7656ef0e211bff
diff --git a/net-libs/libtorrent/files/libtorrent-0.12.3-fix-poll_fd.patch b/net-libs/libtorrent/files/libtorrent-0.12.3-fix-poll_fd.patch
new file mode 100644
index 000000000000..2d6d7afc87b4
--- /dev/null
+++ b/net-libs/libtorrent/files/libtorrent-0.12.3-fix-poll_fd.patch
@@ -0,0 +1,230 @@
+# Changes epoll/kqueue to operate by file descriptors, not
+# event pointers, to hopefully fix the recent poll crashes.
+Index: libtorrent/src/torrent/poll_epoll.cc
+===================================================================
+--- libtorrent/src/torrent/poll_epoll.cc (revision 1072)
++++ libtorrent/src/torrent/poll_epoll.cc (working copy)
+@@ -37,6 +37,7 @@
+ #include "config.h"
+
+ #include <cerrno>
++#include <cstring>
+
+ #include <unistd.h>
+ #include <torrent/exceptions.h>
+@@ -60,7 +61,7 @@
+
+ inline void
+ PollEPoll::set_event_mask(Event* e, uint32_t m) {
+- m_table[e->file_descriptor()] = std::make_pair(m, e);
++ m_table[e->file_descriptor()] = Table::value_type(m, e);
+ }
+
+ inline void
+@@ -70,7 +71,7 @@
+
+ epoll_event e;
+ e.data.u64 = 0; // Make valgrind happy? Remove please.
+- e.data.ptr = event;
++ e.data.fd = event->file_descriptor();
+ e.events = mask;
+
+ set_event_mask(event, mask);
+@@ -81,16 +82,20 @@
+ return;
+
+ // Handle some libcurl/c-ares bugs by retrying once.
++ int retry = op;
+ if (op == EPOLL_CTL_ADD && errno == EEXIST) {
+- op = EPOLL_CTL_MOD;
++ retry = EPOLL_CTL_MOD;
+ errno = 0;
+ } else if (op == EPOLL_CTL_MOD && errno == ENOENT) {
+- op = EPOLL_CTL_ADD;
++ retry = EPOLL_CTL_ADD;
+ errno = 0;
+ }
+
+- if (errno || epoll_ctl(m_fd, op, event->file_descriptor(), &e))
+- throw internal_error("PollEPoll::modify(...) epoll_ctl call failed");
++ if (errno || epoll_ctl(m_fd, retry, event->file_descriptor(), &e)) {
++ char errmsg[1024];
++ snprintf(errmsg, sizeof(errmsg), "PollEPoll::modify(...) epoll_ctl(%d, %d -> %d, %d, [%p:%x]) = %d: %s", m_fd, op, retry, event->file_descriptor(), event, mask, errno, strerror(errno));
++ throw internal_error(errmsg);
++ }
+ }
+ }
+
+@@ -138,20 +143,25 @@
+ void
+ PollEPoll::perform() {
+ for (epoll_event *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr) {
++ if (itr->data.fd < 0 || (size_t)itr->data.fd >= m_table.size())
++ continue;
++
++ Table::iterator evItr = m_table.begin() + itr->data.fd;
++
+ // Each branch must check for data.ptr != NULL to allow the socket
+ // to remove itself between the calls.
+ //
+ // TODO: Make it so that it checks that read/write is wanted, that
+ // it wasn't removed from one of them but not closed.
+
+- if (itr->events & EPOLLERR && itr->data.ptr != NULL && event_mask((Event*)itr->data.ptr) & EPOLLERR)
+- ((Event*)itr->data.ptr)->event_error();
++ if (itr->events & EPOLLERR && evItr->second != NULL && evItr->first & EPOLLERR)
++ evItr->second->event_error();
+
+- if (itr->events & EPOLLIN && itr->data.ptr != NULL && event_mask((Event*)itr->data.ptr) & EPOLLIN)
+- ((Event*)itr->data.ptr)->event_read();
++ if (itr->events & EPOLLIN && evItr->second != NULL && evItr->first & EPOLLIN)
++ evItr->second->event_read();
+
+- if (itr->events & EPOLLOUT && itr->data.ptr != NULL && event_mask((Event*)itr->data.ptr) & EPOLLOUT)
+- ((Event*)itr->data.ptr)->event_write();
++ if (itr->events & EPOLLOUT && evItr->second != NULL && evItr->first & EPOLLOUT)
++ evItr->second->event_write();
+ }
+
+ m_waitingEvents = 0;
+@@ -173,9 +183,14 @@
+ if (event_mask(event) != 0)
+ throw internal_error("PollEPoll::close(...) called but the file descriptor is active");
+
++ m_table[event->file_descriptor()] = Table::value_type();
++
++ /*
++ Shouldn't be needed anymore.
+ for (epoll_event *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr)
+ if (itr->data.ptr == event)
+ itr->data.ptr = NULL;
++ */
+ }
+
+ void
+@@ -183,12 +198,14 @@
+ // Kernel removes closed FDs automatically, so just clear the mask and remove it from pending calls.
+ // Don't touch if the FD was re-used before we received the close notification.
+ if (m_table[event->file_descriptor()].second == event)
+- set_event_mask(event, 0);
++ m_table[event->file_descriptor()] = Table::value_type();
+
++ /*
+ for (epoll_event *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr) {
+ if (itr->data.ptr == event)
+ itr->data.ptr = NULL;
+ }
++ */
+ }
+
+ // Use custom defines for EPOLL* to make the below code compile with
+Index: libtorrent/src/torrent/poll_kqueue.cc
+===================================================================
+--- libtorrent/src/torrent/poll_kqueue.cc (revision 1072)
++++ libtorrent/src/torrent/poll_kqueue.cc (working copy)
+@@ -70,7 +70,7 @@
+ PollKQueue::set_event_mask(Event* e, uint32_t m) {
+ assert(e->file_descriptor() != -1);
+
+- m_table[e->file_descriptor()] = std::make_pair(m, e);
++ m_table[e->file_descriptor()] = Table::value_type(m, e);
+ }
+
+ void
+@@ -87,7 +87,7 @@
+
+ void
+ PollKQueue::modify(Event* event, unsigned short op, short mask) {
+- // Flush the changed filters to the kernel if the buffer if full.
++ // Flush the changed filters to the kernel if the buffer is full.
+ if (m_changedEvents == m_table.size())
+ flush_events();
+
+@@ -100,7 +100,8 @@
+
+ struct kevent* itr = m_changes + (m_changedEvents++);
+
+- EV_SET(itr, event->file_descriptor(), mask, op, 0, 0, event);
++ assert(event == m_table[event->file_descriptor()].second);
++ EV_SET(itr, event->file_descriptor(), mask, op, 0, 0, NULL);
+ }
+
+ PollKQueue*
+@@ -196,8 +197,9 @@
+ return nfds;
+
+ if (FD_ISSET(0, readSet)) {
++ m_events[m_waitingEvents].ident = 0;
+ m_events[m_waitingEvents].filter = EVFILT_READ;
+- m_events[m_waitingEvents].udata = m_stdinEvent;
++ m_events[m_waitingEvents].flags = 0;
+ m_waitingEvents++;
+ }
+
+@@ -208,19 +210,24 @@
+ void
+ PollKQueue::perform() {
+ for (struct kevent *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr) {
+- if ((itr->flags & EV_ERROR) && itr->udata != NULL) {
+- if (event_mask((Event*)itr->udata) & flag_error)
+- ((Event*)itr->udata)->event_error();
++ if (itr->ident < 0 || itr->ident >= m_table.size())
+ continue;
++
++ Table::iterator evItr = m_table.begin() + itr->ident;
++
++ if ((itr->flags & EV_ERROR) && evItr->second != NULL) {
++ if (evItr->first & flag_error)
++ evItr->second->event_error();
++ continue;
+ }
+
+ // Also check current mask.
+
+- if (itr->filter == EVFILT_READ && itr->udata != NULL && event_mask((Event*)itr->udata) & flag_read)
+- ((Event*)itr->udata)->event_read();
++ if (itr->filter == EVFILT_READ && evItr->second != NULL && evItr->first & flag_read)
++ evItr->second->event_read();
+
+- if (itr->filter == EVFILT_WRITE && itr->udata != NULL && event_mask((Event*)itr->udata) & flag_write)
+- ((Event*)itr->udata)->event_write();
++ if (itr->filter == EVFILT_WRITE && evItr->second != NULL && evItr->first & flag_write)
++ evItr->second->event_write();
+ }
+
+ m_waitingEvents = 0;
+@@ -249,11 +256,16 @@
+ if (event_mask(event) != 0)
+ throw internal_error("PollKQueue::close(...) called but the file descriptor is active");
+
++ m_table[event->file_descriptor()] = Table::value_type();
++
++ /*
++ Shouldn't be needed anymore.
+ for (struct kevent *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr)
+ if (itr->udata == event)
+ itr->udata = NULL;
+
+ m_changedEvents = std::remove_if(m_changes, m_changes + m_changedEvents, rak::equal(event, rak::mem_ref(&kevent::udata))) - m_changes;
++ */
+ }
+
+ void
+@@ -269,14 +281,16 @@
+ // and remove it from pending calls. Don't touch if the FD was
+ // re-used before we received the close notification.
+ if (m_table[event->file_descriptor()].second == event)
+- set_event_mask(event, 0);
++ m_table[event->file_descriptor()] = Table::value_type();
+
++ /*
+ for (struct kevent *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr) {
+ if (itr->udata == event)
+ itr->udata = NULL;
+ }
+
+ m_changedEvents = std::remove_if(m_changes, m_changes + m_changedEvents, rak::equal(event, rak::mem_ref(&kevent::udata))) - m_changes;
++ */
+ }
+
+ // Use custom defines for EPOLL* to make the below code compile with
diff --git a/net-libs/libtorrent/libtorrent-0.12.3-r1.ebuild b/net-libs/libtorrent/libtorrent-0.12.3-r1.ebuild
new file mode 100644
index 000000000000..ab2e35d605d4
--- /dev/null
+++ b/net-libs/libtorrent/libtorrent-0.12.3-r1.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-libs/libtorrent/libtorrent-0.12.3-r1.ebuild,v 1.1 2008/10/22 15:43:20 loki_val Exp $
+
+inherit base eutils toolchain-funcs flag-o-matic libtool
+
+DESCRIPTION="LibTorrent is a BitTorrent library written in C++ for *nix."
+HOMEPAGE="http://libtorrent.rakshasa.no/"
+SRC_URI="http://libtorrent.rakshasa.no/downloads/${P}.tar.gz"
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+
+IUSE="debug ipv6"
+
+RDEPEND=">=dev-libs/libsigc++-2"
+DEPEND="${RDEPEND}
+ dev-util/pkgconfig"
+
+PATCHES=( "${FILESDIR}/${P}-fix-epoll-crash.patch"
+ "${FILESDIR}/${P}-fix-poll_fd.patch" )
+
+src_unpack() {
+ base_src_unpack
+ cd "${S}"
+ elibtoolize #Don't remove. Needed for *bsd.
+}
+
+src_compile() {
+ replace-flags -Os -O2
+
+ if [[ $(tc-arch) = "x86" ]]; then
+ filter-flags -fomit-frame-pointer -fforce-addr
+ fi
+
+ econf \
+ $(use_enable debug) \
+ $(use_enable ipv6) \
+ --enable-aligned \
+ --enable-static \
+ --enable-shared \
+ --disable-dependency-tracking \
+ || die "econf failed"
+
+ emake || die "emake failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "make install failed"
+ dodoc AUTHORS NEWS README
+}