Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).

Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).

From: Peter Stuge <peter_at_stuge.se>
Date: Wed, 17 Apr 2013 18:10:42 +0200

Daniel Stenberg wrote:
>> I strongly dislike the absolute disconnect between the extremely generic
>> name libssh2_sftp_fsync() and the very opposite name fsync_at_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
Received on 2013-04-17