<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jul 25, 2014 at 11:50 AM, Ole Tange <span dir="ltr"><<a href="mailto:tange@gnu.org" target="_blank">tange@gnu.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

I am quite surprised that rsync-3.1.x does not simply negotiate the protocol and downgrade to protocol 30 automatically when 31 fails.</blockquote><div><br></div><div>Sadly, it can't do any of that because it is the 2.5.7 version that is killing the connection due to the advent of protocol 31 -- 2.5.7 has some code in it to die if what it thinks is a protocol number isn't in a particular range of values that maxes out at protocol 30.</div>

<div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">And I find the error message could be more helpful in finding the workaround.<br>

</blockquote><div><br></div><div>Again, it's the old 2.5.7 assuming that the bytes it is encountering are crap instead of valid data, which usually means that some ascii text got into the transmission stream.  A sad effect of having no decent starting byte sequence to the protocol, and no way to change it without becoming incompatible with all prior versions of the software.</div>

</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">My question is now: What should I do as a developer?<br>

</blockquote><div><br></div><div>There aren't any particularly easy answers for dealing with an old bit of software that is refusing to play nice with newer software.  One possibility is for your wrapping code to do a configure pass that checks the rsync version on both of the hosts and figures out if one is too old (2.6.0 and newer are fine, so only 2.5.7 and older have this issue) and one is too new (3.1.0 is the first to start using protocol 31). If that occurs, you can specify the --protocol=30 option on the newer rsync to avoid the issue.</div>

<div><br></div><div>Depending on the client's willingness to tweak their rsync, the fix for such an old 2.5.7 would really be as simple as changing one number in the executable from comparing against 30 to comparing against 40.  If someone were to take the code for 2.5.7 and tweak that one use of the <span style="color:rgb(0,0,0)">MAX_PROTOCOL_VERSION (it only gets used in compat.c) then the 2.5.7 version would work fine.  That would essentially be a 1-byte patch to the executable, but obviously you can't expect everyone to be willing to apply such a change, even if you were able to figure out exactly what byte to twiddle.</span></div>

<div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">..wayne..</span></div></div></div></div>