On 26 January 2012 14:39, David Coppa <dco...@openbsd.org> wrote: > > Hi, > > Just noticed that rtorrent is broken on sparc64. > > This is a working fix I've cooked up, but I'd like to have some > help since I am a total n00b in C++ >
I'm running this diff with no problems so far on a sparc64. > Index: Makefile > =================================================================== > RCS file: /cvs/ports/net/rtorrent/Makefile,v > retrieving revision 1.30 > diff -u -p -r1.30 Makefile > --- Makefile 1 Dec 2011 17:10:40 -0000 1.30 > +++ Makefile 26 Jan 2012 16:31:27 -0000 > @@ -3,6 +3,7 @@ > COMMENT= ncurses BitTorrent client based on libTorrent > > DISTNAME= rtorrent-0.8.9 > +REVISION= 0 > CATEGORIES= net > > HOMEPAGE= http://libtorrent.rakshasa.no/ > Index: patches/patch-src_command_local_cc > =================================================================== > RCS file: patches/patch-src_command_local_cc > diff -N patches/patch-src_command_local_cc > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_command_local_cc 26 Jan 2012 16:31:27 -0000 > @@ -0,0 +1,25 @@ > +$OpenBSD$ > + > +Fix unaligned access causing a SIGBUS at startup on sparc64 > + > +--- src/command_local.cc.orig Tue Jun 14 04:57:10 2011 > ++++ src/command_local.cc Thu Jan 26 16:55:38 2012 > +@@ -398,10 +398,14 @@ initialize_command_local() { > + CMD2_ANY_LIST ("file.append", std::bind(&cmd_file_append, > std::placeholders::_2)); > + > + // TODO: Convert to new command types: > +- *rpc::command_base::argument(0) = "placeholder.0"; > +- *rpc::command_base::argument(1) = "placeholder.1"; > +- *rpc::command_base::argument(2) = "placeholder.2"; > +- *rpc::command_base::argument(3) = "placeholder.3"; > ++ std::string ph0 = "placeholder.0"; > ++ std::string ph1 = "placeholder.1"; > ++ std::string ph2 = "placeholder.2"; > ++ std::string ph3 = "placeholder.3"; > ++ std::memcpy(rpc::command_base::argument(0), ph0.c_str(), > sizeof(torrent::Object*)); > ++ std::memcpy(rpc::command_base::argument(1), ph1.c_str(), > sizeof(torrent::Object*)); > ++ std::memcpy(rpc::command_base::argument(2), ph2.c_str(), > sizeof(torrent::Object*)); > ++ std::memcpy(rpc::command_base::argument(3), ph3.c_str(), > sizeof(torrent::Object*)); > + CMD2_ANY_P("argument.0", std::bind(&rpc::command_base::argument_ref, 0)); > + CMD2_ANY_P("argument.1", std::bind(&rpc::command_base::argument_ref, 1)); > + CMD2_ANY_P("argument.2", std::bind(&rpc::command_base::argument_ref, 2)); >