Re: [tor-dev] First test "report"

2012-02-12 Thread Steven Murdoch
On 12 Feb 2012, at 03:28, Nick Mathewson wrote:
>> 2. In comparison assertions, the general convention seems to be to place the
>> expected value first ("test_eq(0, functioncall(...))" rather than
>> "test_eq(functioncall(...), 0)"). I have modified the assertions not
>> following that convention, so they all look the same.
> 
> Hm.  I don't think we actually had a convention on this one.

It's not so important with tinytest because the output messages don't 
distinguish between expected and actual. In test frameworks where it does 
matter (e.g. JUnit) expected usually comes first in my experience. So I think 
the proposed convention is a good one and could be useful should we wish to 
change error messages to indicate the test failure message to say what was 
expected. I have found this feature of JUnit helpful, although by no means 
critical.

Steven. 
___
tor-dev mailing list
tor-dev@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev


Re: [tor-dev] First test "report"

2012-02-12 Thread Esteban Manchado Velázquez
On Sun, 12 Feb 2012 04:28:38 +0100, Nick Mathewson   
wrote:



On Sat, Feb 11, 2012 at 7:12 AM, Esteban Manchado Velázquez
 wrote:

Hi there,

I'm done with the first batch of work on the test side. You have the
(rebased just now) work here:
https://github.com/emanchado/tor/commits/master.


A suggestion: In the future, it's best to do commits on one or more
"topic branches", where each branch is for a separate kind of work.
That way, it's way easier for upstream to merge some of the commits,
hold off on others, and decline others.


   In this concrete case, how would you separate them? One branch per test  
function? Which in this case is more or less one branch per commit?



As it stands, if you do all your commits in a "master" branch, and I
want to take some but not all of them, I have to cherry-pick the
individual commits.  Worse still, your branch and the upstream branch
will then have diverged: if you try to pull the official repository
onto your master again, you won't have the actual history of the Tor
master branch , but some other thing that only exists on your master
branch.  This can make stuff yucky fast.


   Yeah, I thought of that too late.


For now, let's leave the current branches as they are.  Once we've got
the contents of your current master branch reviewed/merged/not-merged,
you can reset your master to match tor's, and then do future work in
topic branches.


   OK.


All that said: I like the granularity of your commits!  Each one is
logically independent and easy to review.


   Yes, that was my idea. Cool that works for you :-)


[...] To keep the test suite from failing,
they are inside "#if 0" blocks. So someone should look for "#if 0"  
inside
test_util.c and fix the code that makes those fail. Or maybe I should  
file

bugs for those?


Filing bugs is the right move; it looks like you've already started to  
do this.


   Yes, it seems it was only 3 after all. I didn't know what component to  
use so I left it blank. If there's any better way to file them (component,  
Cc or whatever), I'd be happy to learn that and use it in the future :-)


2. In comparison assertions, the general convention seems to be to  
place the

expected value first ("test_eq(0, functioncall(...))" rather than
"test_eq(functioncall(...), 0)"). I have modified the assertions not
following that convention, so they all look the same.


Hm.  I don't think we actually had a convention on this one.


   Yeah, "convention" was a strong word. It was just my impression that  
there were more "expected, actual" than "actual, expected", and I thought  
forcing a convention would be good. Although, as Steven said, tinytest  
doesn't actually specify "expected" an "actual" in the output, I find it's  
less "cognitive load" to debug or make sense of tests if you can assume  
what's the order of the values in the failure output.


3. General clean up, small code reorganisations, fix typos and such.  
Eg, I

have turned all the "tt_int_op(a, ==, b)" into "test_eq(a, b)".


Actually, test_eq was the old way; tt_int_op is the newer way since we
switched to tinytest.


   Oh, hehe, oops. I found test_eq much more readable so I thought that  
was the preferred way.


   I can turn everything into tt_* calls and add a comment to test.h  
stating that test_eq and such are deprecated. Should I do that? In that  
case, however, I would place the expected at the end, because otherwise  
the code will look like "tt_int_op(0, ==, strlen(foo))", which I think  
looks pretty awkward.



Some other comments:

 In general, the hardest thing for me to review here is not whether
the tests are right, but whether they removed any old tests in
revising them.  I'll need to have another look through the patch
series to be sure.


   OK. I *did* remove a couple of assertions, either because I didn't  
think they added anything, or because they were replaced by (in my view)  
better assertions. In particular, I removed the hardcoded gzip magic  
number check (there's already a check_compression_method, see commit  
c4c1d56d96623a45775ec2544c0c6951fbfa2d9f) and I changed some of the  
strcasecmpend cases (commit 03876f0a721ced6ffebb0c61134d5b8396d7600e).  
There are probably others.



 On commit 5740e0fc1f00fa91be107ee6c4315d114c5ffdc4, the snprintf()
calls  there should be tor_snprintf().


   Good catch.


 On commit f40c04a2137724f7b285e8d69ee62e47df1f9049, "iff" is not a
typo.  It is a standard abbreviation for "if and only if."  We use it
to say things like "Return true iff X", since otherwise we would need
to say "Return true if X; return false otherwise."  (If we just said
"Return true if X," the function would technically be allowed to
_always_ return true.)


   Right, my bad.


I was thinking of blogging about what I saw (esp. related to point 1). I
think there are valuable lessons to be learned, which will help other  
people

writing tests (both for Tor and outside of Tor). I'm not sure if there's
enough content for a blog 

Re: [tor-dev] Obfsproxy client for Android

2012-02-12 Thread Nathan Freitas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 02/12/2012 01:57 AM, Nathan Freitas wrote:
> I am going to sleep on this now a bit, do some more testing
> tomorrow, post a public build, then ideally about 18 hours from
> now, put a build up for release for Iranian users.

I've posted a signed test build of Orbot-1.0.7.2+OBFS-BY-DEFAULT here:
http://ge.tt/89SjZWD

** This is for EXTERNAL testing only and NOT for inside Iran users
yet. We have one more round of review tonight, and then should be
ready for targeted public release **

Please test on as many devices as you can, and report issues on trac
or via email. I will be offline for about eight hours, but active
again after that.

+n




-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk84CbUACgkQhemw+yiNNc4xIQCeJAfmPBLWXNbxxAi/2sJBmbob
S/UAoIV07JOJhWSRFtz2msR9z2FJa2ik
=Sc2M
-END PGP SIGNATURE-
___
tor-dev mailing list
tor-dev@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev


Re: [tor-dev] Tor and DNS

2012-02-12 Thread Ondrej Mikle
On 02/10/2012 08:20 AM, Jakob Schlyter wrote:
> On 7 feb 2012, at 22:08, Ondrej Mikle wrote:
> 
>> 1. full packet might leak identifying information about OS or resolver used,
>> quoting Nick:
>>> There are parts of a DNS packet that we wouldn't want
>>> to have the Tor client make up.  For example, DNS transaction IDs
>>> would need to avoid collisions. Similarly, I don't see why the client
>>> should be setting most  of the possible flags.
>>
>> The query will work as if following was set: flags 0x110 (recursive,
>> non-authenticated data ok), DO bit set. Is there any reason for setting some
>> flags otherwise or make some optional?
> 
> If you bundle a full resolver (e.g. libunbound) with the TOR client, you will 
> be much better off doing full DNS packet transport, or you have to rewrite 
> the upstream forwarding code. I do about the potential fingerprinting issues 
> (I'm one of the people behind Net::DNS::Fingerprint), but in this case I 
> believe we can mitigate these issues (if considered important) by 
> masking/rewriting some DNS request fields within the TOR client and/or exit 
> node.

I guess you are right as long as the DNS packet transmitted to exit node is
always generated by libunbound (BTW fpdns is a neat tool).

Validation must be on by default as well, otherwise it would be really to
fingerprint users that turned it on manually.

I'll update the draft in a few days, just a quick summary of changes:
- drop IDs (use StreamID), drop length from DNS_RESPONSE, keep just uint16_t
total_length
- separate tool for AXFR/IXFR so that server can be specified
- validation always on client side by default

Ondrej
___
tor-dev mailing list
tor-dev@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev