Re: [PATCH 0/3] add c-ares and aria2

2015-11-12 Thread Ludovic Courtès
Efraim Flashner  skribis:

> On Thu, 12 Nov 2015 14:05:31 +0100
> l...@gnu.org (Ludovic Courtès) wrote:
>
>> Efraim Flashner  skribis:

[...]

>> > ##Failure Location unknown## : Error
>> > Test name: N5aria224LpdMessageDispatcherTestE::testSendMessage
>> > uncaught exception of type N5aria29DlAbortExE
>> > - Failed to set a socket option, cause: No such device  
>> 
>> Could you check what this test does?  The “No such device” is likely due
>> to our build environment not corresponding to the assumptions made by
>> the test wrt. available networking capabilities.
>
> here's the failing line:
>   std::shared_ptr recvsock(new SocketCore(SOCK_DGRAM));

How do you know it’s this line?

The “Failed to set a socket option” would make me think it’s about a
failing setsockopt(2) call, but it’s not supposed to return ENODEV.
socket(2) is not supposed to return ENODEV either.

Could you keep the failed build directory (with ‘-K’), and from there
run the test in ‘strace’ to see exactly what’s failing?  (With the
caveat that it may succeed outside the build environment; did you try
running ‘make check’ from the failed build tree, outside the build
environment?)

> I'll keep staring at it, and hopefully it'll make sense soon :)

It will!  :-)

Cheers,
Ludo’.



Re: [PATCH 0/3] add c-ares and aria2

2015-11-12 Thread Efraim Flashner
On Thu, 12 Nov 2015 14:05:31 +0100
l...@gnu.org (Ludovic Courtès) wrote:

> Efraim Flashner  skribis:
> 
> >> In the end rebuilding c-ares with the release tarball and not the github
> >> tarball fixed the issues with aria2 not recognizing c-ares. I wasn't able 
> >> to
> >> get anything more out of aria2, more than it not finding the locations and
> >> leaving me with with variables pointing to /path/to/dir and the like.
> >>   
> >
> > here's the end of the log file:
> >
> > ##Failure Location unknown## : Error
> > Test name: N5aria224LpdMessageDispatcherTestE::testSendMessage
> > uncaught exception of type N5aria29DlAbortExE
> > - Failed to set a socket option, cause: No such device  
> 
> Could you check what this test does?  The “No such device” is likely due
> to our build environment not corresponding to the assumptions made by
> the test wrt. available networking capabilities.

here's the failing line:
  std::shared_ptr recvsock(new SocketCore(SOCK_DGRAM));
new SocketCore(SOCK_DGRAM) occurs only in 
LpdMessage{Dispatcher,Reciever}Test.cc and in SocketCoreTest.cc

> > LpdMessageReceiverTest.cc:34:Assertion
> > Test name: N5aria222LpdMessageReceiverTestE::testReceiveMessage
> > assertion failed
> > - Expression: rcv.init("")  
> 
> And this one is likely related to the one above.

Looking at LpdMessageReceiver.h, I'm not sure that this is connected to the 
other failed test, or really why it failed. Or maybe it was supposed to fail 
for not passing an address, or it was supposed to be commented out since the 
line before it was created with an address and port.

> TIA,
> Ludo’.

I'll keep staring at it, and hopefully it'll make sense soon :)

-- 
Efraim Flashner  אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
#include "LpdMessageDispatcher.h"

#include 
#include 

#include 

#include "TestUtil.h"
#include "Exception.h"
#include "util.h"
#include "LpdMessageDispatcher.h"
#include "SocketCore.h"
#include "BtConstants.h"

namespace aria2 {

class LpdMessageDispatcherTest:public CppUnit::TestFixture {

  CPPUNIT_TEST_SUITE(LpdMessageDispatcherTest);
  CPPUNIT_TEST(testCreateLpdRequest);
  CPPUNIT_TEST(testSendMessage);
  CPPUNIT_TEST_SUITE_END();
public:
  void testCreateLpdRequest();
  void testSendMessage();
};


CPPUNIT_TEST_SUITE_REGISTRATION(LpdMessageDispatcherTest);

void LpdMessageDispatcherTest::testCreateLpdRequest()
{
  std::string infoHashString = "cd41c7fdddfd034a15a04d7ff881216e01c4ceaf";
  CPPUNIT_ASSERT_EQUAL
(std::string("BT-SEARCH * HTTP/1.1\r\n"
 "Host: 239.192.152.143:6771\r\n"
 "Port: 6000\r\n"
 "Infohash: cd41c7fdddfd034a15a04d7ff881216e01c4ceaf\r\n"
 "\r\n\r\n"),
 bittorrent::createLpdRequest("239.192.152.143", 6771,
  fromHex(infoHashString), 6000));
}

void LpdMessageDispatcherTest::testSendMessage()
{
  std::shared_ptr recvsock(new SocketCore(SOCK_DGRAM));
#ifdef __MINGW32__
  recvsock->bindWithFamily(LPD_MULTICAST_PORT, AF_INET);
#else // !__MINGW32__
  recvsock->bind(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT, AF_INET);
#endif // !__MINGW32__
  recvsock->joinMulticastGroup(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT, "");
  recvsock->setNonBlockingMode();

  LpdMessageDispatcher d("cd41c7fdddfd034a15a04d7ff881216e01c4ceaf", 6000,
 LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT);
  d.init("", 0, 1);

  CPPUNIT_ASSERT(d.sendMessage());

  unsigned char buf[200];

  std::pair peer;
  ssize_t nbytes;
  int trycnt;
  for(trycnt = 0; trycnt < 5; ++trycnt) {
nbytes = recvsock->readDataFrom(buf, sizeof(buf), peer);
if(nbytes == 0) {
  util::sleep(1);
} else {
  break;
}
  }
  if(trycnt == 5) {
CPPUNIT_FAIL("[TIMEOUT] No Multicast packet received.");
  }
  buf[nbytes] = '\0';
  std::stringstream temp;
  temp << "BT-SEARCH * HTTP/1.1\r\n"
   << "Host: " << LPD_MULTICAST_ADDR << ":" << LPD_MULTICAST_PORT << "\r\n"
   << "Port: " << d.getPort() << "\r\n"
   << "Infohash: " << util::toHex(d.getInfoHash()) << "\r\n"
   << "\r\n\r\n";
  CPPUNIT_ASSERT_EQUAL(temp.str(), std::string(&buf[0], &buf[nbytes]));
}

} // namespace aria2
#include "LpdMessageReceiver.h"

#include 

#include 

#include "TestUtil.h"
#include "Exception.h"
#include "util.h"
#include "LpdMessageReceiver.h"
#include "SocketCore.h"
#include "BtConstants.h"
#include "LpdMessage.h"
#include "LpdMessageDispatcher.h"
#include "Peer.h"

namespace aria2 {

class LpdMessageReceiverTest:public CppUnit::TestFixture {

  CPPUNIT_TEST_SUITE(LpdMessageReceiverTest);
  CPPUNIT_TEST(testReceiveMessage);
  CPPUNIT_TEST_SUITE_END();
public:
  void testReceiveMessage();
};


CPPUNIT_TEST_SUITE_REGISTRATION(LpdMessageReceiverTest);

void LpdMessageReceiverTest::testReceiveMessage()
{
  LpdMessageReceiver rcv(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT);
  CPPUNIT_ASSERT(rcv.init(""));

  st

Re: [PATCH 0/3] add c-ares and aria2

2015-11-12 Thread Ludovic Courtès
Efraim Flashner  skribis:

> From 1f601d7707623ff21da6567eec7f57bef133c3f5 Mon Sep 17 00:00:00 2001
> From: Efraim Flashner 
> Date: Thu, 29 Oct 2015 16:18:36 +0200
> Subject: [PATCH 1/2] gnu: Add c-ares.
>
> * gnu/packages/aria2.scm: New file.
> * gnu-system.am (GNU_SYSTEM_MODULES): Add it.

LGTM, thanks!

Ludo’.



Re: [PATCH 0/3] add c-ares and aria2

2015-11-12 Thread Ludovic Courtès
Efraim Flashner  skribis:

>> In the end rebuilding c-ares with the release tarball and not the github
>> tarball fixed the issues with aria2 not recognizing c-ares. I wasn't able to
>> get anything more out of aria2, more than it not finding the locations and
>> leaving me with with variables pointing to /path/to/dir and the like.
>> 
>
> here's the end of the log file:
>
> ##Failure Location unknown## : Error
> Test name: N5aria224LpdMessageDispatcherTestE::testSendMessage
> uncaught exception of type N5aria29DlAbortExE
> - Failed to set a socket option, cause: No such device

Could you check what this test does?  The “No such device” is likely due
to our build environment not corresponding to the assumptions made by
the test wrt. available networking capabilities.

> LpdMessageReceiverTest.cc:34:Assertion
> Test name: N5aria222LpdMessageReceiverTestE::testReceiveMessage
> assertion failed
> - Expression: rcv.init("")

And this one is likely related to the one above.

TIA,
Ludo’.



Re: [PATCH 0/3] add c-ares and aria2

2015-11-08 Thread Efraim Flashner
On Thu, 5 Nov 2015 11:19:53 +0200
Efraim Flashner  wrote:

> On Tue, 03 Nov 2015 14:35:07 +0100
> l...@gnu.org (Ludovic Courtès) wrote:
> 
> > Efraim Flashner  skribis:
> >   
> > > This patch has driven me crazy a bit. C-ares is a library for 
> > > asynchronous DNS
> > > lookups, and aria2 is a cli program to download multiple files/torrents
> > > simultaneously, and also a git-annex dependency. C-ares builds without any
> > > problems, but aria2 was a different story. The first problem is that the 
> > > tests
> > > seem to need network connectivity, and it tries to access files outside 
> > > the
> > > build chroot. Disabling the tests was the easy part.
> > 
> > It’s cheating!  ;-)  Could you investigate and see whether/how tests
> > could run in the build environment?  A common problem wrt. networking in
> > host name lookups.  In the build environment, only “localhost” can be
> > found.
> >   
--
> > 
> > Ludo’.  
> 
> In the end rebuilding c-ares with the release tarball and not the github
> tarball fixed the issues with aria2 not recognizing c-ares. I wasn't able to
> get anything more out of aria2, more than it not finding the locations and
> leaving me with with variables pointing to /path/to/dir and the like.
> 

here's the end of the log file:

##Failure Location unknown## : Error
Test name: N5aria224LpdMessageDispatcherTestE::testSendMessage
uncaught exception of type N5aria29DlAbortExE
- Failed to set a socket option, cause: No such device

LpdMessageReceiverTest.cc:34:Assertion
Test name: N5aria222LpdMessageReceiverTestE::testReceiveMessage
assertion failed
- Expression: rcv.init("")

Failures !!!
Run: 979   Failure total: 2   Failures: 1   Errors: 1
FAIL aria2c (exit status: 1)

the way it's presented in the command line, however, is that there was 1 test, 
and 1 fail, making it harder to figure out what was going on.

-- 
Efraim Flashner  אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted


pgpUCiudaWew_.pgp
Description: OpenPGP digital signature


Re: [PATCH 0/3] add c-ares and aria2

2015-11-05 Thread Efraim Flashner
On Tue, 03 Nov 2015 14:35:07 +0100
l...@gnu.org (Ludovic Courtès) wrote:

> Efraim Flashner  skribis:
> 
> > This patch has driven me crazy a bit. C-ares is a library for asynchronous 
> > DNS
> > lookups, and aria2 is a cli program to download multiple files/torrents
> > simultaneously, and also a git-annex dependency. C-ares builds without any
> > problems, but aria2 was a different story. The first problem is that the 
> > tests
> > seem to need network connectivity, and it tries to access files outside the
> > build chroot. Disabling the tests was the easy part.  
> 
> It’s cheating!  ;-)  Could you investigate and see whether/how tests
> could run in the build environment?  A common problem wrt. networking in
> host name lookups.  In the build environment, only “localhost” can be
> found.
> 
> > The second problem was that pkg-config wouldn't find c-ares, so it
> > kept on building without it.  
> 
> In that case, I would do this:
> 
>   guix build -K aria2
>   # … build fails
>   cd /tmp/nix-build*aria2*
>   source environment-variables
>   pkg-config c-ares --libs
> 
> (Replace “c-ares” with the name corresponding to the actual .pc file
> provided by c-ares.)
> 
> It might be that this command fails because of a missing dependency that
> the .pc file requires.
> 
> Ludo’.

In the end rebuilding c-ares with the release tarball and not the github
tarball fixed the issues with aria2 not recognizing c-ares. I wasn't able to
get anything more out of aria2, more than it not finding the locations and
leaving me with with variables pointing to /path/to/dir and the like.

-- 
Efraim Flashner  אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
From 1f601d7707623ff21da6567eec7f57bef133c3f5 Mon Sep 17 00:00:00 2001
From: Efraim Flashner 
Date: Thu, 29 Oct 2015 16:18:36 +0200
Subject: [PATCH 1/2] gnu: Add c-ares.

* gnu/packages/aria2.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
---
 gnu-system.am  |  1 +
 gnu/packages/aria2.scm | 49 +
 2 files changed, 50 insertions(+)
 create mode 100644 gnu/packages/aria2.scm

diff --git a/gnu-system.am b/gnu-system.am
index 946b77e..881ee35 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -35,6 +35,7 @@ GNU_SYSTEM_MODULES =\
   gnu/packages/aidc.scm\
   gnu/packages/apl.scm\
   gnu/packages/apr.scm\
+  gnu/packages/aria2.scm			\
   gnu/packages/asciidoc.scm			\
   gnu/packages/aspell.scm			\
   gnu/packages/attr.scm\
diff --git a/gnu/packages/aria2.scm b/gnu/packages/aria2.scm
new file mode 100644
index 000..707a3ce
--- /dev/null
+++ b/gnu/packages/aria2.scm
@@ -0,0 +1,49 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Efraim Flashner 
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see .
+
+(define-module (gnu packages aria2)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix download)
+  #:use-module (guix packages)
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages pkg-config))
+
+(define-public c-ares
+  (package
+(name "c-ares")
+(version "1.10.0")
+(source (origin
+  (method url-fetch)
+  (uri (string-append
+"http://c-ares.haxx.se/download/"; name "-" version
+".tar.gz"))
+  (sha256
+   (base32
+"1nyka87yf2jfd0y6sspll0yxwb8zi7kyvajrdbjmh4axc5s1cw1x"
+(build-system gnu-build-system)
+(native-inputs
+ `(("pkg-config" ,pkg-config)))
+(home-page "http://c-ares.haxx.se/";)
+(synopsis "C library for asynchronous DNS requests")
+(description
+  "C-ares is a C library that performs DNS requests and name resolution
+asynchronously.  It is intended for applications which need to perform DNS
+queries without blocking, or need to perform multiple DNS queries in parallel.
+The primary examples of such applications are servers which communicate with
+multiple clients and programs with graphical user interfaces.")
+(license (license:x11-style "http://c-ares.haxx.se/license.html";
-- 
2.6.2

From ef12a054927c42442ba0806caabee75be0d6f88f Mon Sep 17 00:00:00 2001
From: Efraim Flashner 
Date: Tue, 3 Nov 2015 22:05:47 +0200
Sub

Re: [PATCH 0/3] add c-ares and aria2

2015-11-03 Thread Ludovic Courtès
Efraim Flashner  skribis:

> This patch has driven me crazy a bit. C-ares is a library for asynchronous DNS
> lookups, and aria2 is a cli program to download multiple files/torrents
> simultaneously, and also a git-annex dependency. C-ares builds without any
> problems, but aria2 was a different story. The first problem is that the tests
> seem to need network connectivity, and it tries to access files outside the
> build chroot. Disabling the tests was the easy part.

It’s cheating!  ;-)  Could you investigate and see whether/how tests
could run in the build environment?  A common problem wrt. networking in
host name lookups.  In the build environment, only “localhost” can be
found.

> The second problem was that pkg-config wouldn't find c-ares, so it
> kept on building without it.

In that case, I would do this:

  guix build -K aria2
  # … build fails
  cd /tmp/nix-build*aria2*
  source environment-variables
  pkg-config c-ares --libs

(Replace “c-ares” with the name corresponding to the actual .pc file
provided by c-ares.)

It might be that this command fails because of a missing dependency that
the .pc file requires.

Ludo’.



Re: [PATCH 0/3] add c-ares and aria2

2015-11-01 Thread Efraim Flashner
On Mon,  2 Nov 2015 09:15:20 +0200
Efraim Flashner  wrote:

> This patch has driven me crazy a bit. C-ares is a library for asynchronous DNS
> lookups, and aria2 is a cli program to download multiple files/torrents
> simultaneously, and also a git-annex dependency. C-ares builds without any
> problems, but aria2 was a different story. The first problem is that the tests
> seem to need network connectivity, and it tries to access files outside the
> build chroot. Disabling the tests was the easy part. The second problem was 
> that
> pkg-config wouldn't find c-ares, so it kept on building without it. Looking at
> patch 3, where I finally got the flags correct to bypass pkg-config and 
> declare
> where to find c-ares, I got errors right at the end of the build phase where 
> it
> couldn't find certain features of c-ares. As the patches are, patch 1 and 2 
> work
> well, patch 3 doesn't build, but I've included it in case anyone has an idea 
> of
> something I can try. As it currently stands, nothing is currently set to 
> depend
> on c-ares, and aria2 works without it.

I meant to include the error at the end of the build phase:
  CXXLDaria2c
./.libs/libaria2.so: undefined reference to `ares_fds'
./.libs/libaria2.so: undefined reference to `ares_getsock'
./.libs/libaria2.so: undefined reference to `ares_destroy'
./.libs/libaria2.so: undefined reference to `ares_process'
./.libs/libaria2.so: undefined reference to `ares_gethostbyname'
./.libs/libaria2.so: undefined reference to `ares_library_init'
./.libs/libaria2.so: undefined reference to `ares_strerror'
./.libs/libaria2.so: undefined reference to `ares_process_fd'
./.libs/libaria2.so: undefined reference to `ares_init'
./.libs/libaria2.so: undefined reference to `ares_library_cleanup'
collect2: error: ld returned 1 exit status
Makefile:1796: recipe for target 'aria2c' failed

> Efraim Flashner (3):
>   gnu: Add c-ares.
>   gnu: Add aria2.
>   gnu: aria2: Build with c-ares.
> 
>  gnu-system.am  |   1 +
>  gnu/packages/aria2.scm | 109 
> +
>  2 files changed, 110 insertions(+)
>  create mode 100644 gnu/packages/aria2.scm
> 

-- 
Efraim Flashner  אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted


pgpYeLjdDxGtC.pgp
Description: OpenPGP digital signature