From libssh2-devel-bounces@cool.haxx.se  Wed Apr  3 19:23:54 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r33HNMKF014212;
	Wed, 3 Apr 2013 19:23:46 +0200
Received: from mail-ve0-f195.google.com (mail-ve0-f195.google.com
 [209.85.128.195])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r33HNKNV014150
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Wed, 3 Apr 2013 19:23:20 +0200
Received: by mail-ve0-f195.google.com with SMTP id jw11so454498veb.6
 for <libssh2-devel@cool.haxx.se>; Wed, 03 Apr 2013 10:23:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:x-received:date:message-id:subject:from:to
 :content-type; bh=80GCXne2hxJ4jec69mI3lhOaD6QwIo6+NguwkuUqVgc=;
 b=xlmSlpjIq98c3QS870MpbnuhHsuudsL65zOo2RpsHrYUAylRGlozDvhmMJ2t508Gh6
 eBiKQv/UO+f/dcb0FH02SB6D4dmWXypi3tvsxknTeR2rIiJGerF+wz0qk1ZnDfLYNSmV
 5LA8As1McLx5OG/UjklKTOHg52AEBjQiRT2UXP4bzoJJR3i5w66pStU6GUa6Rmjiohe4
 C2AkkdATR3I3dNgqPtyUsLMaeLzL+8ScYPlabJjwHfPUhYnLV0HifhQSOKlKQi6HmJkF
 v6YcujUrdZk+bHgVzLa2Szv56pSL++MsdEBDdTBr1DRca1/E9T+5LDfvniZDv4QiT1UF
 T0tg==
MIME-Version: 1.0
X-Received: by 10.220.71.200 with SMTP id i8mr1953772vcj.44.1365009795603;
 Wed, 03 Apr 2013 10:23:15 -0700 (PDT)
Received: by 10.220.144.202 with HTTP; Wed, 3 Apr 2013 10:23:15 -0700 (PDT)
Date: Wed, 3 Apr 2013 19:23:15 +0200
Message-ID: <CACApneiWf9dcqBJWN2haoE_NrS5MN_GM81Jy+1s1nY3yw-3Vvg@mail.gmail.com>
Subject: Transfering files
From: Paul Radaz <radazi16@gmail.com>
To: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1035387959=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============1035387959==
Content-Type: multipart/alternative; boundary=001a11c23448fb71e904d9781b31

--001a11c23448fb71e904d9781b31
Content-Type: text/plain; charset=ISO-8859-1

Hello all, I want to make something like this:
http://www.mail-archive.com/libssh2-devel@cool.haxx.se/msg01481.html but
when I trying to create sftp_session instance for C through channel in my
app, then libssh2_sftp_init return NULL and error code is set
to LIBSSH2_ERROR_INVAL.

--001a11c23448fb71e904d9781b31
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello all,=A0I want to make something like this:=A0<a href=
=3D"http://www.mail-archive.com/libssh2-devel@cool.haxx.se/msg01481.html">h=
ttp://www.mail-archive.com/libssh2-devel@cool.haxx.se/msg01481.html</a>=A0b=
ut when I trying to create sftp_session instance for C through channel in m=
y app, then=A0libssh2_sftp_init return NULL and error code is set to=A0LIBS=
SH2_ERROR_INVAL.<br>
<br></div>

--001a11c23448fb71e904d9781b31--

--===============1035387959==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============1035387959==--

From libssh2-devel-bounces@cool.haxx.se  Wed Apr  3 19:39:03 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r33HcunM022878;
	Wed, 3 Apr 2013 19:39:01 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r33Hcs2H022862
 for <libssh2-devel@cool.haxx.se>; Wed, 3 Apr 2013 19:38:54 +0200
Received: (qmail 28174 invoked by uid 501); 3 Apr 2013 17:38:55 -0000
Message-ID: <20130403173855.28173.qmail@stuge.se>
Date: Wed, 3 Apr 2013 19:38:55 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: Transfering files
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <CACApneiWf9dcqBJWN2haoE_NrS5MN_GM81Jy+1s1nY3yw-3Vvg@mail.gmail.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <CACApneiWf9dcqBJWN2haoE_NrS5MN_GM81Jy+1s1nY3yw-3Vvg@mail.gmail.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

Paul Radaz wrote:
> when I trying to create sftp_session instance for C through channel

The channel has a libssh2 session, not an sftp session.


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed Apr  3 20:24:17 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r33INve6018097;
	Wed, 3 Apr 2013 20:24:15 +0200
Received: from mail-vb0-x242.google.com (mail-vb0-x242.google.com
 [IPv6:2607:f8b0:400c:c02::242])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r33INsC8018002
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Wed, 3 Apr 2013 20:23:55 +0200
Received: by mail-vb0-f66.google.com with SMTP id w16so170232vbb.9
 for <libssh2-devel@cool.haxx.se>; Wed, 03 Apr 2013 11:23:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:x-received:in-reply-to:references:date:message-id
 :subject:from:to:content-type;
 bh=7sKjHhFm0x3RcKQjBEgveWYesfZxeykDGXmsDAYtJc4=;
 b=Hb12yvah/PpzsgOP8oh24j0mDmFZIsdh1nrdFos2k5EvgK8BfETSuZdSaYsxKdFw4N
 8yf06w6eqOyBj879hO4JQshBksbuyA28bCM0Y/HQdOfh3Iuv0x+FLqiEVidf4h8kHgut
 B5l7311pqoRlgwfr+0MRofuLbN6guPlxKxVnNpTmWZWWrKhLNr0ouR+W72RXijvBYAoF
 K2NRLo5kjB+NaPlXAuloRFr9c76ttOJdKbvLkKexzenhwooqpfrbn+uLlman3feK3R3d
 NXJgGWGuYrJU9ePRC12JquigpseOjLslWwPV1HsHl3ozyJ82P0fw2IcIX4YpQDyUfq+7
 SxHQ==
MIME-Version: 1.0
X-Received: by 10.52.100.163 with SMTP id ez3mr1867151vdb.6.1365013428641;
 Wed, 03 Apr 2013 11:23:48 -0700 (PDT)
Received: by 10.220.144.202 with HTTP; Wed, 3 Apr 2013 11:23:48 -0700 (PDT)
In-Reply-To: <20130403173855.28173.qmail@stuge.se>
References: <CACApneiWf9dcqBJWN2haoE_NrS5MN_GM81Jy+1s1nY3yw-3Vvg@mail.gmail.com>
 <20130403173855.28173.qmail@stuge.se>
Date: Wed, 3 Apr 2013 20:23:48 +0200
Message-ID: <CACApneiEXSRAyb_6EMm9i8neD0VNE6hCwYtkhp4-36aVsRYuYA@mail.gmail.com>
Subject: Re: Transfering files
From: Paul Radaz <radazi16@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============0479725097=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============0479725097==
Content-Type: multipart/alternative; boundary=20cf307ca04487263f04d978f432

--20cf307ca04487263f04d978f432
Content-Type: text/plain; charset=ISO-8859-1

Looks like a this:
LIBSSH2_SFTP *sftp_session;
sftp_session = libssh2_sftp_init(C_server->session);


C_server->session is second LIBSSH2_SESSION for C_server (its connected,
handshaked and authentificated) - yes, I am using "data pump function"
between sockets like in direct_tcpip.c example. Works fine, I can download
files by scp or execute commands but my problem is if I want to create sftp
session for this private C_server.


2013/4/3 Peter Stuge <peter@stuge.se>

> Paul Radaz wrote:
> > when I trying to create sftp_session instance for C through channel
>
> The channel has a libssh2 session, not an sftp session.
>
>
> //Peter
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>

--20cf307ca04487263f04d978f432
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Looks like a this:<br>LIBSSH2_SFTP *sftp_session;<br>sftp_=
session =3D libssh2_sftp_init(C_server-&gt;session);<br><br><br>C_server-&g=
t;session is second LIBSSH2_SESSION for C_server (its connected, handshaked=
 and authentificated) - yes, I am using &quot;data pump function&quot; betw=
een sockets like in direct_tcpip.c example. Works fine, I can download file=
s by scp or execute commands but my problem is if I want to create sftp ses=
sion for this private C_server.<br>
</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">2013/4/=
3 Peter Stuge <span dir=3D"ltr">&lt;<a href=3D"mailto:peter@stuge.se" targe=
t=3D"_blank">peter@stuge.se</a>&gt;</span><br><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=
">
<div class=3D"im">Paul Radaz wrote:<br>
&gt; when I trying to create sftp_session instance for C through channel<br=
>
<br>
</div>The channel has a libssh2 session, not an sftp session.<br>
<br>
<br>
//Peter<br>
_______________________________________________<br>
libssh2-devel <a href=3D"http://cool.haxx.se/cgi-bin/mailman/listinfo/libss=
h2-devel" target=3D"_blank">http://cool.haxx.se/cgi-bin/mailman/listinfo/li=
bssh2-devel</a><br>
</blockquote></div><br></div>

--20cf307ca04487263f04d978f432--

--===============0479725097==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============0479725097==--

From libssh2-devel-bounces@cool.haxx.se  Wed Apr  3 20:50:36 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r33IoSiJ001989;
	Wed, 3 Apr 2013 20:50:35 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r33IoRXp001982
 for <libssh2-devel@cool.haxx.se>; Wed, 3 Apr 2013 20:50:27 +0200
Received: (qmail 2627 invoked by uid 501); 3 Apr 2013 18:50:28 -0000
Message-ID: <20130403185028.2626.qmail@stuge.se>
Date: Wed, 3 Apr 2013 20:50:27 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: Transfering files
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <CACApneiWf9dcqBJWN2haoE_NrS5MN_GM81Jy+1s1nY3yw-3Vvg@mail.gmail.com>
 <20130403173855.28173.qmail@stuge.se>
 <CACApneiEXSRAyb_6EMm9i8neD0VNE6hCwYtkhp4-36aVsRYuYA@mail.gmail.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <CACApneiEXSRAyb_6EMm9i8neD0VNE6hCwYtkhp4-36aVsRYuYA@mail.gmail.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

Paul Radaz wrote:
> Looks like a this:
> LIBSSH2_SFTP *sftp_session;
> sftp_session = libssh2_sftp_init(C_server->session);
> 
> C_server->session is second LIBSSH2_SESSION for C_server (its connected,
> handshaked and authentificated) - yes, I am using "data pump function"
> between sockets like in direct_tcpip.c example. Works fine, I can download
> files by scp or execute commands

OK! That sounds good.


> but my problem is if I want to create sftp session for this private
> C_server.

Well, please enable libssh2 trace output with maximum debug level and
send the output from your program when it fails to create the SFTP
channel. Also send the source code for your program.


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Apr  8 18:32:46 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r38GWFkp023007;
	Mon, 8 Apr 2013 18:32:38 +0200
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r38GWDLk023002
 for <libssh2-devel@cool.haxx.se>; Mon, 8 Apr 2013 18:32:14 +0200
Received: from int-mx12.intmail.prod.int.phx2.redhat.com
 (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r38GWDnU004631
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <libssh2-devel@cool.haxx.se>; Mon, 8 Apr 2013 12:32:14 -0400
Received: from localhost (vpn1-7-71.ams2.redhat.com [10.36.7.71])
 by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 r38GWCVe020761
 for <libssh2-devel@cool.haxx.se>; Mon, 8 Apr 2013 12:32:13 -0400
Date: Mon, 8 Apr 2013 17:32:10 +0100
From: "Richard W.M. Jones" <rjones@redhat.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: [PATCH] sftp: statvfs: Along error path, reset the correct 'state'
 variable.
Message-ID: <20130408163210.GA7617@rhmail.home.annexia.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="/NkBOFFp2J2Af1nK"
Content-Disposition: inline
User-Agent: Mutt/1.5.20 (2009-12-10)
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>


--/NkBOFFp2J2Af1nK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable


This appears to be a typo in the code.

Rich.

--=20
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjon=
es
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

--/NkBOFFp2J2Af1nK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="0001-sftp-statvfs-Along-error-path-reset-the-correct-stat.patch"
Content-Transfer-Encoding: quoted-printable

=46rom 4722dc2709ec35bbab9d2cd90f291a4914aa8781 Mon Sep 17 00:00:00 2001
=46rom: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 8 Apr 2013 17:30:10 +0100
Subject: [PATCH] sftp: statvfs: Along error path, reset the correct 'state'
 variable.

---
 src/sftp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sftp.c b/src/sftp.c
index 3760025..65fa77a 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -2752,7 +2752,7 @@ static int sftp_statvfs(LIBSSH2_SFTP *sftp, const cha=
r *path,
                               "Error waiting for FXP EXTENDED REPLY");
     } else if (data_len < 93) {
         LIBSSH2_FREE(session, data);
-        sftp->fstatvfs_state =3D libssh2_NB_state_idle;
+        sftp->statvfs_state =3D libssh2_NB_state_idle;
         return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
                               "SFTP Protocol Error: short response");
     }
--=20
1.8.1.4


--/NkBOFFp2J2Af1nK
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--/NkBOFFp2J2Af1nK--

From libssh2-devel-bounces@cool.haxx.se  Mon Apr  8 22:12:15 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r38KBnHX000700;
	Mon, 8 Apr 2013 22:12:09 +0200
Received: from giant.haxx.se (localhost.localdomain [127.0.0.1])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r38KBmGU000689
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 8 Apr 2013 22:11:48 +0200
Received: from localhost (dast@localhost)
 by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r38KBmi3000683
 for <libssh2-devel@cool.haxx.se>; Mon, 8 Apr 2013 22:11:48 +0200
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Mon, 8 Apr 2013 22:11:48 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: [PATCH] sftp: statvfs: Along error path, reset the correct
 'state' variable.
In-Reply-To: <20130408163210.GA7617@rhmail.home.annexia.org>
Message-ID: <alpine.DEB.2.00.1304082211290.22005@tvnag.unkk.fr>
References: <20130408163210.GA7617@rhmail.home.annexia.org>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

On Mon, 8 Apr 2013, Richard W.M. Jones wrote:

> This appears to be a typo in the code.

Uh, indeed. Merged and pushed. Thanks!

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr  9 11:42:43 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r399gI5H017045;
	Tue, 9 Apr 2013 11:42:37 +0200
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r399gGXN017040
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 11:42:16 +0200
Received: from int-mx01.intmail.prod.int.phx2.redhat.com
 (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r399gG0A012184
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 05:42:16 -0400
Received: from choo.home.annexia.org (vpn1-7-80.ams2.redhat.com [10.36.7.80])
 by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with
 ESMTP id r399gCfu015937
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 05:42:15 -0400
From: "Richard W.M. Jones" <rjones@redhat.com>
To: libssh2-devel@cool.haxx.se
Subject: [PATCH] sftp: Add support for fsync (OpenSSH extension).
Date: Tue,  9 Apr 2013 10:42:09 +0100
Message-Id: <1365500529-25834-2-git-send-email-rjones@redhat.com>
In-Reply-To: <1365500529-25834-1-git-send-email-rjones@redhat.com>
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

From: "Richard W.M. Jones" <rjones@redhat.com>

The new libssh2_sftp_fsync API causes data and metadata in the
currently open file to be committed to disk at the server.

This is an OpenSSH extension to the SFTP protocol.  See:

https://bugzilla.mindrot.org/show_bug.cgi?id=1798
---
 docs/Makefile.am          |  1 +
 docs/libssh2_sftp_fsync.3 | 39 +++++++++++++++++++
 include/libssh2_sftp.h    |  1 +
 src/sftp.c                | 97 +++++++++++++++++++++++++++++++++++++++++++++++
 src/sftp.h                |  5 +++
 5 files changed, 143 insertions(+)
 create mode 100644 docs/libssh2_sftp_fsync.3

diff --git a/docs/Makefile.am b/docs/Makefile.am
index e4cf487..e6ab394 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -120,6 +120,7 @@ dist_man_MANS = \
 	libssh2_sftp_fstat.3 \
 	libssh2_sftp_fstat_ex.3 \
 	libssh2_sftp_fstatvfs.3 \
+	libssh2_sftp_fsync.3 \
 	libssh2_sftp_get_channel.3 \
 	libssh2_sftp_init.3 \
 	libssh2_sftp_last_error.3 \
diff --git a/docs/libssh2_sftp_fsync.3 b/docs/libssh2_sftp_fsync.3
new file mode 100644
index 0000000..646760a
--- /dev/null
+++ b/docs/libssh2_sftp_fsync.3
@@ -0,0 +1,39 @@
+.TH libssh2_sftp_fsync 3 "8 Apr 2013" "libssh2 1.4.4" "libssh2 manual"
+.SH NAME
+libssh2_sftp_fsync - synchronize file to disk
+.SH SYNOPSIS
+.nf
+#include <libssh2.h>
+#include <libssh2_sftp.h>
+
+int
+libssh2_sftp_fsync(LIBSSH2_SFTP_HANDLE *handle)
+.fi
+.SH DESCRIPTION
+This function causes the remote server to synchronize the file
+data and metadata to disk (like fsync(2)).
+
+For this to work requires fsync@openssh.com support on the server.
+
+\fIhandle\fP - SFTP File Handle as returned by
+.BR libssh2_sftp_open_ex(3)
+
+.SH RETURN VALUE
+Returns 0 on success or negative on failure. If used in non-blocking mode, it
+returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
+LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
+.SH ERRORS
+\fILIBSSH2_ERROR_ALLOC\fP -  An internal memory allocation call failed.
+
+\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
+
+\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response
+was received on the socket, or an SFTP operation caused an errorcode
+to be returned by the server.  In particular, this can be returned if
+the SSH server does not support the fsync operation: the SFTP subcode
+\fILIBSSH2_FX_OP_UNSUPPORTED\fP will be returned in this case.
+
+.SH AVAILABILITY
+Added in libssh2 1.4.4 and OpenSSH 6.3.
+.SH SEE ALSO
+.BR fsync(2)
diff --git a/include/libssh2_sftp.h b/include/libssh2_sftp.h
index 74884fb..677faf2 100644
--- a/include/libssh2_sftp.h
+++ b/include/libssh2_sftp.h
@@ -247,6 +247,7 @@ LIBSSH2_API int libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle, \
 
 LIBSSH2_API ssize_t libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *handle,
                                        const char *buffer, size_t count);
+LIBSSH2_API int libssh2_sftp_fsync(LIBSSH2_SFTP_HANDLE *handle);
 
 LIBSSH2_API int libssh2_sftp_close_handle(LIBSSH2_SFTP_HANDLE *handle);
 #define libssh2_sftp_close(handle) libssh2_sftp_close_handle(handle)
diff --git a/src/sftp.c b/src/sftp.c
index 65fa77a..01017fd 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -986,6 +986,10 @@ sftp_shutdown(LIBSSH2_SFTP *sftp)
         LIBSSH2_FREE(session, sftp->symlink_packet);
         sftp->symlink_packet = NULL;
     }
+    if (sftp->fsync_packet) {
+        LIBSSH2_FREE(session, sftp->fsync_packet);
+        sftp->fsync_packet = NULL;
+    }
 
     sftp_packet_flush(sftp);
 
@@ -2014,6 +2018,99 @@ libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *hnd, const char *buffer,
 
 }
 
+static int sftp_fsync(LIBSSH2_SFTP_HANDLE *handle)
+{
+    LIBSSH2_SFTP *sftp = handle->sftp;
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    /* 34 = packet_len(4) + packet_type(1) + request_id(4) +
+       string_len(4) + strlen("fsync@openssh.com")(17) + handle_len(4) */
+    uint32_t packet_len = handle->handle_len + 34;
+    size_t data_len;
+    unsigned char *packet, *s, *data;
+    ssize_t rc;
+    uint32_t retcode;
+
+    if (sftp->fsync_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                       "Issuing fsync command");
+        s = packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for FXP_EXTENDED "
+                                  "packet");
+        }
+
+        _libssh2_store_u32(&s, packet_len - 4);
+        *(s++) = SSH_FXP_EXTENDED;
+        sftp->fsync_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, sftp->fsync_request_id);
+        _libssh2_store_str(&s, "fsync@openssh.com", 17);
+        _libssh2_store_str(&s, handle->handle, handle->handle_len);
+
+        sftp->fsync_state = libssh2_NB_state_created;
+    } else {
+        packet = sftp->fsync_packet;
+    }
+
+    if (sftp->fsync_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, packet, packet_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN ||
+            (0 <= rc && rc < (ssize_t)packet_len)) {
+            sftp->fsync_packet = packet;
+            return LIBSSH2_ERROR_EAGAIN;
+        }
+
+        LIBSSH2_FREE(session, packet);
+        sftp->fsync_packet = NULL;
+
+        if (rc < 0) {
+            sftp->fsync_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "_libssh2_channel_write() failed");
+        }
+        sftp->fsync_state = libssh2_NB_state_sent;
+    }
+
+    rc = sftp_packet_require(sftp, SSH_FXP_STATUS,
+                             sftp->fsync_request_id, &data, &data_len);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return rc;
+    } else if (rc) {
+        sftp->fsync_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc,
+                              "Error waiting for FXP EXTENDED REPLY");
+    }
+
+    sftp->fsync_state = libssh2_NB_state_idle;
+
+    retcode = _libssh2_ntohu32(data + 5);
+    LIBSSH2_FREE(session, data);
+
+    if (retcode != LIBSSH2_FX_OK) {
+        sftp->last_errno = retcode;
+        return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                              "fsync failed");
+    }
+
+    return 0;
+}
+
+/* libssh2_sftp_fsync
+ * Commit data on the handle to disk.
+ */
+LIBSSH2_API int
+libssh2_sftp_fsync(LIBSSH2_SFTP_HANDLE *hnd)
+{
+    int rc;
+    if(!hnd)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, hnd->sftp->channel->session,
+                 sftp_fsync(hnd));
+    return rc;
+}
+
+
 /*
  * sftp_fstat
  *
diff --git a/src/sftp.h b/src/sftp.h
index 55bdb46..63e8139 100644
--- a/src/sftp.h
+++ b/src/sftp.h
@@ -175,6 +175,11 @@ struct _LIBSSH2_SFTP
     /* State variable used in sftp_write() */
     libssh2_nonblocking_states write_state;
 
+    /* State variables used in sftp_fsync() */
+    libssh2_nonblocking_states fsync_state;
+    unsigned char *fsync_packet;
+    uint32_t fsync_request_id;
+
     /* State variables used in libssh2_sftp_readdir() */
     libssh2_nonblocking_states readdir_state;
     unsigned char *readdir_packet;
-- 
1.8.1.4

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr  9 11:42:44 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r399ghhm017140;
	Tue, 9 Apr 2013 11:42:44 +0200
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r399gH4W017029
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 11:42:18 +0200
Received: from int-mx01.intmail.prod.int.phx2.redhat.com
 (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r399gERm024952
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 05:42:14 -0400
Received: from choo.home.annexia.org (vpn1-7-80.ams2.redhat.com [10.36.7.80])
 by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with
 ESMTP id r399gCft015937
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 05:42:13 -0400
From: "Richard W.M. Jones" <rjones@redhat.com>
To: libssh2-devel@cool.haxx.se
Subject: [PATCH] sftp: Add support for fsync (OpenSSH extension).
Date: Tue,  9 Apr 2013 10:42:08 +0100
Message-Id: <1365500529-25834-1-git-send-email-rjones@redhat.com>
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

The patch (in the following email) adds fsync support to libssh2 via a
new API function called 'libssh2_sftp_fsync'.

*NOTE:* For this to work you will need a patched OpenSSH with an
accepted-upstream-but-not-included patch that adds the
fsync@openssh.com extension to OpenSSH sftp-server.  For details see
here:

https://bugzilla.mindrot.org/show_bug.cgi?id=1798

I have tested this via my qemu ssh block device patch both with and
without fsync support on the server side.

Rich.

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr  9 16:17:30 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39EH029016156;
	Tue, 9 Apr 2013 16:17:21 +0200
Received: from giant.haxx.se (localhost.localdomain [127.0.0.1])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39EGwJN016151
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 16:16:58 +0200
Received: from localhost (dast@localhost)
 by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r39EGwUd016147
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 16:16:58 +0200
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Tue, 9 Apr 2013 16:16:58 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
In-Reply-To: <1365500529-25834-1-git-send-email-rjones@redhat.com>
Message-ID: <alpine.DEB.2.00.1304091615580.22285@tvnag.unkk.fr>
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

On Tue, 9 Apr 2013, Richard W.M. Jones wrote:

> *NOTE:* For this to work you will need a patched OpenSSH with an 
> accepted-upstream-but-not-included patch that adds the fsync@openssh.com 
> extension to OpenSSH sftp-server.

Very cool! I'll merge this asap.

I'm curious though, what exactly happens if you try this on a non-supporting 
SFTP server? Can we make that fail in a nice way?


-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr  9 16:23:56 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39ENo45020821;
	Tue, 9 Apr 2013 16:23:53 +0200
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39ENmg6020806
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 16:23:48 +0200
Received: from int-mx12.intmail.prod.int.phx2.redhat.com
 (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r39ENmDf000557
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 10:23:48 -0400
Received: from localhost (vpn1-7-80.ams2.redhat.com [10.36.7.80])
 by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 r39ENlT9011728
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 10:23:48 -0400
Date: Tue, 9 Apr 2013 15:23:45 +0100
From: "Richard W.M. Jones" <rjones@redhat.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
Message-ID: <20130409142345.GB7617@rhmail.home.annexia.org>
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
 <alpine.DEB.2.00.1304091615580.22285@tvnag.unkk.fr>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <alpine.DEB.2.00.1304091615580.22285@tvnag.unkk.fr>
User-Agent: Mutt/1.5.20 (2009-12-10)
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

On Tue, Apr 09, 2013 at 04:16:58PM +0200, Daniel Stenberg wrote:
> On Tue, 9 Apr 2013, Richard W.M. Jones wrote:
> 
> >*NOTE:* For this to work you will need a patched OpenSSH with an
> >accepted-upstream-but-not-included patch that adds the
> >fsync@openssh.com extension to OpenSSH sftp-server.
> 
> Very cool! I'll merge this asap.
> 
> I'm curious though, what exactly happens if you try this on a
> non-supporting SFTP server? Can we make that fail in a nice way?

Yes, very much so, that's important to us because lots of
servers will not support fsync for a long time to come.

In this case, it fails as follows:

/* extract from the latest qemu ssh block driver code */
    r = libssh2_sftp_fsync(s->sftp_handle);
/* ... */
    if (r == LIBSSH2_ERROR_SFTP_PROTOCOL &&
        libssh2_sftp_last_error(s->sftp) == LIBSSH2_FX_OP_UNSUPPORTED) {
        unsafe_flush_warning(s, "OpenSSH >= 6.3");
        return 0;
    }

This behaviour is also documented in the libssh2_sftp_fsync man page
that I sent.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr  9 16:25:01 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39EOxl6021442;
	Tue, 9 Apr 2013 16:25:00 +0200
Received: from giant.haxx.se (localhost.localdomain [127.0.0.1])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39EOvIA021433
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 16:24:57 +0200
Received: from localhost (dast@localhost)
 by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r39EOvUd021423
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 16:24:57 +0200
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Tue, 9 Apr 2013 16:24:57 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
In-Reply-To: <20130409142345.GB7617@rhmail.home.annexia.org>
Message-ID: <alpine.DEB.2.00.1304091624180.22285@tvnag.unkk.fr>
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
 <alpine.DEB.2.00.1304091615580.22285@tvnag.unkk.fr>
 <20130409142345.GB7617@rhmail.home.annexia.org>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

On Tue, 9 Apr 2013, Richard W.M. Jones wrote:

> This behaviour is also documented in the libssh2_sftp_fsync man page that I 
> sent.

Oops, are you suggesting I should actually read before I respond? B)

Thanks a lot!

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr  9 16:41:54 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39Efk5k000775;
	Tue, 9 Apr 2013 16:41:52 +0200
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39Efibe000744
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 16:41:45 +0200
Received: from int-mx10.intmail.prod.int.phx2.redhat.com
 (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r39EfiXw031266
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 10:41:44 -0400
Received: from localhost (vpn1-7-80.ams2.redhat.com [10.36.7.80])
 by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 r39EfhNE025518
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 10:41:44 -0400
Date: Tue, 9 Apr 2013 15:41:42 +0100
From: "Richard W.M. Jones" <rjones@redhat.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
Message-ID: <20130409144142.GC7617@rhmail.home.annexia.org>
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
 <alpine.DEB.2.00.1304091615580.22285@tvnag.unkk.fr>
 <20130409142345.GB7617@rhmail.home.annexia.org>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <20130409142345.GB7617@rhmail.home.annexia.org>
User-Agent: Mutt/1.5.20 (2009-12-10)
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

Thanks for committing this.

FWIW the latest qemu ssh block driver is here:

http://lists.gnu.org/archive/html/qemu-devel/2013-04/threads.html#01703

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr  9 18:21:12 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39GKwf2028193;
	Tue, 9 Apr 2013 18:21:09 +0200
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com
 [66.111.4.27])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39GKtGb028184
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 18:20:56 +0200
Received: from compute3.internal (compute3.nyi.mail.srv.osa [10.202.2.43])
 by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id AA36D2094F
 for <libssh2-devel@cool.haxx.se>; Tue,  9 Apr 2013 12:20:56 -0400 (EDT)
Received: from frontend1.nyi.mail.srv.osa ([10.202.2.160])
 by compute3.internal (MEProxy); Tue, 09 Apr 2013 12:20:56 -0400
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=castaglia.org; h=
 date:from:to:subject:in-reply-to:message-id:references
 :mime-version:content-type; s=mesmtp; bh=Kij820vJKpRVcvSpo+5p8B7
 PUys=; b=tvy3yI1jvsZ0oCxEAwnj1Qauhb5MGEnOaBTE6dFK/o5IvcM+Yaf/k+A
 2ToWeSK21KcNAmRpZUdaf9fg9qY4mL3+suo7YiBKlWAki6XnRqvMQrI+DUmIjDRx
 gh0l+ylYPEwdbUk9/NGX/4XsTT55w0r9Kz5CTxyYXnBAYuwqBB8k=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=
 messagingengine.com; h=date:from:to:subject:in-reply-to
 :message-id:references:mime-version:content-type; s=smtpout; bh=
 Kij820vJKpRVcvSpo+5p8B7PUys=; b=q4c7GFrseWbSLFLanSeDWKcHsKWdCBsB
 yrjmNY1Oo3M9pEzN1c+SMgirvWhbB0gRumf9cpeAyVYTTLuqpVy3chpv+XvRk0mf
 Ur8FxX+ipjp9BuqZISMIFwaO1Qh5JcI89riFHflPZ6jFFDEoESOs6ebXCrCjPzqj
 nRKkMcUPNFg=
X-Sasl-enc: OUujY/FUHCkaNUSe2TbGNLUfuhPAy4FeWGSBScCCbdnI 1365524456
Received: from familiar.local (unknown [50.202.115.1])
 by mail.messagingengine.com (Postfix) with ESMTPA id 4CD8DC8000E
 for <libssh2-devel@cool.haxx.se>; Tue,  9 Apr 2013 12:20:56 -0400 (EDT)
Date: Tue, 9 Apr 2013 09:20:55 -0700 (PDT)
From: TJ Saunders <tj@castaglia.org>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
In-Reply-To: <20130409142345.GB7617@rhmail.home.annexia.org>
Message-ID: <alpine.DEB.2.00.1304090920170.3558@familiar.castaglia.org>
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
 <alpine.DEB.2.00.1304091615580.22285@tvnag.unkk.fr>
 <20130409142345.GB7617@rhmail.home.annexia.org>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>


> In this case, it fails as follows:
> 
> /* extract from the latest qemu ssh block driver code */
>     r = libssh2_sftp_fsync(s->sftp_handle);
> /* ... */
>     if (r == LIBSSH2_ERROR_SFTP_PROTOCOL &&
>         libssh2_sftp_last_error(s->sftp) == LIBSSH2_FX_OP_UNSUPPORTED) {
>         unsafe_flush_warning(s, "OpenSSH >= 6.3");
>         return 0;
>     }

What about SSH servers, other than OpenSSH, which might implement this 
extension?  The unsafe_flush_warning() message there, then, might be 
misleading...

Cheers,
TJ

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   No day in which something is learned is ever wasted.

     -TJ Saunders

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr  9 18:31:26 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39GVLuW001014;
	Tue, 9 Apr 2013 18:31:25 +0200
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39GVJ55000993
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 18:31:20 +0200
Received: from int-mx12.intmail.prod.int.phx2.redhat.com
 (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r39GVKMS015282
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 12:31:20 -0400
Received: from localhost (vpn1-7-80.ams2.redhat.com [10.36.7.80])
 by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 r39GVJSs017399
 for <libssh2-devel@cool.haxx.se>; Tue, 9 Apr 2013 12:31:19 -0400
Date: Tue, 9 Apr 2013 17:31:17 +0100
From: "Richard W.M. Jones" <rjones@redhat.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
Message-ID: <20130409163117.GD7617@rhmail.home.annexia.org>
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
 <alpine.DEB.2.00.1304091615580.22285@tvnag.unkk.fr>
 <20130409142345.GB7617@rhmail.home.annexia.org>
 <alpine.DEB.2.00.1304090920170.3558@familiar.castaglia.org>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <alpine.DEB.2.00.1304090920170.3558@familiar.castaglia.org>
User-Agent: Mutt/1.5.20 (2009-12-10)
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

On Tue, Apr 09, 2013 at 09:20:55AM -0700, TJ Saunders wrote:
> 
> > In this case, it fails as follows:
> > 
> > /* extract from the latest qemu ssh block driver code */
> >     r = libssh2_sftp_fsync(s->sftp_handle);
> > /* ... */
> >     if (r == LIBSSH2_ERROR_SFTP_PROTOCOL &&
> >         libssh2_sftp_last_error(s->sftp) == LIBSSH2_FX_OP_UNSUPPORTED) {
> >         unsafe_flush_warning(s, "OpenSSH >= 6.3");
> >         return 0;
> >     }
> 
> What about SSH servers, other than OpenSSH, which might implement this 
> extension?  The unsafe_flush_warning() message there, then, might be 
> misleading...

I'll certainly update this message if other ssh servers support
this extension (and I hope they do).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed Apr 10 00:26:51 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39MQSKw018231;
	Wed, 10 Apr 2013 00:26:44 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r39MQRSK018223
 for <libssh2-devel@cool.haxx.se>; Wed, 10 Apr 2013 00:26:27 +0200
Received: (qmail 10476 invoked from network); 9 Apr 2013 22:26:23 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
 by localhost with SMTP; 9 Apr 2013 22:26:23 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 1.0dev
Precedence: bulk
Cc: libssh2-devel@cool.haxx.se
Auto-Submitted: auto-generated
X-Mailer: Trac 1.0dev, by Edgewall Software
X-Trac-Project: libssh2
Date: Tue, 09 Apr 2013 22:26:22 -0000
X-URL: https://trac.libssh2.org/
Subject: [libssh2] #263: libssh2_channel_read for exec ends unpredictably
X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/263
Message-ID: <044.53446138e774d232ecdbb1718d2c1cb0@libssh2.stuge.se>
X-Trac-Ticket-ID: 263
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r39MQRSK018223
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

#263: libssh2_channel_read for exec ends unpredictably
---------------------+--------------------
 Reporter:  xtravar  |       Owner:
     Type:  defect   |      Status:  new
 Priority:  normal   |   Milestone:  1.4.3
Component:  API      |     Version:  1.4.2
 Keywords:           |  Blocked By:
   Blocks:           |
---------------------+--------------------
 Problem: libssh2_channel_exec is returning EOF sooner than expected
 randomly

 Client Platform: iOS
 Versions tried: 1.4.3, 1.4.4-20130409

 *Tried with blocking & non-blocking
 *Piped to 'tee' to verify the process isn't ending prematurely (the file
 gets written out completely)
 *Same problem does not happen with SCP
 *Never happens on the first run of the code

 My code vaguely looks like:
 {{{
 chan = libssh2_channel_open_session(session);
 libssh2_channel_exec(chan, "convert \"test.jpg\" -quality 60 -resize 100%
 -format JPEG - 2>/dev/null | tee converttest.jpg")
 // loop until read returns 0 (eof also becomes true at this point)
 libssh2_channel_close(chan);
 }}}

 The problem happens after a few runs of the code on the same command.
 It's fairly reproducible.  I have some trace output that might be useful.

 Good run:
  Conn: Allocated new channel ID#2
  Conn: Opening Channel - win 262144 pack 32768
  Socket: Sent 52/52 bytes at 0x8a9775c
  Failure Event: -37 - Would block
  Socket: Recved 52/16384 bytes to 0x8a93734+0
  Conn: Connection Established - ID: 2/1 win: 0/262144 pack: 32768/32768
  Conn: starting request(exec) on channel 2/1, message=convert "cover.jpg"
 -quality 60 -resize 100% -format JPEG -
  Socket: Sent 52/52 bytes at 0x8a9775c
  Socket: Recved 88/16384 bytes to 0x8a93734+0
  Conn: Window adjust for channel 2/1, adding 2097152 bytes, new
 window_size=2097152
  Conn: channel_read() wants 10240 bytes from channel 2/1 stream #0
  Failure Event: -37 - would block
  Conn: channel_read() wants 10240 bytes from channel 2/1 stream #0
  Socket: Recved 116/16384 bytes to 0x8a93734+0
  Conn: 8192 bytes packet_add() for 2/1/0
  Conn: channel_read() got 8192 of data from 2/1/0 [ul]
  Socket: Recved 376/16384 bytes to 0x8a93734+0
  Conn: 8192 bytes packet_add() for 2/1/0
  Conn: 4096 bytes packet_add() for 2/1/0
  Conn: 851 bytes packet_add() for 2/1/0
  Conn: EOF received for channel 2/1
  Conn: Channel 2 received request type exit-status (wr 0)
  Conn: Exit status 0 received for channel 2/1
  Conn: Close received for channel 2/1
  Conn: channel_read() got 8192 of data from 2/1/0 [ul]
  Conn: channel_read() got 2048 of data from 2/1/0
  Conn: channel_read() got 2048 of data from 2/1/0 [ul]
  Conn: channel_read() got 851 of data from 2/1/0 [ul]
  Conn: Sending EOF on channel 2/1
  Socket: Sent 36/36 bytes at 0x8a9775c
  Conn: Closing channel 2/1
  Socket: Sent 36/36 bytes at 0x8a9775c


 Bad run:
  Conn: Allocated new channel ID#2
  Conn: Opening Channel - win 262144 pack 32768
  Socket: Sent 52/52 bytes at 0x8a9775c
  Failure Event: -37 - Would block
  Socket: Recved 52/16384 bytes to 0x8a93734+0
  Conn: Connection Established - ID: 2/1 win: 0/262144 pack: 32768/32768
  Conn: starting request(exec) on channel 2/1, message=convert "cover.jpg"
 -quality 60 -resize 100% -format JPEG -
  Socket: Sent 52/52 bytes at 0x8a9775c
  Socket: Recved 88/16384 bytes to 0x8a93734+0
  Conn: Window adjust for channel 2/1, adding 2097152 bytes, new
 window_size=2097152
  Conn: channel_read() wants 10240 bytes from channel 2/1 stream #0
  Failure Event: -37 - would block
  Conn: channel_read() wants 10240 bytes from channel 2/1 stream #0
  Socket: Recved 116/16384 bytes to 0x8a93734+0
  Conn: 8007 bytes packet_add() for 2/1/0
  Conn: channel_read() got 8007 of data from 2/1/0 [ul]
  Failure Event: -37 - would block
  Conn: channel_read() wants 10240 bytes from channel 2/1 stream #0
  Socket: Recved 116/16384 bytes to 0x8a93734+0
  Failure Event: -37 - would block
  Conn: channel_read() wants 10240 bytes from channel 2/1 stream #0
  Socket: Recved 82/16384 bytes to 0x8a93734+0
  Conn: 4096 bytes packet_add() for 2/1/0
  Conn: channel_read() got 4096 of data from 2/1/0 [ul]
  Socket: Recved 176/16384 bytes to 0x8a93734+0
  Conn: 851 bytes packet_add() for 2/1/0
  Conn: Channel 2 received request type exit-status (wr 0)
  Conn: Exit status 0 received for channel 2/1
  Conn: EOF received for channel 2/1
  Conn: Close received for channel 2/1
  Conn: channel_read() got 851 of data from 2/1/0 [ul]
  Conn: Sending EOF on channel 2/1
  Socket: Sent 36/36 bytes at 0x8a9775c
  Conn: Closing channel 2/1
  Socket: Sent 36/36 bytes at 0x8a9775c

-- 
Ticket URL: <https://trac.libssh2.org/ticket/263>
libssh2 <https://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed Apr 10 22:47:06 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3AKkgBL013288;
	Wed, 10 Apr 2013 22:47:01 +0200
Received: from main.storm.pl (postfix@storm.pl [94.23.56.128])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3AKkfQ4013273
 for <libssh2-devel@cool.haxx.se>; Wed, 10 Apr 2013 22:46:41 +0200
Received: from localhost (localhost.localdomain [127.0.0.1])
 by main.storm.pl (Postfix) with ESMTP id 1D3BB6D660
 for <libssh2-devel@cool.haxx.se>; Wed, 10 Apr 2013 22:46:42 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at storm.pl
Received: from main.storm.pl ([127.0.0.1])
 by localhost (storm.pl [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id O2h3k2rng6zK for <libssh2-devel@cool.haxx.se>;
 Wed, 10 Apr 2013 22:46:40 +0200 (CEST)
Received: from [192.168.4.90] (c-71-197-0-193.hsd1.va.comcast.net
 [71.197.0.193]) by main.storm.pl (Postfix) with ESMTPA id 647EA6D651
 for <libssh2-devel@cool.haxx.se>; Wed, 10 Apr 2013 22:46:40 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=syncad.com;
 s=dkim1301; t=1365626800;
 bh=5DyGrO89FYHvgZS6bfG9nHJWmV9ZBzLXHtffEP4c0vc=;
 h=Date:From:To:Subject:From;
 b=Ew7vKSn268+YZkDhK31Ic4biiP5TYR6AJV4e4dkktksNQFeZIny1LtuFEtSRgbcbU
 Mw6Gu65lGIPAO/6HPgnKfd6/oNDYXNlbyEw9+szrKRwXsIc+d2TujXZbsi+ShNxlxC
 kTfoY1ihBskYg43UauNEn30RCkuGW176bsaFR6/4=
Message-ID: <5165CFAC.80304@syncad.com>
Date: Wed, 10 Apr 2013 16:46:36 -0400
From: Eric Frias <efrias@syncad.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
 rv:17.0) Gecko/20130307 Thunderbird/17.0.4
MIME-Version: 1.0
To: libssh2-devel@cool.haxx.se
Subject: proper use of non-blocking read
X-Enigmail-Version: 1.5.1
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

I've been trying to figure out how to use libssh2's non-blocking API
correctly, and I'm stuck.  I can get it to work 99% of the time, but
that last 1% is eludes me.

The main problem I'm battling is what happens when I need to do a read
on a channel, and I don't know if there's going to be any data there to
read.  If there is, I want to read it.  If there's no data, I want to be
able to do other stuff like write to the channel or read or write to
another channel.  Seems pretty normal.

So let's say I call libssh2_channel_read_ex() and it returns
LIBSSH2_ERROR_EAGAIN.  My problem is that I can't tell what this means. 
It could mean that:
* there was no data on that channel, and it's safe to go write some data
or service another channel.  or,
* in the process of doing the read, libssh2 wandered into
_libssh2_channel_receive_window_adjust, sending a message to the ssh
server.  While sending the adjust message, the TCP send buffer filled
up, and the OS level send(2) call returned EAGAIN

Of course, this second case is the one that is giving me problems. 
Although I haven't seen it stated explicitly anywhere, it looks like if
I get LIBSSH2_ERROR_EAGAIN due to a failed write, the only thing I can
safely do with libssh2 is wait and call the same
libssh2_channel_read_ex() function again with the same arguments until
it manages to finish the write.  If I were to make some other call to
libssh2 which could result in network traffic, libssh2 will give me a
slap on the wrist (in the form of a LIBSSH2_ERROR_BAD_USE) and then I'm
in trouble.

If I always assume that an LIBSSH2_ERROR_EAGAIN means that I can call
other functions, my tests will usually run pretty well for a few
minutes, maybe even hours, but eventually this error (or some variant of
it) will bite me.  If I assume that LIBSSH2_ERROR_EAGAIN means the only
thing I can do is call the exact same function until it succeeds, I'm
trapped because I can't safely read from a channel unless I know there
will be data on it.

Am I missing something that would let me use the public API safely? 
Right now I'm playing around with workarounds like only allowing my code
to switch and call another function if session->packet.olen == 0 after
an LIBSSH2_ERROR_EAGAIN, but that's ugly and I don't have much
confidence that I'm on the right track.

Thanks.
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed Apr 10 23:28:12 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3ALS5he005937;
	Wed, 10 Apr 2013 23:28:10 +0200
Received: from giant.haxx.se (localhost.localdomain [127.0.0.1])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3ALS4Vq005932
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Wed, 10 Apr 2013 23:28:04 +0200
Received: from localhost (dast@localhost)
 by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r3ALS4Sf005928
 for <libssh2-devel@cool.haxx.se>; Wed, 10 Apr 2013 23:28:04 +0200
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Wed, 10 Apr 2013 23:28:03 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: proper use of non-blocking read
In-Reply-To: <5165CFAC.80304@syncad.com>
Message-ID: <alpine.DEB.2.00.1304102315090.10099@tvnag.unkk.fr>
References: <5165CFAC.80304@syncad.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

On Wed, 10 Apr 2013, Eric Frias wrote:

> The main problem I'm battling is what happens when I need to do a read on a 
> channel, and I don't know if there's going to be any data there to read. 
> If there is, I want to read it.  If there's no data, I want to be able to do 
> other stuff like write to the channel or read or write to another channel. 
> Seems pretty normal.

But stuff you'd do on another channel isn't the problem here, right? Just 
trying to check that I follow you properly.

> So let's say I call libssh2_channel_read_ex() and it returns
> LIBSSH2_ERROR_EAGAIN.  My problem is that I can't tell what this means.
> It could mean that:
> * there was no data on that channel, and it's safe to go write some data
> or service another channel.  or,
> * in the process of doing the read, libssh2 wandered into
> _libssh2_channel_receive_window_adjust, sending a message to the ssh
> server.  While sending the adjust message, the TCP send buffer filled
> up, and the OS level send(2) call returned EAGAIN

Yes. EAGAIN is a bit restrictive in that it only says libssh2 couldn't deliver 
any data to you and you need to call libssh2_session_block_directions() to 
figure out which direction of the communication that caused EAGAIN.

> Of course, this second case is the one that is giving me problems. Although 
> I haven't seen it stated explicitly anywhere, it looks like if I get 
> LIBSSH2_ERROR_EAGAIN due to a failed write, the only thing I can safely do 
> with libssh2 is wait and call the same libssh2_channel_read_ex() function 
> again with the same arguments until it manages to finish the write.  If I 
> were to make some other call to libssh2 which could result in network 
> traffic, libssh2 will give me a slap on the wrist (in the form of a 
> LIBSSH2_ERROR_BAD_USE) and then I'm in trouble.

This is a flaw in the current implementation and I would really like us to fix 
it. I believe someone else also mentioned this limitation a short while ago. I 
guess you're being hit by a check in the transport layer like in 
send_existing() ?

> Am I missing something that would let me use the public API safely? Right 
> now I'm playing around with workarounds like only allowing my code to switch 
> and call another function if session->packet.olen == 0 after an 
> LIBSSH2_ERROR_EAGAIN, but that's ugly and I don't have much confidence that 
> I'm on the right track.

I think the proper way to implement this would be sure that the queue for 
outgoing messages on the channel is still being drained properly and in the 
right order even if you try another function that would send data.

Personally I've been backlogged badly recently so I haven't been able to do 
much libssh2 hacking and I don't think there's much improvement for me in the 
near future either.

I think creating a good test case that repeats the situation in a fairly good 
way could be a first step, then work on fixing code to work with it.

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Thu Apr 11 00:31:33 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3AMVI1d007700;
	Thu, 11 Apr 2013 00:31:29 +0200
Received: from main.storm.pl (postfix@storm.pl [94.23.56.128])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3AMUEOJ007335
 for <libssh2-devel@cool.haxx.se>; Thu, 11 Apr 2013 00:30:14 +0200
Received: from localhost (localhost.localdomain [127.0.0.1])
 by main.storm.pl (Postfix) with ESMTP id 118C86D660
 for <libssh2-devel@cool.haxx.se>; Thu, 11 Apr 2013 00:30:15 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at storm.pl
Received: from main.storm.pl ([127.0.0.1])
 by localhost (storm.pl [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id mgmVN0sdvQSF for <libssh2-devel@cool.haxx.se>;
 Thu, 11 Apr 2013 00:30:12 +0200 (CEST)
Received: from [192.168.4.90] (c-71-197-0-193.hsd1.va.comcast.net
 [71.197.0.193]) by main.storm.pl (Postfix) with ESMTPA id 5590F6D651
 for <libssh2-devel@cool.haxx.se>; Thu, 11 Apr 2013 00:30:12 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=syncad.com;
 s=dkim1301; t=1365633012;
 bh=5tVs4+oMPX1L3Fo5J5smaYSo9F+YTxBd7avHGiu1A50=;
 h=Date:From:To:Subject:References:In-Reply-To:From;
 b=dGJL9vOCgaJ1nmICRBOfGBmnguh14mbR76Yd0L5fZcDfhYxjyHAx+AEx1+s0j4LR1
 SbRey6jZqrlTDUKOGQ68zqY6w3o8QvbqfKdp5gLaN7w7B2bTo1lD02OtkezL+EvEfj
 AYajewpvqbWnXSa+nVhKY08WiYP98VNxwzC1ODgM=
Message-ID: <5165E7F0.4030709@syncad.com>
Date: Wed, 10 Apr 2013 18:30:08 -0400
From: Eric Frias <efrias@syncad.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
 rv:17.0) Gecko/20130307 Thunderbird/17.0.4
MIME-Version: 1.0
To: libssh2-devel@cool.haxx.se
Subject: Re: proper use of non-blocking read
References: <5165CFAC.80304@syncad.com>
 <alpine.DEB.2.00.1304102315090.10099@tvnag.unkk.fr>
In-Reply-To: <alpine.DEB.2.00.1304102315090.10099@tvnag.unkk.fr>
X-Enigmail-Version: 1.5.1
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

On 4/10/2013 5:28 PM, Daniel Stenberg wrote:
> On Wed, 10 Apr 2013, Eric Frias wrote:
>
>> The main problem I'm battling is what happens when I need to do a
>> read on a channel, and I don't know if there's going to be any data
>> there to read. If there is, I want to read it.  If there's no data, I
>> want to be able to do other stuff like write to the channel or read
>> or write to another channel. Seems pretty normal.
>
> But stuff you'd do on another channel isn't the problem here, right?
> Just trying to check that I follow you properly.
From the rest of your email, I'm pretty sure you understand the problem
I'm running into.  I wish I hadn't mentioned a second channel now,
because this is going to be messy to explain clearly.

I can easily get myself into trouble reading and writing with only one
channel.  So in that sense, the separate channel isn't exactly my
problem.  But this problem seems to stem from state data stored in the
session object, so the problem isn't confined to any one channel.  If I
get an LIBSSH2_ERROR_EAGAIN from a read on one channel and then I
proceed to do write on a second channel, send_existing() might complain
at me.
> Yes. EAGAIN is a bit restrictive in that it only says libssh2 couldn't
> deliver any data to you and you need to call
> libssh2_session_block_directions() to figure out which direction of
> the communication that caused EAGAIN.
That seems perfectly fair to me.
> This is a flaw in the current implementation and I would really like
> us to fix it. I believe someone else also mentioned this limitation a
> short while ago. I guess you're being hit by a check in the transport
> layer like in send_existing() ?
That's exactly the error I've been hitting.  I just started looking at
trac, and this ticket from a few months ago seems to be related:
    http://trac.libssh2.org/ticket/256
Like that ticket's owner, my problem is easier to produce on slower VPN
links than on a fast local network connection.

> I think the proper way to implement this would be sure that the queue
> for outgoing messages on the channel is still being drained properly
> and in the right order even if you try another function that would
> send data.
That sounds about right to me.  In my specific case, I'd want the
library to queue up the window adjust packet to be sent the next time
any libssh2 function gets called.  If that weren't possible, I'd settle
for some indication (maybe a different return code) that only part of
the data was sent and I was required to call this same function again as
soon as there was room in the send buffer.
> Personally I've been backlogged badly recently so I haven't been able
> to do much libssh2 hacking and I don't think there's much improvement
> for me in the near future either.
>
> I think creating a good test case that repeats the situation in a
> fairly good way could be a first step, then work on fixing code to
> work with it.
I know how that goes... I'll see if I can cook up a simple test.

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Thu Apr 11 00:44:20 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3AMiFmA013169;
	Thu, 11 Apr 2013 00:44:18 +0200
Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com
 [209.85.192.178])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3AMiCTD013159
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Thu, 11 Apr 2013 00:44:14 +0200
Received: by mail-pd0-f178.google.com with SMTP id w11so499718pde.23
 for <libssh2-devel@cool.haxx.se>; Wed, 10 Apr 2013 15:44:08 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=google.com; s=20120113;
 h=x-received:message-id:date:from:user-agent:mime-version:to:subject
 :references:in-reply-to:content-type:content-transfer-encoding
 :x-gm-message-state;
 bh=5WI5upplXK5w5Bhm6vWWFvswPcyFHTXTV4iu8AaV45k=;
 b=gTJUteIxRxg49pXDc1nFIX5CFSlun+zBt3LiBNtUz9nsHEwRj+VOCEU/LSVzhBmevW
 wexh9/B+DOW4HgoX3o1jdM+aGwqN7UfAonspZAytwUsZDPTC9CT6D3WTJ7SWwAix9e2e
 g8twJHa24SOUMIfg1+fMokvY6iretk81hS4m5JTUfYnMbTU9fl+FfzOUesGodQNaODFg
 BW332ZScAJZaZyCDQs09YtIuGc62NNDhVfX3v8EBbgN4OlgqqlNeqiu4o0RPkHOjFPEy
 5mOpAS1w0u6oMmYGtNsM2zipZwIvgFGePcFOQJB5zTJQVsAEmea3jQMUHXZuus1pDSUz
 M3Nw==
X-Received: by 10.68.197.42 with SMTP id ir10mr5314634pbc.197.1365633848812;
 Wed, 10 Apr 2013 15:44:08 -0700 (PDT)
Received: from [192.168.1.118] ([200.34.42.170])
 by mx.google.com with ESMTPS id lf12sm2101275pab.13.2013.04.10.15.44.06
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Wed, 10 Apr 2013 15:44:07 -0700 (PDT)
Message-ID: <5165EB32.3060204@d6.com>
Date: Wed, 10 Apr 2013 15:44:02 -0700
From: Chris Hecker <checker@d6.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
 rv:17.0) Gecko/20130328 Thunderbird/17.0.5
MIME-Version: 1.0
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: proper use of non-blocking read
References: <5165CFAC.80304@syncad.com>
 <alpine.DEB.2.00.1304102315090.10099@tvnag.unkk.fr>
 <5165E7F0.4030709@syncad.com>
In-Reply-To: <5165E7F0.4030709@syncad.com>
X-Gm-Message-State: ALoCoQn+LshI/9oPS6akRocdUfiuVBf2H2QpEv2emF+akRvJ5M0MC+H5eaHECFP41CFKWLwvZoyd
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>


This is the recent thread where I had similar issues:

http://www.libssh2.org/mail/libssh2-devel-archive-2013-02/0022.shtml

I only thought about/debugged it a bit, but it seemed pretty clear to me 
that the only real fix is an internal queue and changing EAGAIN 
semantics slightly, as discussed in that thread.

I'm only using libssh2 for loadtesting stuff right now, not production 
code, so I can just restart when I run into problems, but somebody 
should fix this at some point if the library is going to be production 
quality, in my opinion.  If I ever end up using it for production code 
I'll fix it, but no time right now.

Chris


On 4/10/2013 3:30 PM, Eric Frias wrote:
> On 4/10/2013 5:28 PM, Daniel Stenberg wrote:
>> On Wed, 10 Apr 2013, Eric Frias wrote:
>>
>>> The main problem I'm battling is what happens when I need to do a
>>> read on a channel, and I don't know if there's going to be any data
>>> there to read. If there is, I want to read it.  If there's no data, I
>>> want to be able to do other stuff like write to the channel or read
>>> or write to another channel. Seems pretty normal.
>>
>> But stuff you'd do on another channel isn't the problem here, right?
>> Just trying to check that I follow you properly.
>>From the rest of your email, I'm pretty sure you understand the problem
> I'm running into.  I wish I hadn't mentioned a second channel now,
> because this is going to be messy to explain clearly.
>
> I can easily get myself into trouble reading and writing with only one
> channel.  So in that sense, the separate channel isn't exactly my
> problem.  But this problem seems to stem from state data stored in the
> session object, so the problem isn't confined to any one channel.  If I
> get an LIBSSH2_ERROR_EAGAIN from a read on one channel and then I
> proceed to do write on a second channel, send_existing() might complain
> at me.
>> Yes. EAGAIN is a bit restrictive in that it only says libssh2 couldn't
>> deliver any data to you and you need to call
>> libssh2_session_block_directions() to figure out which direction of
>> the communication that caused EAGAIN.
> That seems perfectly fair to me.
>> This is a flaw in the current implementation and I would really like
>> us to fix it. I believe someone else also mentioned this limitation a
>> short while ago. I guess you're being hit by a check in the transport
>> layer like in send_existing() ?
> That's exactly the error I've been hitting.  I just started looking at
> trac, and this ticket from a few months ago seems to be related:
>      http://trac.libssh2.org/ticket/256
> Like that ticket's owner, my problem is easier to produce on slower VPN
> links than on a fast local network connection.
>
>> I think the proper way to implement this would be sure that the queue
>> for outgoing messages on the channel is still being drained properly
>> and in the right order even if you try another function that would
>> send data.
> That sounds about right to me.  In my specific case, I'd want the
> library to queue up the window adjust packet to be sent the next time
> any libssh2 function gets called.  If that weren't possible, I'd settle
> for some indication (maybe a different return code) that only part of
> the data was sent and I was required to call this same function again as
> soon as there was room in the send buffer.
>> Personally I've been backlogged badly recently so I haven't been able
>> to do much libssh2 hacking and I don't think there's much improvement
>> for me in the near future either.
>>
>> I think creating a good test case that repeats the situation in a
>> fairly good way could be a first step, then work on fixing code to
>> work with it.
> I know how that goes... I'll see if I can cook up a simple test.
>
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Thu Apr 11 22:50:14 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3BKnq2X025098;
	Thu, 11 Apr 2013 22:50:09 +0200
Received: from main.storm.pl (postfix@storm.pl [94.23.56.128])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3BKnplm025001
 for <libssh2-devel@cool.haxx.se>; Thu, 11 Apr 2013 22:49:51 +0200
Received: from localhost (localhost.localdomain [127.0.0.1])
 by main.storm.pl (Postfix) with ESMTP id 5CC0E6D660
 for <libssh2-devel@cool.haxx.se>; Thu, 11 Apr 2013 22:49:52 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at storm.pl
Received: from main.storm.pl ([127.0.0.1])
 by localhost (storm.pl [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id MGA0yUx7gR4d for <libssh2-devel@cool.haxx.se>;
 Thu, 11 Apr 2013 22:49:51 +0200 (CEST)
Received: from [192.168.4.90] (c-71-197-0-193.hsd1.va.comcast.net
 [71.197.0.193]) by main.storm.pl (Postfix) with ESMTPA id 9BFDB6D651
 for <libssh2-devel@cool.haxx.se>; Thu, 11 Apr 2013 22:49:50 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=syncad.com;
 s=dkim1301; t=1365713390;
 bh=rD8XbiL3kQM0NuO3DWjWDeHjrtlXx+gIvcYEg0Mvkr0=;
 h=Date:From:To:Subject:References:In-Reply-To:From;
 b=XoMvBh5+fRTmMzjrQc74PNOwjE9oN2yedcVJQDNbkEJt/aJnXrdL4k2twLRYi9sLO
 uHqSMHyJmUA+c6pfBCzzlu+zxK7DrkziBmOtWIsj/XQCdOcGMeebiitL8uacgn1uPn
 luiJhzN63COM/dawM18jdIACNLd/PwCpPEjLNNdk=
Message-ID: <516721E9.4050500@syncad.com>
Date: Thu, 11 Apr 2013 16:49:45 -0400
From: Eric Frias <efrias@syncad.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
 rv:17.0) Gecko/20130307 Thunderbird/17.0.4
MIME-Version: 1.0
To: libssh2-devel@cool.haxx.se
Subject: Re: proper use of non-blocking read
References: <5165CFAC.80304@syncad.com>
 <alpine.DEB.2.00.1304102315090.10099@tvnag.unkk.fr>
 <5165E7F0.4030709@syncad.com> <5165EB32.3060204@d6.com>
In-Reply-To: <5165EB32.3060204@d6.com>
X-Enigmail-Version: 1.5.1
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="iso-8859-1"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id r3BKnq2X025098

On 4/10/2013 6:44 PM, Chris Hecker wrote:
> This is the recent thread where I had similar issues:
Thanks for the pointer, I don't know how I missed these messages when I
was trying to figure out the problem.  It looks like the problem is
pretty well understood, and the problems I'm seeing were described in
one of the messages you linked from Henrik Nordström back in 2011. 
> I only thought about/debugged it a bit, but it seemed pretty clear to
> me that the only real fix is an internal queue and changing EAGAIN
> semantics slightly, as discussed in that thread.
That was my first thought too, and it looks like that was the general
consensus.  I'm aiming to use libssh2 in production code, so I might
take a crack at it once I get a better handle on the problem. 

Even if we can make simple calls like channel_read/channel_write behave
well, there may still be restrictions on some of the higher-level API
functions.  It seems like we'll end up with two classes of function:
things like libssh2_channel_write where and EAGAIN means that nothing
was written and there are no restrictions on what your next API call is;
and calls like libssh2_scp_send_ex where an EAGAIN might mean that part
of the scp_send has executed and it has state saved in the session
object.  In the latter case, the user can still go on to call most other
libssh2 functions before continuing the scp_send, but they can't start a
call to scp_send with different arguments to start sending a different
file because it would screw up the information in the session's
scpSend_state.

The use case I'm envisioning is a multi-threaded app that could be doing
file transfers in several threads.  A mutex tied to the session will
prevent two threads from accessing libssh2 at the same time, but it
wouldn't do anything to prevent two scp_send calls from interleaving
with each other.  It's easy enough to avoid that case, but it's
important to know what I need to avoid to stay safe.

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Thu Apr 11 22:56:14 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3BKu9Sh030315;
	Thu, 11 Apr 2013 22:56:13 +0200
Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com
 [209.85.220.54])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3BKu7ms030215
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Thu, 11 Apr 2013 22:56:08 +0200
Received: by mail-pa0-f54.google.com with SMTP id fa11so1096556pad.27
 for <libssh2-devel@cool.haxx.se>; Thu, 11 Apr 2013 13:56:03 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=google.com; s=20120113;
 h=x-received:message-id:date:from:user-agent:mime-version:to:subject
 :references:in-reply-to:content-type:content-transfer-encoding
 :x-gm-message-state;
 bh=MpXOC+IMMEa4G8quM9adOvoxDJnkwNZ7rB1+tNBJQPs=;
 b=dSO3Gyp/LcgFAFLCRuBV/e9xq70H8ZVNrMr/1fgnICDgPInu2lHJNur5XYj9QzPL3Y
 qJmtjCJ7gOeziTJybsv9CRH2EL6b/zycenlUrNSas0ufReBfNnXcFTZLjm7t4h+s5InB
 hUqyUbj0Tw1mixVMVjgsPQRcWsNZ3p4ORSMgOu08+hCwA0zqcL+CcYT1l0C79pl3Qt37
 nTrGdBbgyJnVY/98K5mdnbkB3lYKK4FCoWlY2FeJ+9AUPSD4l+qra/kHXQJF0Bpv+2oI
 H4lSakBVsiaIltGknynJJSdO/2sdjKMw9Vo7ZNVM2WAL+8QcRe9TacN2uDr2HyK04WFi
 7Qdg==
X-Received: by 10.68.99.163 with SMTP id er3mr11258051pbb.36.1365713763652;
 Thu, 11 Apr 2013 13:56:03 -0700 (PDT)
Received: from [192.168.1.113] ([200.34.42.170])
 by mx.google.com with ESMTPS id g8sm6346819pae.7.2013.04.11.13.56.02
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Thu, 11 Apr 2013 13:56:03 -0700 (PDT)
Message-ID: <5167235F.9080204@d6.com>
Date: Thu, 11 Apr 2013 13:55:59 -0700
From: Chris Hecker <checker@d6.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
 rv:17.0) Gecko/20130328 Thunderbird/17.0.5
MIME-Version: 1.0
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: proper use of non-blocking read
References: <5165CFAC.80304@syncad.com>
 <alpine.DEB.2.00.1304102315090.10099@tvnag.unkk.fr>
 <5165E7F0.4030709@syncad.com> <5165EB32.3060204@d6.com>
 <516721E9.4050500@syncad.com>
In-Reply-To: <516721E9.4050500@syncad.com>
X-Gm-Message-State: ALoCoQlqqzhZTRLqLPe0R1zpompVWLyNJxENOHmX1mJn0zIAMlECTZX0yvgPWm4TGp1wt8Oxmg50
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id r3BKu9Sh030315


I think you need an internal queue and accept or reject writes 
atomically at the API level.  Anything else is crazy-time for callers.

Chris





On 4/11/2013 1:49 PM, Eric Frias wrote:
> On 4/10/2013 6:44 PM, Chris Hecker wrote:
>> This is the recent thread where I had similar issues:
> Thanks for the pointer, I don't know how I missed these messages when I
> was trying to figure out the problem.  It looks like the problem is
> pretty well understood, and the problems I'm seeing were described in
> one of the messages you linked from Henrik Nordström back in 2011.
>> I only thought about/debugged it a bit, but it seemed pretty clear to
>> me that the only real fix is an internal queue and changing EAGAIN
>> semantics slightly, as discussed in that thread.
> That was my first thought too, and it looks like that was the general
> consensus.  I'm aiming to use libssh2 in production code, so I might
> take a crack at it once I get a better handle on the problem.
>
> Even if we can make simple calls like channel_read/channel_write behave
> well, there may still be restrictions on some of the higher-level API
> functions.  It seems like we'll end up with two classes of function:
> things like libssh2_channel_write where and EAGAIN means that nothing
> was written and there are no restrictions on what your next API call is;
> and calls like libssh2_scp_send_ex where an EAGAIN might mean that part
> of the scp_send has executed and it has state saved in the session
> object.  In the latter case, the user can still go on to call most other
> libssh2 functions before continuing the scp_send, but they can't start a
> call to scp_send with different arguments to start sending a different
> file because it would screw up the information in the session's
> scpSend_state.
>
> The use case I'm envisioning is a multi-threaded app that could be doing
> file transfers in several threads.  A mutex tied to the session will
> prevent two threads from accessing libssh2 at the same time, but it
> wouldn't do anything to prevent two scp_send calls from interleaving
> with each other.  It's easy enough to avoid that case, but it's
> important to know what I need to avoid to stay safe.
>
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Thu Apr 11 23:15:04 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3BLEv05012289;
	Thu, 11 Apr 2013 23:15:02 +0200
Received: from giant.haxx.se (localhost.localdomain [127.0.0.1])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3BLEuOS012285
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Thu, 11 Apr 2013 23:14:56 +0200
Received: from localhost (dast@localhost)
 by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r3BLEtMA012280
 for <libssh2-devel@cool.haxx.se>; Thu, 11 Apr 2013 23:14:56 +0200
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Thu, 11 Apr 2013 23:14:55 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: proper use of non-blocking read
In-Reply-To: <516721E9.4050500@syncad.com>
Message-ID: <alpine.DEB.2.00.1304112306300.30075@tvnag.unkk.fr>
References: <5165CFAC.80304@syncad.com>
 <alpine.DEB.2.00.1304102315090.10099@tvnag.unkk.fr>
 <5165E7F0.4030709@syncad.com> <5165EB32.3060204@d6.com>
 <516721E9.4050500@syncad.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

On Thu, 11 Apr 2013, Eric Frias wrote:

> Even if we can make simple calls like channel_read/channel_write behave 
> well, there may still be restrictions on some of the higher-level API 
> functions.  It seems like we'll end up with two classes of function: things 
> like libssh2_channel_write where and EAGAIN means that nothing was written 
> and there are no restrictions on what your next API call is; and calls like 
> libssh2_scp_send_ex where an EAGAIN might mean that part of the scp_send has 
> executed and it has state saved in the session object.

If we really need to make two classes, then so be it. But I don't think it is 
that easy to split them up like that. Lots of the functions do multiple 
operations and EAGAIN just means that one of them couldn't complete and it 
returned out and it keeps the state for next call.

The funny check in send_existing() that returns the annoying 
LIBSSH2_ERROR_BAD_USE (which is one of the core issues imho) was added by me 
just as a way to enforce users to keep calling the function until the send was 
successful and not trying to push down a new buffer before the previous was 
completed.

I'm convinved that we can solve that problem in another way that makes things 
smoother.

> In the latter case, the user can still go on to call most other libssh2 
> functions before continuing the scp_send, but they can't start a call to 
> scp_send with different arguments to start sending a different file because 
> it would screw up the information in the session's scpSend_state.

I agree with Chris that we should most probably strive towards more queueing 
so that we basically do "high level" atomic packet-operations and then we have 
a more lower level "data pump" that just keeps sending out the packets in 
order.

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Fri Apr 12 10:49:53 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3C8nQXG028044;
	Fri, 12 Apr 2013 10:49:46 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3C8nP32028040
 for <libssh2-devel@cool.haxx.se>; Fri, 12 Apr 2013 10:49:25 +0200
Received: (qmail 16980 invoked from network); 12 Apr 2013 08:49:22 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
 by localhost with SMTP; 12 Apr 2013 08:49:22 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 1.0dev
Precedence: bulk
Auto-Submitted: auto-generated
X-Mailer: Trac 1.0dev, by Edgewall Software
To: xtravar@yahoo.com
X-Trac-Project: libssh2
Date: Fri, 12 Apr 2013 08:49:22 -0000
X-URL: https://trac.libssh2.org/
Subject: Re: [libssh2] #263: libssh2_channel_read for exec ends unpredictably
X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/263#comment:1
Message-ID: <059.424c570893ca00b6585051bd48b5c4a9@libssh2.stuge.se>
References: <044.53446138e774d232ecdbb1718d2c1cb0@libssh2.stuge.se>
X-Trac-Ticket-ID: 263
In-Reply-To: <044.53446138e774d232ecdbb1718d2c1cb0@libssh2.stuge.se>
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r3C8nP32028040
Cc: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

#263: libssh2_channel_read for exec ends unpredictably
----------------------+-------------------
  Reporter:  xtravar  |      Owner:
      Type:  defect   |     Status:  new
  Priority:  normal   |  Milestone:  1.4.3
 Component:  API      |    Version:  1.4.2
Resolution:           |   Keywords:
Blocked By:           |     Blocks:
----------------------+-------------------

Comment (by xtravar):

 After some debugging, it appears that an invalid packet type is coming in
 after SSH_MSG_CHANNEL_DATA.

 Good run:
  datalen: 17 msg: OPEN_CONFIRMATION
  datalen: 9 msg: WINDOW_ADJUST
  datalen: 5 msg: SUCCESS
  datalen: 8201 msg: DATA
  datalen: 25 msg: REQUEST
  datalen: 13148 msg: DATA
  datalen: 5 msg: EOF
  datalen: 5 msg: CLOSE


 Bad run:
  datalen: 17 msg: OPEN_CONFIRMATION
  datalen: 9 msg: WINDOW_ADJUST
  datalen: 5 msg: SUCCESS
  datalen: 8201 msg: DATA
  datalen: 8201 msg: DATA
  datalen: 3888 msg: DATA
  datalen: 1077 msg: 18
  datalen: 5 msg: EOF
  datalen: 25 msg: REQUEST
  datalen: 5 msg: CLOSE

-- 
Ticket URL: <https://trac.libssh2.org/ticket/263#comment:1>
libssh2 <https://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Fri Apr 12 10:49:54 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3C8nrMD028222;
	Fri, 12 Apr 2013 10:49:54 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3C8nTG2028067
 for <libssh2-devel@cool.haxx.se>; Fri, 12 Apr 2013 10:49:29 +0200
Received: (qmail 16985 invoked from network); 12 Apr 2013 08:49:27 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
 by localhost with SMTP; 12 Apr 2013 08:49:27 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 1.0dev
Precedence: bulk
Auto-Submitted: auto-generated
X-Mailer: Trac 1.0dev, by Edgewall Software
To: xtravar@yahoo.com
X-Trac-Project: libssh2
Date: Fri, 12 Apr 2013 08:49:27 -0000
X-URL: https://trac.libssh2.org/
Subject: Re: [libssh2] #263: libssh2_channel_read for exec ends unpredictably
X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/263#comment:2
Message-ID: <059.589b76ac501806918e44bc73ae72f454@libssh2.stuge.se>
References: <044.53446138e774d232ecdbb1718d2c1cb0@libssh2.stuge.se>
X-Trac-Ticket-ID: 263
In-Reply-To: <044.53446138e774d232ecdbb1718d2c1cb0@libssh2.stuge.se>
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r3C8nTG2028067
Cc: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

#263: libssh2_channel_read for exec ends unpredictably
----------------------+-------------------
  Reporter:  xtravar  |      Owner:
      Type:  defect   |     Status:  new
  Priority:  normal   |  Milestone:  1.4.3
 Component:  API      |    Version:  1.4.2
Resolution:           |   Keywords:
Blocked By:           |     Blocks:
----------------------+-------------------

Comment (by xtravar):

 It appears that the SSH_MSG_CHANNEL_DATA message is being split across
 multiple packets.  I'm going to dig deeper and try to add in my own little
 packet pre-processing layer, but if there's an easier solution I'm open to
 ideas.  I'm pretty new to this codebase.

-- 
Ticket URL: <https://trac.libssh2.org/ticket/263#comment:2>
libssh2 <https://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Fri Apr 12 10:49:55 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3C8nstx028253;
	Fri, 12 Apr 2013 10:49:55 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3C8nY6k028135
 for <libssh2-devel@cool.haxx.se>; Fri, 12 Apr 2013 10:49:34 +0200
Received: (qmail 16995 invoked from network); 12 Apr 2013 08:49:34 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
 by localhost with SMTP; 12 Apr 2013 08:49:34 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 1.0dev
Precedence: bulk
Auto-Submitted: auto-generated
X-Mailer: Trac 1.0dev, by Edgewall Software
To: xtravar@yahoo.com
X-Trac-Project: libssh2
Date: Fri, 12 Apr 2013 08:49:34 -0000
X-URL: https://trac.libssh2.org/
Subject: Re: [libssh2] #263: libssh2_channel_read for exec ends unpredictably
X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/263#comment:3
Message-ID: <059.83e6cfe347d60ae21fbdbab0fa5cc856@libssh2.stuge.se>
References: <044.53446138e774d232ecdbb1718d2c1cb0@libssh2.stuge.se>
X-Trac-Ticket-ID: 263
In-Reply-To: <044.53446138e774d232ecdbb1718d2c1cb0@libssh2.stuge.se>
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r3C8nY6k028135
Cc: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

#263: libssh2_channel_read for exec ends unpredictably
----------------------+-------------------
  Reporter:  xtravar  |      Owner:
      Type:  defect   |     Status:  new
  Priority:  normal   |  Milestone:  1.4.3
 Component:  API      |    Version:  1.4.2
Resolution:           |   Keywords:
Blocked By:           |     Blocks:
----------------------+-------------------

Comment (by xtravar):

 Interestingly, the problem only happens with openssh-server-5.9 and not
 openssh-server-5.5.  I think I'll just revert to my other server for now.

-- 
Ticket URL: <https://trac.libssh2.org/ticket/263#comment:3>
libssh2 <https://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Apr 15 21:28:00 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3FJRQ8B010237;
	Mon, 15 Apr 2013 21:27:52 +0200
Received: from main.storm.pl (postfix@storm.pl [94.23.56.128])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3FJROHb010220
 for <libssh2-devel@cool.haxx.se>; Mon, 15 Apr 2013 21:27:24 +0200
Received: from localhost (localhost.localdomain [127.0.0.1])
 by main.storm.pl (Postfix) with ESMTP id 1189B6D6CA
 for <libssh2-devel@cool.haxx.se>; Mon, 15 Apr 2013 21:27:25 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at storm.pl
Received: from main.storm.pl ([127.0.0.1])
 by localhost (storm.pl [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id uJ26PVVjntbM for <libssh2-devel@cool.haxx.se>;
 Mon, 15 Apr 2013 21:27:23 +0200 (CEST)
Received: from [192.168.4.90] (c-71-197-0-193.hsd1.va.comcast.net
 [71.197.0.193]) by main.storm.pl (Postfix) with ESMTPA id BA77F6D654
 for <libssh2-devel@cool.haxx.se>; Mon, 15 Apr 2013 21:27:22 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=syncad.com;
 s=dkim1301; t=1366054043;
 bh=8rVPAdOMTqunZpP0HwO3ng8523Xec3A40QdDmPv/DM0=;
 h=Date:From:To:Subject:References:In-Reply-To:From;
 b=FPPfMXl8N53nzYr0Icglft2HSDvBY+mmgoFIcQ2czbkkN9Jlv30SfbPYD6Gks2bYd
 RVFOJ2Z+18+aZN+nRbc7lTAgmavlU3QLtcTO+SHjYnAyi28VSThvvX0g3WC/G9bLWd
 jqDBc1J6llKYz87QfMTl2hStpAd3dnBK8QoEebCg=
Message-ID: <516C5499.4030507@syncad.com>
Date: Mon, 15 Apr 2013 15:27:21 -0400
From: Eric Frias <efrias@syncad.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
 rv:17.0) Gecko/20130328 Thunderbird/17.0.5
MIME-Version: 1.0
To: libssh2-devel@cool.haxx.se
Subject: Re: proper use of non-blocking read
References: <5165CFAC.80304@syncad.com>
 <alpine.DEB.2.00.1304102315090.10099@tvnag.unkk.fr>
 <5165E7F0.4030709@syncad.com> <5165EB32.3060204@d6.com>
 <516721E9.4050500@syncad.com>
 <alpine.DEB.2.00.1304112306300.30075@tvnag.unkk.fr>
In-Reply-To: <alpine.DEB.2.00.1304112306300.30075@tvnag.unkk.fr>
X-Enigmail-Version: 1.5.1
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

On 4/11/2013 5:14 PM, Daniel Stenberg wrote:
> If we really need to make two classes, then so be it. But I don't
> think it is that easy to split them up like that. Lots of the
> functions do multiple operations and EAGAIN just means that one of
> them couldn't complete and it returned out and it keeps the state for
> next call.
It's a much more minor problem than the BAD_USE problem, so it's
probably better to deal with it later.
> I agree with Chris that we should most probably strive towards more
> queueing so that we basically do "high level" atomic packet-operations
> and then we have a more lower level "data pump" that just keeps
> sending out the packets in order.
I've been looking into this, and I think it could be done in two ways. 
The basic problem is that when we call _libssh2_transport_send(), there
are three possibilities: none, some, or all of the data might be sent. 
Currently, the return codes for _libssh2_transport_send() will tell you
that either none or some of the data was sent via LIBSSH2_ERROR_EAGAIN,
or that all of the data was sent via LIBSSH2_ERROR_NONE.
 - The first way, which I think everyone is envisioning, is to use a
queue.  When you call _libssh2_transport_send(), if it can't send the
message immediately, it will add it to a queue of messages to be sent
later, and allow the calling function to continue as if the message had
been sent.  This makes the function act as if the "none sent", "some
sent", and "all sent" cases are the same, by queueing up the data to be
sent later. 
 - The second is to make _libssh2_transport_send() return different
values for the "none sent" and "some sent" cases.  In the "none sent",
the calling function would return LIBSSH2_ERROR_EAGAIN (and if the
calling function has state, it would not advance to the next state).  In
the "some sent" case, the message is left in the session.packet to be
sent later, and the calling function will continue as if the message had
been sent.  Here, "some sent" and "all sent" are handled the same, "none
sent" is handled differently.

Using a queue has the advantage of fewer cases in the state machines. 
Handling the "none sent" case differently avoids the queue management
and dynamic allocation.  Both solutions would require exposing some sort
of data pump function, because the caller wouldn't know if the libssh2
API function actually wrote the data or just stored it off in the
queue/session object.

So far I don't have a strong preference between the two solutions.  Are
there other ways of fixing the problem worth considering?
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr 16 18:00:18 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3GFxnnP025328;
	Tue, 16 Apr 2013 18:00:11 +0200
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com
 [66.111.4.27])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3GFxlur025308
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 16 Apr 2013 17:59:47 +0200
Received: from compute5.internal (compute5.nyi.mail.srv.osa [10.202.2.45])
 by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id D614E2030F
 for <libssh2-devel@cool.haxx.se>; Tue, 16 Apr 2013 11:59:47 -0400 (EDT)
Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161])
 by compute5.internal (MEProxy); Tue, 16 Apr 2013 11:59:47 -0400
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=castaglia.org; h=
 date:from:to:subject:in-reply-to:message-id:references
 :mime-version:content-type; s=mesmtp; bh=iiwI8DjqWtAqa/g55c4P6z/
 DLhA=; b=izDFimB7jCZo9ZEjmYeCfx1cccc5fC+2Gyjjr92O//TdvbGAlHawq46
 LLmC6AeogkdGEn3bpvSNaJl2YaUFONERJWLLyLCxzygZg6dNBGb0xMmUtHARPG0Q
 lyXWQ6zMxZstMH094f6Dy36sFDJcZ+hdQ/lEwNIhVXTQWMrISJaI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=
 messagingengine.com; h=date:from:to:subject:in-reply-to
 :message-id:references:mime-version:content-type; s=smtpout; bh=
 iiwI8DjqWtAqa/g55c4P6z/DLhA=; b=c0jz8FwrNbeJIsDz98JmQzZfrmjuJBbr
 hjvJfXBIYmXokcrmYaji7JE/h0zbpTUDiA1wyWQquOfVdnIx3IZKWqalWnXkYNRs
 lQ401g+3Ssbor+i8CHAXWk8ktfPpNUWfTNYuhllJy+vGpJtD5K1nvXxFffocFUEq
 aJkLX5v+32A=
X-Sasl-enc: d+TQ6RYhVJUT7Ecna2auHuI7cy07WB6jCVBJbWNp+L7O 1366127987
Received: from familiar.local (unknown [50.202.115.1])
 by mail.messagingengine.com (Postfix) with ESMTPA id 69B882001C5
 for <libssh2-devel@cool.haxx.se>; Tue, 16 Apr 2013 11:59:47 -0400 (EDT)
Date: Tue, 16 Apr 2013 08:59:46 -0700 (PDT)
From: TJ Saunders <tj@castaglia.org>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
In-Reply-To: <20130409163117.GD7617@rhmail.home.annexia.org>
Message-ID: <alpine.DEB.2.00.1304160859110.3558@familiar.castaglia.org>
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
 <alpine.DEB.2.00.1304091615580.22285@tvnag.unkk.fr>
 <20130409142345.GB7617@rhmail.home.annexia.org>
 <alpine.DEB.2.00.1304090920170.3558@familiar.castaglia.org>
 <20130409163117.GD7617@rhmail.home.annexia.org>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>


> I'll certainly update this message if other ssh servers support
> this extension (and I hope they do).

I've added support for this to proftpd's mod_sftp module, to be in the 
next RC; see:

  http://bugs.proftpd.org/show_bug.cgi?id=3926

Cheers,
TJ

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   Those have most power to hurt us, that we love.

   	-Francis Beaumont

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr 16 23:54:18 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3GLrvdN032283;
	Tue, 16 Apr 2013 23:54:12 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3GLrtTt032273
 for <libssh2-devel@cool.haxx.se>; Tue, 16 Apr 2013 23:53:55 +0200
Received: (qmail 22369 invoked by uid 501); 16 Apr 2013 21:53:55 -0000
Message-ID: <20130416215355.22368.qmail@stuge.se>
Date: Tue, 16 Apr 2013 23:53:55 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <1365500529-25834-1-git-send-email-rjones@redhat.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

Richard W.M. Jones wrote:
> The patch (in the following email) adds fsync support to libssh2 via a
> new API function called 'libssh2_sftp_fsync'.
> 
> *NOTE:* For this to work you will need a patched OpenSSH with an
> accepted-upstream-but-not-included patch that adds the
> fsync@openssh.com extension to OpenSSH sftp-server.  For details see
> here:

I strongly dislike the absolute disconnect between the extremely
generic name libssh2_sftp_fsync() and the very opposite name
fsync@openssh.com - unless libssh2 will in the future use a heuristic
to determine which actual extension to use. I don't want that.

At a minimum, I'd like a follow up patch which changes the API name
to libssh2_sftp_fsync_openssh_com() or such..


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed Apr 17 00:46:01 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3GMjmpn030812;
	Wed, 17 Apr 2013 00:45:59 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3GMjjkb030805
 for <libssh2-devel@cool.haxx.se>; Wed, 17 Apr 2013 00:45:46 +0200
Received: (qmail 26347 invoked by uid 501); 16 Apr 2013 22:45:47 -0000
Message-ID: <20130416224547.26346.qmail@stuge.se>
Date: Wed, 17 Apr 2013 00:45:47 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: proper use of non-blocking read
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <5165CFAC.80304@syncad.com>
 <alpine.DEB.2.00.1304102315090.10099@tvnag.unkk.fr>
 <5165E7F0.4030709@syncad.com> <5165EB32.3060204@d6.com>
 <516721E9.4050500@syncad.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <516721E9.4050500@syncad.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

Eric Frias wrote:
> On 4/10/2013 6:44 PM, Chris Hecker wrote:
> > the only real fix is an internal queue and changing EAGAIN
> > semantics slightly, as discussed in that thread.

I think that breaking backwards compatibility like that is an
absolute no-go.

Unless we can magically make old libssh2 users work reliably, we
can't change any semantics.

Instead, add new, non-broken, APIs and error codes, and make
transition as easy as possible.


> a multi-threaded app that could be doing file transfers in several threads

Basically you need to lock the session for the duration of each
operation.


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed Apr 17 10:00:44 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3H80CuA023703;
	Wed, 17 Apr 2013 10:00:37 +0200
Received: from p3plwbeout11-05.prod.phx3.secureserver.net
 (p3plsmtp11-05-2.prod.phx3.secureserver.net [173.201.192.42])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3H80AvR023269
 for <libssh2-devel@cool.haxx.se>; Wed, 17 Apr 2013 10:00:11 +0200
Received: from localhost ([173.201.192.117])
 by p3plwbeout11-05.prod.phx3.secureserver.net with bizsmtp
 id Qw041l0022YS96t01w045c; Wed, 17 Apr 2013 01:00:04 -0700
X-SID: Qw041l0022YS96t01
Received: (qmail 5734 invoked by uid 99); 17 Apr 2013 08:00:04 -0000
MIME-Version: 1.0
To: libssh2-devel@cool.haxx.se
From: cosmin@5ivestars.net
Subject: libssh2_userauth_password return value
Date: Wed, 17 Apr 2013 01:00:04 -0700
Message-Id: <20130417010004.c9366f9f22cd3bbc3383a912335b41fe.e0a8c3e9ba.mailapi@email11.secureserver.net>
X-Originating-IP: 192.166.193.35
User-Agent: MailAPI 24256
X-Sender: cosmin@5ivestars.net
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============0225466556=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============0225466556==
Content-Type: multipart/alternative;
 boundary="=_1622dda1d5674e5da579c209325109a8"

--=_1622dda1d5674e5da579c209325109a8
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
 charset=utf-8

If the authentication fails for a couple of times  (libssh2_userauth_passwo=
rd() returns LIBSSH2_ERROR_AUTHENTICATION_FAILED) and the server closes the=
 connection because of too many authentication failures libssh2_userauth_pa=
ssword() returns LIBSSH2_ERROR_TIMEOUT but in this case it should return LI=
BSSH2_ERROR_SOCKET_DISCONNECT.




src/userauth.c


        if (session->userauth_pswd_state =3D=3D libssh2_NB_state_sent) {
            rc =3D _libssh2_packet_requirev(session, reply_codes,
                                          &session->userauth_pswd_data,
                                          &session->userauth_pswd_data_len,
                                          0, NULL, 0,
                                          &session->
                                          userauth_pswd_packet_requirev_sta=
te);
            if (rc =3D=3D LIBSSH2_ERROR_EAGAIN) {
                return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
                                      "Would block waiting");
            } else if (rc) {
                session->userauth_pswd_state =3D libssh2_NB_state_idle;
                return _libssh2_error(session, LIBSSH2_ERROR_TIMEOUT,
                                      "Would block waiting");
            }




I think it should return the actual error from the transport layer and not =
a "general" LIBSSH2_ERROR_TIMEOUT error.

--=_1622dda1d5674e5da579c209325109a8
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
 charset=utf-8

<div>If the authentication fails for a couple of times&nbsp; (libssh2_usera=
uth_password() returns LIBSSH2_ERROR_AUTHENTICATION_FAILED) and the server =
closes the connection because of too many authentication failures libssh2_u=
serauth_password() returns LIBSSH2_ERROR_TIMEOUT but in this case it should=
 return LIBSSH2_ERROR_SOCKET_DISCONNECT.</div><div><br></div><div><br></div=
><div>src/userauth.c</div><div><br></div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; if (session-&gt;userauth_pswd_state =3D=3D libssh2_NB_state_s=
ent) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; rc =3D _libssh2_packet_requirev(session, reply_codes,<br>&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; &amp;session-&gt;userauth_pswd_data,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;se=
ssion-&gt;userauth_pswd_data_len,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0, NULL, 0,<br>&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; &amp;session-&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; userauth_ps=
wd_packet_requirev_state);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; if (rc =3D=3D LIBSSH2_ERROR_EAGAIN) {<br>&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,<br>&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Would block wait=
ing");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; } else if (rc) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session-&gt;userauth_pswd_state =3D l=
ibssh2_NB_state_idle;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return _libssh2_error(session, LIB=
SSH2_ERROR_TIMEOUT,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; "Would block waiting");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br></div><div><br></div><div>=
I think it should return the actual error from the transport layer and not =
a "general"  LIBSSH2_ERROR_TIMEOUT error.<br> </div>

--=_1622dda1d5674e5da579c209325109a8--

--===============0225466556==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============0225466556==--

From libssh2-devel-bounces@cool.haxx.se  Wed Apr 17 14:08:11 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HC7hEE019542;
	Wed, 17 Apr 2013 14:08:04 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HC7g3K019531
 for <libssh2-devel@cool.haxx.se>; Wed, 17 Apr 2013 14:07:42 +0200
Received: (qmail 8181 invoked by uid 501); 17 Apr 2013 12:07:43 -0000
Message-ID: <20130417120743.8180.qmail@stuge.se>
Date: Wed, 17 Apr 2013 14:07:43 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: libssh2_userauth_password return value
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <20130417010004.c9366f9f22cd3bbc3383a912335b41fe.e0a8c3e9ba.mailapi@email11.secureserver.net>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <20130417010004.c9366f9f22cd3bbc3383a912335b41fe.e0a8c3e9ba.mailapi@email11.secureserver.net>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

cosmin@5ivestars.net wrote:
>             } else if (rc) {
>                 session->userauth_pswd_state = libssh2_NB_state_idle;
>                 return _libssh2_error(session, LIBSSH2_ERROR_TIMEOUT,
>                                       "Would block waiting");
>             }
> 
> I think it should return the actual error from the transport layer
> and not a "general" LIBSSH2_ERROR_TIMEOUT error.

Could you send a patch to fix that? Thanks.


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed Apr 17 15:13:26 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HDD62m028680;
	Wed, 17 Apr 2013 15:13:22 +0200
Received: from p3plwbeout11-06.prod.phx3.secureserver.net
 (p3plsmtp11-06-2.prod.phx3.secureserver.net [173.201.192.44])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HDD46V028516
 for <libssh2-devel@cool.haxx.se>; Wed, 17 Apr 2013 15:13:04 +0200
Received: from localhost ([173.201.192.118])
 by p3plwbeout11-06.prod.phx3.secureserver.net with bizsmtp
 id R1Cy1l0012ZjpT9011CyJq; Wed, 17 Apr 2013 06:12:58 -0700
X-SID: R1Cy1l0012ZjpT901
Received: (qmail 16279 invoked by uid 99); 17 Apr 2013 13:12:58 -0000
MIME-Version: 1.0
Content-Type: multipart/mixed;
 boundary="=_277abf2b50a4031ad5f53ff0e825f349"
To: "libssh2 development" <libssh2-devel@cool.haxx.se>
From: cosmin@5ivestars.net
Subject: RE: Re: libssh2_userauth_password return value
In-Reply-To: <20130417120743.8180.qmail@stuge.se>
Date: Wed, 17 Apr 2013 06:12:58 -0700
Message-Id: <20130417061258.c9366f9f22cd3bbc3383a912335b41fe.338c77c3e3.mailapi@email11.secureserver.net>
X-Originating-IP: 188.240.236.11
User-Agent: MailAPI 24256
X-Sender: cosmin@5ivestars.net
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--=_277abf2b50a4031ad5f53ff0e825f349
Content-Type: multipart/alternative;
 boundary="=_0a2b839efcc733bc8b19350d6c01fc90"

--=_0a2b839efcc733bc8b19350d6c01fc90
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
 charset=utf-8

Here is a little patch, I am not sure it's 100% ok, it does not resolve the=
 problem entirely, it only handles LIBSSH2_ERROR_SOCKET_DISCONNECT. Maybe  =
just returning "rc" would be better.=20

--------- Original Message ---------Subject: Re: libssh2_userauth_password =
return value
From: Peter Stuge <peter@stuge.se>
Date: 4/17/13 3:07 pm
To: libssh2-devel@cool.haxx.se

cosmin@5ivestars.net wrote:
 > } else if (rc) {
 > session->userauth_pswd_state =3D libssh2_NB_state_idle;
 > return _libssh2_error(session, LIBSSH2_ERROR_TIMEOUT,
 > "Would block waiting");
 > }
 >=20
 > I think it should return the actual error from the transport layer
 > and not a "general" LIBSSH2_ERROR_TIMEOUT error.
=20
 Could you send a patch to fix that? Thanks.
=20
=20
 //Peter
 _______________________________________________
 libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--=_0a2b839efcc733bc8b19350d6c01fc90
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
 charset=utf-8

<div>Here is a little patch, I am not sure it's 100% ok, it does not resolv=
e the problem entirely, it only handles LIBSSH2_ERROR_SOCKET_DISCONNECT. Ma=
ybe&nbsp; just returning "rc" would be better. <br></div><blockquote class=
=3D"threadBlockQuote" style=3D"border-left: 2px solid #C2C2C2;padding-left:=
3px;margin-left: 4px;" data-mce-style=3D"border-left: 2px solid #C2C2C2; pa=
dding-left: 3px; margin-left: 4px;">--------- Original Message ---------<di=
v>Subject: Re: libssh2_userauth_password return value<br>From: Peter Stuge =
&lt;peter@stuge.se&gt;<br>Date: 4/17/13 3:07 pm<br>To: libssh2-devel@cool=
=2Ehaxx.se<br><br>cosmin@5ivestars.net wrote:<br> &gt; } else if (rc) {<br>=
 &gt; session-&gt;userauth_pswd_state =3D libssh2_NB_state_idle;<br> &gt; r=
eturn _libssh2_error(session, LIBSSH2_ERROR_TIMEOUT,<br> &gt; "Would block =
waiting");<br> &gt; }<br> &gt; <br> &gt; I think it should return the actua=
l error from the transport layer<br> &gt; and not a "general" LIBSSH2_ERROR=
_TIMEOUT error.<br> <br> Could you send a patch to fix that? Thanks.<br> <b=
r> <br> //Peter<br> _______________________________________________<br> lib=
ssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel<br></=
div></blockquote>

--=_0a2b839efcc733bc8b19350d6c01fc90--

--=_277abf2b50a4031ad5f53ff0e825f349
Content-Transfer-Encoding: base64
Content-Type: text/x-diff;
 name=patch.txt;
 charset=UTF-8
Content-Disposition: attachment;
 filename=patch.txt

LS0tIHNyYy91c2VyYXV0aC5jCTIwMTItMDQtMTggMjM6MjQ6MDQuMDAwMDAwMDAwICswMzAwCisr
KyBzcmMvdXNlcmF1dGgubmV3LmMJMjAxMy0wNC0xNyAxNTo1MTowMy4yNzU2ODc1MzggKzAzMDAK
QEAgLTI4MCw5ICsyODAsMTUgQEAKICAgICAgICAgICAgICAgICByZXR1cm4gX2xpYnNzaDJfZXJy
b3Ioc2Vzc2lvbiwgTElCU1NIMl9FUlJPUl9FQUdBSU4sCiAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICJXb3VsZCBibG9jayB3YWl0aW5nIik7CiAgICAgICAgICAgICB9IGVs
c2UgaWYgKHJjKSB7Ci0gICAgICAgICAgICAgICAgc2Vzc2lvbi0+dXNlcmF1dGhfcHN3ZF9zdGF0
ZSA9IGxpYnNzaDJfTkJfc3RhdGVfaWRsZTsKLSAgICAgICAgICAgICAgICByZXR1cm4gX2xpYnNz
aDJfZXJyb3Ioc2Vzc2lvbiwgTElCU1NIMl9FUlJPUl9USU1FT1VULAotICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAiV291bGQgYmxvY2sgd2FpdGluZyIpOworCQlpZiAocmMg
PT0gTElCU1NIMl9FUlJPUl9TT0NLRVRfRElTQ09OTkVDVCApIHsKKwkJICAgIHNlc3Npb24tPnVz
ZXJhdXRoX3Bzd2Rfc3RhdGUgPSBsaWJzc2gyX05CX3N0YXRlX2lkbGU7CisgICAgICAgICAgICAJ
ICAgIHJldHVybiBfbGlic3NoMl9lcnJvcihzZXNzaW9uLCBMSUJTU0gyX0VSUk9SX1NPQ0tFVF9E
SVNDT05ORUNULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQ29ubmVj
dGlvbiBjbG9zZWQgYnkgc2VydmVyIik7CisJCX0gZWxzZSB7CisgICAgICAgICAgICAJICAgIHNl
c3Npb24tPnVzZXJhdXRoX3Bzd2Rfc3RhdGUgPSBsaWJzc2gyX05CX3N0YXRlX2lkbGU7CisgICAg
ICAgICAgICAJICAgIHJldHVybiBfbGlic3NoMl9lcnJvcihzZXNzaW9uLCBMSUJTU0gyX0VSUk9S
X1RJTUVPVVQsCisgICAgICAgICAgICAgICAgCSAgICAgICAgICAgICAgICAgICJXb3VsZCBibG9j
ayB3YWl0aW5nIik7CisJCX0KICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgaWYgKHNlc3Np
b24tPnVzZXJhdXRoX3Bzd2RfZGF0YVswXSA9PSBTU0hfTVNHX1VTRVJBVVRIX1NVQ0NFU1MpIHsK
--=_277abf2b50a4031ad5f53ff0e825f349
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--=_277abf2b50a4031ad5f53ff0e825f349--

From libssh2-devel-bounces@cool.haxx.se  Wed Apr 17 15:33:53 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HDXlkk008912;
	Wed, 17 Apr 2013 15:33:51 +0200
Received: from giant.haxx.se (localhost.localdomain [127.0.0.1])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HDXj4G008898
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Wed, 17 Apr 2013 15:33:45 +0200
Received: from localhost (dast@localhost)
 by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r3HDXjS4008894
 for <libssh2-devel@cool.haxx.se>; Wed, 17 Apr 2013 15:33:45 +0200
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Wed, 17 Apr 2013 15:33:45 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: RE: Re: libssh2_userauth_password return value
In-Reply-To: <20130417061258.c9366f9f22cd3bbc3383a912335b41fe.338c77c3e3.mailapi@email11.secureserver.net>
Message-ID: <alpine.DEB.2.00.1304171533001.32122@tvnag.unkk.fr>
References: <20130417061258.c9366f9f22cd3bbc3383a912335b41fe.338c77c3e3.mailapi@email11.secureserver.net>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED;
 BOUNDARY="1129329158-432444064-1366205625=:32122"
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--1129329158-432444064-1366205625=:32122
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Wed, 17 Apr 2013, cosmin@5ivestars.net wrote:

> Here is a little patch, I am not sure it's 100% ok, it does not resolve the 
> problem entirely, it only handles LIBSSH2_ERROR_SOCKET_DISCONNECT. Maybe 
> just returning "rc" would be better.

I think so. I'd prefer a patch like the one attached here!

Thoughts?

-- 

  / daniel.haxx.se
--1129329158-432444064-1366205625=:32122
Content-Type: TEXT/x-diff; name=0001-userauth_password-pass-on-the-underlying-error-code.patch
Content-Transfer-Encoding: BASE64
Content-ID: <alpine.DEB.2.00.1304171533450.32122@tvnag.unkk.fr>
Content-Description: 
Content-Disposition: attachment; filename=0001-userauth_password-pass-on-the-underlying-error-code.patch

RnJvbSBmOTBkNjAyYWZmYThhYWMzNzVkMzJmN2U0MTY4MjM1NDVmOGRkOTM2
IE1vbiBTZXAgMTcgMDA6MDA6MDAgMjAwMQ0KRnJvbTogRGFuaWVsIFN0ZW5i
ZXJnIDxkYW5pZWxAaGF4eC5zZT4NCkRhdGU6IFdlZCwgMTcgQXByIDIwMTMg
MTU6MzE6MTIgKzAyMDANClN1YmplY3Q6IFtQQVRDSF0gdXNlcmF1dGhfcGFz
c3dvcmQ6IHBhc3Mgb24gdGhlIHVuZGVybHlpbmcgZXJyb3IgY29kZQ0KDQpf
bGlic3NoMl9wYWNrZXRfcmVxdWlyZXYoKSBtYXkgcmV0dXJuIGRpZmZlcmVu
dCBlcnJvcnMgYW5kIHdlIHBhc3MgdGhhdA0KdG8gdGhlIHBhcmVudCBpbnN0
ZWFkIG9mIHJld3JpdGluZyBpdC4NCg0KQnVnOiBodHRwOi8vbGlic3NoMi5v
cmcvbWFpbC9saWJzc2gyLWRldmVsLWFyY2hpdmUtMjAxMy0wNC8wMDI5LnNo
dG1sDQpSZXBvcnRlZCBieTogQ29zbWluDQotLS0NCiBzcmMvdXNlcmF1dGgu
YyB8ICAgMTQgKysrKysrKy0tLS0tLS0NCiAxIGZpbGUgY2hhbmdlZCwgNyBp
bnNlcnRpb25zKCspLCA3IGRlbGV0aW9ucygtKQ0KDQpkaWZmIC0tZ2l0IGEv
c3JjL3VzZXJhdXRoLmMgYi9zcmMvdXNlcmF1dGguYw0KaW5kZXggYTA3MzNk
NS4uNjVkYWU0NiAxMDA2NDQNCi0tLSBhL3NyYy91c2VyYXV0aC5jDQorKysg
Yi9zcmMvdXNlcmF1dGguYw0KQEAgLTI3NiwxMyArMjc2LDEzIEBAIHVzZXJh
dXRoX3Bhc3N3b3JkKExJQlNTSDJfU0VTU0lPTiAqc2Vzc2lvbiwNCiAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCBOVUxM
LCAwLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICZzZXNzaW9uLT4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICB1c2VyYXV0aF9wc3dkX3BhY2tldF9yZXF1aXJldl9z
dGF0ZSk7DQotICAgICAgICAgICAgaWYgKHJjID09IExJQlNTSDJfRVJST1Jf
RUFHQUlOKSB7DQotICAgICAgICAgICAgICAgIHJldHVybiBfbGlic3NoMl9l
cnJvcihzZXNzaW9uLCBMSUJTU0gyX0VSUk9SX0VBR0FJTiwNCi0gICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJXb3VsZCBibG9jayB3
YWl0aW5nIik7DQotICAgICAgICAgICAgfSBlbHNlIGlmIChyYykgew0KLSAg
ICAgICAgICAgICAgICBzZXNzaW9uLT51c2VyYXV0aF9wc3dkX3N0YXRlID0g
bGlic3NoMl9OQl9zdGF0ZV9pZGxlOw0KLSAgICAgICAgICAgICAgICByZXR1
cm4gX2xpYnNzaDJfZXJyb3Ioc2Vzc2lvbiwgTElCU1NIMl9FUlJPUl9USU1F
T1VULA0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
IldvdWxkIGJsb2NrIHdhaXRpbmciKTsNCisNCisgICAgICAgICAgICBpZiAo
cmMpIHsNCisgICAgICAgICAgICAgICAgaWYgKHJjICE9IExJQlNTSDJfRVJS
T1JfRUFHQUlOKQ0KKyAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbi0+dXNl
cmF1dGhfcHN3ZF9zdGF0ZSA9IGxpYnNzaDJfTkJfc3RhdGVfaWRsZTsNCisN
CisgICAgICAgICAgICAgICAgcmV0dXJuIF9saWJzc2gyX2Vycm9yKHNlc3Np
b24sIHJjLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIldhaXRpbmcgZm9yIHBhc3N3b3JkIHJlc3BvbnNlIik7DQogICAgICAg
ICAgICAgfQ0KIA0KICAgICAgICAgICAgIGlmIChzZXNzaW9uLT51c2VyYXV0
aF9wc3dkX2RhdGFbMF0gPT0gU1NIX01TR19VU0VSQVVUSF9TVUNDRVNTKSB7
DQotLSANCjEuNy4xMC40DQoNCg==

--1129329158-432444064-1366205625=:32122
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--1129329158-432444064-1366205625=:32122--

From libssh2-devel-bounces@cool.haxx.se  Wed Apr 17 16:03:15 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HE39IX030177;
	Wed, 17 Apr 2013 16:03:13 +0200
Received: from giant.haxx.se (localhost.localdomain [127.0.0.1])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HE37xZ030143
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Wed, 17 Apr 2013 16:03:07 +0200
Received: from localhost (dast@localhost)
 by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r3HE373C030139
 for <libssh2-devel@cool.haxx.se>; Wed, 17 Apr 2013 16:03:07 +0200
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Wed, 17 Apr 2013 16:03:07 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
In-Reply-To: <20130416215355.22368.qmail@stuge.se>
Message-ID: <alpine.DEB.2.00.1304171556070.32122@tvnag.unkk.fr>
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
 <20130416215355.22368.qmail@stuge.se>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

On Tue, 16 Apr 2013, Peter Stuge wrote:

> I strongly dislike the absolute disconnect between the extremely generic 
> name libssh2_sftp_fsync() and the very opposite name fsync@openssh.com - 
> unless libssh2 will in the future use a heuristic to determine which actual 
> extension to use. I don't want that.

I do.

If there would appear another way to fsync in a future, we can introduce 
either a way for libssh2 to figure out by itself what method to use, or we 
provide an API for the application to select method.

> At a minimum, I'd like a follow up patch which changes the API name to 
> libssh2_sftp_fsync_openssh_com() or such..

Why do think this is necessary? I don't think we do a service to our users by 
exposing the underlying protocol naming in our function names. I also suspect 
that we won't be flooded by lots of other fsync variations either...

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed Apr 17 18:11:10 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HGAh9a018582;
	Wed, 17 Apr 2013 18:11:04 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HGAfsF018573
 for <libssh2-devel@cool.haxx.se>; Wed, 17 Apr 2013 18:10:41 +0200
Received: (qmail 27070 invoked by uid 501); 17 Apr 2013 16:10:42 -0000
Message-ID: <20130417161042.27069.qmail@stuge.se>
Date: Wed, 17 Apr 2013 18:10:42 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
 <20130416215355.22368.qmail@stuge.se>
 <alpine.DEB.2.00.1304171556070.32122@tvnag.unkk.fr>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <alpine.DEB.2.00.1304171556070.32122@tvnag.unkk.fr>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

Daniel Stenberg wrote:
>> I strongly dislike the absolute disconnect between the extremely generic 
>> name libssh2_sftp_fsync() and the very opposite name fsync@openssh.com - 
>> unless libssh2 will in the future use a heuristic to determine which 
>> actual extension to use. I don't want that.
>
> I do.

Even though it doesn't scale at all?


> If there would appear another way to fsync in a future, we can introduce 
> either a way for libssh2 to figure out by itself what method to use,
> or we provide an API for the application to select method.

Whatever happens in the future the generic API must by default remain
this very specific OpenSSH extension, if we introduce such an API now.


>> At a minimum, I'd like a follow up patch which changes the API name to 
>> libssh2_sftp_fsync_openssh_com() or such..
>
> Why do think this is necessary?

Because we know now that we can not say if a future heuristic will be
able to reliably determine what method to use.

I find it important to educate library users that this particular
call is specific to OpenSSH sshd. While that is definitely a very
common case, there are also users which either have mixed
environments or simply have no OpenSSH sshd:s at all.


> I don't think we do a service to our users by exposing the
> underlying protocol naming in our function names.

Actually this is what we do for every other part of the protocols,
libssh2 concepts map very closely to the RFC concepts, and I think
this is a really good thing.


> I also suspect that we won't be flooded by lots of other fsync
> variations either...

I completely agree. It's possible that there will only ever be the
OpenSSH extension. When it has become standard (de-facto or
otherwise) we can reconsider. Until then, document in the function
name what it is. I think it is a critical piece of information for
anyone who wants to use it.

It could also be viewed as preemptive handling of support requests
about libssh2_sftp_fsync() causing data corruption on
$non-OpenSSH-servers.. :)


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed Apr 17 18:12:21 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HGCJvr019574;
	Wed, 17 Apr 2013 18:12:20 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3HGCHiF019538
 for <libssh2-devel@cool.haxx.se>; Wed, 17 Apr 2013 18:12:17 +0200
Received: (qmail 27246 invoked by uid 501); 17 Apr 2013 16:12:19 -0000
Message-ID: <20130417161219.27245.qmail@stuge.se>
Date: Wed, 17 Apr 2013 18:12:19 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: libssh2_userauth_password return value
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <20130417061258.c9366f9f22cd3bbc3383a912335b41fe.338c77c3e3.mailapi@email11.secureserver.net>
 <alpine.DEB.2.00.1304171533001.32122@tvnag.unkk.fr>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <alpine.DEB.2.00.1304171533001.32122@tvnag.unkk.fr>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

Daniel Stenberg wrote:
> From f90d602affa8aac375d32f7e416823545f8dd936 Mon Sep 17 00:00:00 2001
> From: Daniel Stenberg <daniel@haxx.se>
> Date: Wed, 17 Apr 2013 15:31:12 +0200
> Subject: [PATCH] userauth_password: pass on the underlying error code
> 
> _libssh2_packet_requirev() may return different errors and we pass that
> to the parent instead of rewriting it.
> 
> Bug: http://libssh2.org/mail/libssh2-devel-archive-2013-04/0029.shtml
> Reported by: Cosmin

Acked-by: Peter Stuge <peter@stuge.se>
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr 23 11:04:40 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3N94EhM016326;
	Tue, 23 Apr 2013 11:04:33 +0200
Received: from dns-factory.at (mail.dns-factory.at [194.242.35.75])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3N94AUf016306
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 23 Apr 2013 11:04:10 +0200
Received: from [172.17.100.8] lists@gknw.net [62.143.120.100]
 by dns-factory.at with NetMail SMTP Agent $Revision: 8582 $ on Novell NetWare
 via secured & encrypted transport (TLS);
 Tue, 23 Apr 2013 11:04:00 +0200
Message-ID: <51764E7D.2080807@gknw.net>
Date: Tue, 23 Apr 2013 11:03:57 +0200
From: Guenter <lists@gknw.net>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
 rv:17.0) Gecko/20130328 Thunderbird/17.0.5
MIME-Version: 1.0
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
 <20130416215355.22368.qmail@stuge.se>
 <alpine.DEB.2.00.1304171556070.32122@tvnag.unkk.fr>
In-Reply-To: <alpine.DEB.2.00.1304171556070.32122@tvnag.unkk.fr>
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id
 r3N94AUf016306
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id r3N94EhM016326

On 17.04.2013 16:03, Daniel Stenberg wrote:
> On Tue, 16 Apr 2013, Peter Stuge wrote:
>
>> I strongly dislike the absolute disconnect between the extremely
>> generic name libssh2_sftp_fsync() and the very opposite name
>> fsync@openssh.com - unless libssh2 will in the future use a heuristic
>> to determine which actual extension to use. I don't want that.
>
> I do.
>
> If there would appear another way to fsync in a future, we can introduce
> either a way for libssh2 to figure out by itself what method to use, or
> we provide an API for the application to select method.
>
>> At a minimum, I'd like a follow up patch which changes the API name to
>> libssh2_sftp_fsync_openssh_com() or such..
>
> Why do think this is necessary? I don't think we do a service to our
> users by exposing the underlying protocol naming in our function names.
> I also suspect that we won't be flooded by lots of other fsync
> variations either...
>
what about something like that:

#define LIBSSH2_FSYNC_AUTO 0
#define LIBSSH2_FSYNC_OPENSSH 1

libssh2_sftp_fsync(LIBSSH2_FSYNC_OPENSSH, ...)

this way the function name could stay also in the future, users of the 
function can select the method to use, and it would be possible to 
select an automatic way if it can be implemented ...

Gün.




_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue Apr 23 12:34:05 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3NAXmub018181;
	Tue, 23 Apr 2013 12:34:02 +0200
Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com
 [209.85.220.173])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3NAXkId017886
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 23 Apr 2013 12:33:47 +0200
Received: by mail-vc0-f173.google.com with SMTP id gf12so435564vcb.18
 for <libssh2-devel@cool.haxx.se>; Tue, 23 Apr 2013 03:33:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:x-received:sender:in-reply-to:references:date
 :x-google-sender-auth:message-id:subject:from:to:content-type;
 bh=ktnuSk8TWNQYW1bGSIQnqaFe/SDN/TiOxBVHMMZRAxM=;
 b=sQ3c9ULJlyDVl2tjiPhWTCDDoMXkXN99dWpOuEcY3QfIrTAojvi30H/uhzWVRm4Hvi
 U3urh/hgELp6oQ6FGudrbZf3LXLhBKOs9WuRTHCiYxfY78tGz55EXfCtvH76L1d+e0ZU
 LTt6CgzqiDuEkQu+fyqeJ8iQfSnE5rCqG1deszisNc/b7VUQlocgkr0AOws1eFHLHFQ5
 TG/Terj1gq5yiJRYzrsM9nVutNyjlGYo54Kmbe54IAshXZQBdUvqy0cV+FjuXQmSWxm6
 hND6zcPuBwi3+T+UApMLdKVy+sWRwrlmTlXVPL9avCaxpuh+mVMskpDNwZJXKKAK8ryt
 wbzg==
MIME-Version: 1.0
X-Received: by 10.52.97.131 with SMTP id ea3mr18484184vdb.71.1366713221373;
 Tue, 23 Apr 2013 03:33:41 -0700 (PDT)
Received: by 10.52.113.100 with HTTP; Tue, 23 Apr 2013 03:33:41 -0700 (PDT)
In-Reply-To: <51764E7D.2080807@gknw.net>
References: <1365500529-25834-1-git-send-email-rjones@redhat.com>
 <20130416215355.22368.qmail@stuge.se>
 <alpine.DEB.2.00.1304171556070.32122@tvnag.unkk.fr>
 <51764E7D.2080807@gknw.net>
Date: Tue, 23 Apr 2013 11:33:41 +0100
X-Google-Sender-Auth: qQ26XgeQXO09Pc8n3qu1RhGsn3M
Message-ID: <CADyPeTMV=a0Hedm_d+fBYZg7PMsTOkdpk0DWVheXmesU4TVYsg@mail.gmail.com>
Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).
From: Alexander Lamaison <swish@lammy.co.uk>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============2138804016=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============2138804016==
Content-Type: multipart/alternative; boundary=20cf307cfc7e11e6b104db04b8c3

--20cf307cfc7e11e6b104db04b8c3
Content-Type: text/plain; charset=ISO-8859-1

On 23 April 2013 10:03, Guenter <lists@gknw.net> wrote:

> On 17.04.2013 16:03, Daniel Stenberg wrote:
>
>> On Tue, 16 Apr 2013, Peter Stuge wrote:
>>
>>  I strongly dislike the absolute disconnect between the extremely
>>> generic name libssh2_sftp_fsync() and the very opposite name
>>> fsync@openssh.com - unless libssh2 will in the future use a heuristic
>>> to determine which actual extension to use. I don't want that.
>>>
>>
>> I do.
>>
>> If there would appear another way to fsync in a future, we can introduce
>> either a way for libssh2 to figure out by itself what method to use, or
>> we provide an API for the application to select method.
>>
>>  At a minimum, I'd like a follow up patch which changes the API name to
>>> libssh2_sftp_fsync_openssh_**com() or such..
>>>
>>
>> Why do think this is necessary? I don't think we do a service to our
>> users by exposing the underlying protocol naming in our function names.
>> I also suspect that we won't be flooded by lots of other fsync
>> variations either...
>>
>>  what about something like that:
>
> #define LIBSSH2_FSYNC_AUTO 0
> #define LIBSSH2_FSYNC_OPENSSH 1
>
> libssh2_sftp_fsync(LIBSSH2_**FSYNC_OPENSSH, ...)
>
> this way the function name could stay also in the future, users of the
> function can select the method to use, and it would be possible to select
> an automatic way if it can be implemented ...
>

The intentions are good, but we're overengineering here.  Is any standard
version of this feature realistically going to have an incompatible API?
And if, despite sensible predicitons, it is incompatible, is it really the
end of the world?  We just add a second API call and combine them at the
next soname bump.  Our API is littered with sub-optimal APIs waiting for
the ABI-change green light.

Alex

-- 
Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org)

--20cf307cfc7e11e6b104db04b8c3
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On 2=
3 April 2013 10:03, Guenter <span dir=3D"ltr">&lt;<a href=3D"mailto:lists@g=
knw.net" target=3D"_blank">lists@gknw.net</a>&gt;</span> wrote:<br><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc s=
olid;padding-left:1ex">
<div class=3D"im">On 17.04.2013 16:03, Daniel Stenberg wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
On Tue, 16 Apr 2013, Peter Stuge wrote:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
I strongly dislike the absolute disconnect between the extremely<br>
generic name libssh2_sftp_fsync() and the very opposite name<br>
<a href=3D"mailto:fsync@openssh.com" target=3D"_blank">fsync@openssh.com</a=
> - unless libssh2 will in the future use a heuristic<br>
to determine which actual extension to use. I don&#39;t want that.<br>
</blockquote>
<br>
I do.<br>
<br>
If there would appear another way to fsync in a future, we can introduce<br=
>
either a way for libssh2 to figure out by itself what method to use, or<br>
we provide an API for the application to select method.<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
At a minimum, I&#39;d like a follow up patch which changes the API name to<=
br>
libssh2_sftp_fsync_openssh_<u></u>com() or such..<br>
</blockquote>
<br>
Why do think this is necessary? I don&#39;t think we do a service to our<br=
>
users by exposing the underlying protocol naming in our function names.<br>
I also suspect that we won&#39;t be flooded by lots of other fsync<br>
variations either...<br>
<br>
</blockquote></div>
what about something like that:<br>
<br>
#define LIBSSH2_FSYNC_AUTO 0<br>
#define LIBSSH2_FSYNC_OPENSSH 1<br>
<br>
libssh2_sftp_fsync(LIBSSH2_<u></u>FSYNC_OPENSSH, ...)<br>
<br>
this way the function name could stay also in the future, users of the func=
tion can select the method to use, and it would be possible to select an au=
tomatic way if it can be implemented ...<br clear=3D"all"></blockquote><div=
>
<br></div><div>The intentions are good, but we&#39;re overengineering here.=
=A0 Is any standard version of this feature realistically going to have an =
incompatible API?=A0 And if, despite sensible predicitons, it is incompatib=
le, is it really the end of the world?=A0 We just add a second API call and=
 combine them at the next soname bump.=A0 Our API is littered with sub-opti=
mal APIs waiting for the ABI-change green light.<br>
<br>Alex<br></div></div><br>-- <br>Swish - Easy SFTP for Windows Explorer (=
<a href=3D"http://www.swish-sftp.org" target=3D"_blank">http://www.swish-sf=
tp.org</a>)
</div></div>

--20cf307cfc7e11e6b104db04b8c3--

--===============2138804016==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============2138804016==--

From libssh2-devel-bounces@cool.haxx.se  Mon Apr 29 20:42:13 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3TIfiZc011300;
	Mon, 29 Apr 2013 20:42:06 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r3TIfhMv011272
 for <libssh2-devel@cool.haxx.se>; Mon, 29 Apr 2013 20:41:43 +0200
Received: (qmail 3639 invoked from network); 29 Apr 2013 18:41:38 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
 by localhost with SMTP; 29 Apr 2013 18:41:38 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 1.0dev
Precedence: bulk
Cc: libssh2-devel@cool.haxx.se
Auto-Submitted: auto-generated
X-Mailer: Trac 1.0dev, by Edgewall Software
X-Trac-Project: libssh2
Date: Mon, 29 Apr 2013 18:41:38 -0000
X-URL: https://trac.libssh2.org/
Subject: [libssh2] #264: SCP send not properly setting mtime or atime
X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/264
Message-ID: <044.a55402a51f4fea1c20d4ce0199111e3f@libssh2.stuge.se>
X-Trac-Ticket-ID: 264
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r3TIfhMv011272
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

#264: SCP send not properly setting mtime or atime
--------------------------+--------------------
 Reporter:  wguynes       |       Owner:
     Type:  defect        |      Status:  new
 Priority:  normal        |   Milestone:  1.4.3
Component:  examples      |     Version:  1.4.2
 Keywords:  scp examples  |  Blocked By:
   Blocks:                |
--------------------------+--------------------
 When using libssh2_scp_send_ex() or libssh2_scp_send64() with non-zero
 mtime or atime parameters the time stamp does not get set.

 This is not so much a fault with the library, but that the scp send
 examples are misleading. After the data is actually sent the remote side
 is expecting one NULL byte. This will trigger the remote side to actually
 set the timestamp on the now fully received file. At present the examples
 merely slam the channel closed which the remote side meekly accepts.

 This will also be critical to implementation of any recursive SCP feature
 in the future. Multiple file transfers over one, open channel will require
 the NULL byte after each write data phase.

-- 
Ticket URL: <https://trac.libssh2.org/ticket/264>
libssh2 <https://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

