Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unison fails with "ill-formed message" error, same remote & local versions

Tags:

unison

I'm trying to get unison working after upgrading to Mac OS X Catalina. Unfortunately, macports installs a more recent version of ocaml (4.08.1), which means that the unison 2.51.2 release won't compile.

Well, that's no problem, I just update to git master on unison, and recompile. Unfortunately, this fails at sync time because the version of ocaml used to compile on the mac (4.08.1) is different from the one used to compile on the other machine (4.07.1). Sigh. Okay, use opam magic to install 4.07.1 on my machine. Everything should be fine, right? No!

Here's the error:

Connected [//zzzmyhost//home/clements/unison-home -> //zzzmyotherhost//Users/clements/clements]
Looking for changes
Uncaught exception Failure("input_value: ill-formed message")
Raised at file "/private/tmp/unison/src/lwt/lwt.ml", line 126, characters 16-23
Called from file "/private/tmp/unison/src/lwt/generic/lwt_unix_impl.ml", line 102, characters 8-23
Called from file "/private/tmp/unison/src/update.ml" (inlined), line 2105, characters 2-69
Called from file "/private/tmp/unison/src/uitext.ml", line 978, characters 16-56
Called from file "/private/tmp/unison/src/uitext.ml", line 1066, characters 6-90
Called from file "/private/tmp/unison/src/uitext.ml", line 1088, characters 19-66
Called from file "/private/tmp/unison/src/uitext.ml", line 1144, characters 21-43

What's going on?

like image 849
John Clements Avatar asked Dec 04 '19 17:12

John Clements


2 Answers

Sigh... the problem here (very non-obvious) is actually with a corrupted/wrong-format syncronization file, created when doing the failed sync in the earlier test.

The solution is just to go into ~/Library/Application Support/Unison (on a UNIX machine this path would presumably live in ~/.unison and delete the archive file that's causing the problem (probably the most recent one). In a pinch, just delete all of the archive files and start over.

like image 129
John Clements Avatar answered Nov 11 '22 15:11

John Clements


I've got the same problem between Windows and Ubuntu 20.04 after upgrading from Ubuntu 18.04. I tried the binary from Ubuntu 18.04 in 20.04, which still fails, so the incompatibility is likely inside one of the dependencies.

As a workaround I created a Docker image based on Ubuntu 18.04:

FROM ubuntu:18.04

RUN apt-get update && apt-get dist-upgrade -y
RUN apt-get install unison -y
RUN useradd martin --home /home/martin

WORKDIR /home/martin
USER martin

Building it with docker build -t unison:18.04 .

And then I added a wrapper to ~/bin/unison-2.48.4-docker:

#!/bin/bash

docker run --rm -i \
  -v /home/martin/dirtosync:/home/martin/dirtosync \
  -v /home/martin/.unison:/home/martin/.unison \
  --hostname $(hostname) \
  unison:18.04 unison "$@"

Setting the --hostname is important, since the hostname is part of the archive file.

Inside the profile on my Windows machine I configured:

servercmd = ~/bin/unison-2.48.4-docker
like image 38
Martin C. Avatar answered Nov 11 '22 14:11

Martin C.