[Unison-hackers] version negotiation

Tõivo Leedjärv toivol at gmail.com
Wed Jun 30 12:42:30 EDT 2021


On Wed, Jun 30, 2021 at 6:00 PM Greg Troxel <gdt at lexort.com> wrote:
>
> So, the server will default to old unless
>   - invoked over ssh and arg from client that it does version
>     negotitation is passed, or

yes

>   - socket server and same arg is given, which flips the socket server
>     from "compatible with 2.51.x" to "compatible with >= 2.51.5"

the opposite, with current PR, but this could be flipped for a
transition period.

> > Right now, only server announces itself. Clients don't. And, right
> > now, all existing clients expect to receive a _fixed_ hello string
> > (which is "Unison 2.51 with OCaml >= 4.01.2\n").
>
> fixed but with arbitrary numbers presuambly

Can be changed at build time. All the servers/clients already deployed
out there verify this string byte-for-byte.

> So how about:
>
>   server sends vesrion string
>
>   server sends first message of existing protocol
>
>   if client wants to do old (because client is old, or because client
>   sees a version < 2.51.5), client speaks old protocol as it used to

so far so good.

>   if client is new and sees 2.51.5 or higher, then client knows server

Here's where it gets difficult. To keep compatibility with old
clients, it is difficult for server to announce that it is >= 2.51.5.
I don't say it is impossible...
Alternative is for the client to query it in a backwards-compatible
way. The naive approach that comes to mind is to use the old protocol
and just query it... except the old protocol is OCaml-dependent. So
this would work only during a transition period when users still have
to match OCaml versions.

If the client does not know that server is >= 2.51.5 then it can only
query/announce itself in a completely backwards-compatible way.

I'll keep thinking about it. There could be some tricky ways, abusing
the current protocol, like sending two 'write tokens' instead of
one...


More information about the Unison-hackers mailing list