Hello community, here is the log from the commit of package btfs for openSUSE:Factory checked in at 2017-09-12 19:54:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/btfs (Old) and /work/SRC/openSUSE:Factory/.btfs.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "btfs" Tue Sep 12 19:54:18 2017 rev:3 rq:522946 version:2.17 Changes: -------- --- /work/SRC/openSUSE:Factory/btfs/btfs.changes 2017-08-24 18:56:31.886507354 +0200 +++ /work/SRC/openSUSE:Factory/.btfs.new/btfs.changes 2017-09-12 19:54:19.336126341 +0200 @@ -1,0 +2,13 @@ +Mon Sep 11 05:08:25 UTC 2017 - [email protected] + +- 2.17 + * Adjust to libtorrent 1.2 API changes + + Session flags changed type. + + Remove flags changed type. + * Silence warning about deprecated flags in libtorrent 1.2 + * Tweak configure.ac + * Handle read_piece_alert errors + + Fixes segfault, upstream bug #42 + * Set request timeout + +------------------------------------------------------------------- Old: ---- v2.16.tar.gz New: ---- v2.17.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ btfs.spec ++++++ --- /var/tmp/diff_new_pack.NU0Ep7/_old 2017-09-12 19:54:21.795780498 +0200 +++ /var/tmp/diff_new_pack.NU0Ep7/_new 2017-09-12 19:54:21.799779937 +0200 @@ -17,7 +17,7 @@ Name: btfs -Version: 2.16 +Version: 2.17 Release: 0 Summary: A BitTorrent file system based on FUSE License: GPL-3.0 ++++++ v2.16.tar.gz -> v2.17.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btfs-2.16/configure.ac new/btfs-2.17/configure.ac --- old/btfs-2.16/configure.ac 2017-08-23 18:12:29.000000000 +0200 +++ new/btfs-2.17/configure.ac 2017-09-10 20:35:47.000000000 +0200 @@ -1,5 +1,5 @@ AC_PREREQ([2.69]) -AC_INIT(btfs, 2.16, [email protected], btfs, https://github.com/johang/btfs) +AC_INIT(btfs, 2.17, [email protected], btfs, https://github.com/johang/btfs) AC_CONFIG_SRCDIR([src/btfs.cc]) AM_INIT_AUTOMAKE @@ -7,10 +7,6 @@ # Checks for programs. AC_PROG_CXX -AC_CONFIG_FILES([ - man/Makefile -]) - # Checks for libraries. PKG_CHECK_MODULES(FUSE, fuse >= 2.8.0) PKG_CHECK_MODULES(LIBTORRENT, libtorrent-rasterbar >= 1.0.0) @@ -21,9 +17,9 @@ AC_TYPE_SIZE_T # Checks for library functions. -AC_CHECK_FUNCS([memset mkdir realpath strdup]) +AC_CHECK_FUNCS([memset memcpy strcmp mkdir strdup realpath getxattr dirname basename]) # Check for unportable pthread_setname_np() AC_CHECK_LIB(pthread, pthread_setname_np) -AC_OUTPUT(Makefile src/Makefile scripts/Makefile) +AC_OUTPUT(Makefile src/Makefile scripts/Makefile man/Makefile) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btfs-2.16/src/btfs.cc new/btfs-2.17/src/btfs.cc --- old/btfs-2.16/src/btfs.cc 2017-08-23 18:12:29.000000000 +0200 +++ new/btfs-2.17/src/btfs.cc 2017-09-10 20:35:47.000000000 +0200 @@ -140,6 +140,13 @@ } } +void Read::fail(int piece) { + for (parts_iter i = parts.begin(); i != parts.end(); ++i) { + if (i->part.piece == piece && !i->filled) + failed = true; + } +} + void Read::copy(int piece, char *buffer, int size) { for (parts_iter i = parts.begin(); i != parts.end(); ++i) { if (i->part.piece == piece && !i->filled) @@ -184,11 +191,14 @@ // Move sliding window to first piece to serve this request jump(parts.front().part.piece, size()); - while (!finished()) + while (!finished() && !failed) // Wait for any piece to downloaded pthread_cond_wait(&signal_cond, &lock); - return size(); + if (failed) + return -EIO; + else + return size(); } static void @@ -244,8 +254,16 @@ pthread_mutex_lock(&lock); - for (reads_iter i = reads.begin(); i != reads.end(); ++i) { - (*i)->copy(a->piece, a->buffer.get(), a->size); + if (a->ec) { + *log << a->message() << std::endl; + + for (reads_iter i = reads.begin(); i != reads.end(); ++i) { + (*i)->fail(a->piece); + } + } else { + for (reads_iter i = reads.begin(); i != reads.end(); ++i) { + (*i)->copy(a->piece, a->buffer.get(), a->size); + } } pthread_mutex_unlock(&lock); @@ -549,7 +567,11 @@ libtorrent::add_torrent_params *p = (libtorrent::add_torrent_params *) fuse_get_context()->private_data; +#if LIBTORRENT_VERSION_NUM < 10200 int flags = +#else + libtorrent::session_flags_t flags = +#endif libtorrent::session::add_default_plugins | libtorrent::session::start_default_features; @@ -582,6 +604,7 @@ libtorrent::session_settings se = session->settings(); + se.request_timeout = 10; se.strict_end_game_mode = false; se.announce_to_all_trackers = true; se.announce_to_all_tiers = true; @@ -619,6 +642,7 @@ "dht.transmissionbt.com:6881"); #endif + pack.set_int(pack.request_timeout, 10); pack.set_str(pack.listen_interfaces, interfaces.str()); pack.set_bool(pack.strict_end_game_mode, false); pack.set_bool(pack.announce_to_all_trackers, true); @@ -657,8 +681,16 @@ pthread_cancel(alert_thread); pthread_join(alert_thread, NULL); - session->remove_torrent(handle, - params.keep ? 0 : libtorrent::session::delete_files); +#if LIBTORRENT_VERSION_NUM < 10200 + int flags = 0; +#else + libtorrent::remove_flags_t flags = {}; +#endif + + if (params.keep) + flags |= libtorrent::session::delete_files; + + session->remove_torrent(handle, flags); delete session; @@ -832,7 +864,11 @@ ec.message().c_str()), false); if (params.browse_only) +#if LIBTORRENT_VERSION_NUM < 10200 p.flags |= libtorrent::add_torrent_params::flag_paused; +#else + p.flags |= libtorrent::torrent_flags::paused; +#endif } else if (uri.find("magnet:") == 0) { libtorrent::error_code ec; @@ -866,7 +902,11 @@ ec.message().c_str()), false); if (params.browse_only) +#if LIBTORRENT_VERSION_NUM < 10200 p.flags |= libtorrent::add_torrent_params::flag_paused; +#else + p.flags |= libtorrent::torrent_flags::paused; +#endif } return true; @@ -994,8 +1034,13 @@ libtorrent::add_torrent_params p; +#if LIBTORRENT_VERSION_NUM < 10200 p.flags &= ~libtorrent::add_torrent_params::flag_auto_managed; p.flags &= ~libtorrent::add_torrent_params::flag_paused; +#else + p.flags &= ~libtorrent::torrent_flags::auto_managed; + p.flags &= ~libtorrent::torrent_flags::paused; +#endif p.save_path = target + "/files"; if (mkdir(p.save_path.c_str(), 0777) < 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btfs-2.16/src/btfs.h new/btfs-2.17/src/btfs.h --- old/btfs-2.16/src/btfs.h 2017-08-23 18:12:29.000000000 +0200 +++ new/btfs-2.17/src/btfs.h 2017-09-10 20:35:47.000000000 +0200 @@ -60,6 +60,8 @@ public: Read(char *buf, int index, off_t offset, size_t size); + void fail(int piece); + void copy(int piece, char *buffer, int size); void trigger(); @@ -71,6 +73,8 @@ int read(); private: + bool failed = false; + std::vector<Part> parts; };
