Subject: Re: sftp_read problems with large buffer

Re: sftp_read problems with large buffer

From: Alexander Lamaison <swish_at_lammy.co.uk>
Date: Tue, 4 Aug 2009 18:42:21 +0100

2009/8/4 Peter Stuge <peter_at_stuge.se>:
> Alexander Lamaison wrote:
>> select(4, [3], NULL, NULL, NULL)        = 1 (in [3])
>> recv(3, "\342\261\354\263\243\250i@\367\375\372ylHm\36\364\300\216J\316\1\241@>\252r\227\10\335\270\372\22"...,
>> 16384, MSG_NOSIGNAL) = 1408
>> select(4, NULL, NULL, NULL, NULL
>
> Good find. This is a bug. The fd_set must not be empty.

I'm glad you know how to read the strace output. I didn't have a clue! :P

>> All I know is it occurred somewhere between commit
>> 6409bb53ba2fd937260caf1cb2cdbf40d782180c (post RELEASE 1.1), which
>> works, and the current master HEAD, which doesn't.
>
> You can use git bisect for this

Using git bisect, which incidentally is amazing, I've tracked it down
to the following commit:

$ git bisect good
b95fe985af3c80a2babcaaaf7da69a15b1237c49 is first bad commit
commit b95fe985af3c80a2babcaaaf7da69a15b1237c49
Author: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed May 20 14:30:05 2009 +0200

    If recv() returns something less than the full buffer we know we're done for
    now, so skip looping and doing another read that then simply will cause an
    EAGAIN as it may trick the user into believing things that aren't true.

:040000 040000 7fb9cce4764171a44bb74bf423f1b2501aed12ae
9cd52c5bbb8dc7b13cb554ddc94bf2452c976b1e M src

> And this is surely also what causes Mike's problem in
> http://libssh2.haxx.se/mail/libssh2-devel-archive-2009-07/0173.shtml

It's the same commit that Mike identifies here:
http://libssh2.haxx.se/mail/libssh2-devel-archive-2009-07/0171.shtml

Alex

--
http://swish.sourceforge.net
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2009-08-04