1

I'm not sure why, but I keep getting this error when pushing some changes in Unison.

Synchronization complete at 11:49:01  (0 item transferred, 2 skipped, 0 failed)
  skipped: /timetool/ana_combined (contents changed on both sides)
  skipped: /timetool/plot_delays.py (contents changed on both sides)

I've seen some solutions that use the -prefer newer tag, but I'm not sure if this will work in my case. The server I'm working with is in Japan, while I'm working in the USA. As such, the timestamps are different for each file.

This is the current Unison command I'm using (with some minor changes to keep anonymity):

unison -auto -ignore='Name {.idea,miniconda,reborn.egg-info,*.swp,*.log,*.so,build,*.pyc,*cache*,conda_env,anaconda3,results,home}' $1 \
       -servercmd /home/local/bin/unison /home/my/path/ohyeah \
       ssh://server//home/my/server/path/ohyeah

Everything works fine except for this occasional error. I don't make any changes on the server side, but I still seem to get this error and I'm not sure how to force the changes I want.

Mike Pierce
  • 1,390
  • 1
  • 12
  • 35
NoVa
  • 317
  • 3
  • 15
  • Does this error only occur with those files? Only a subset of files being synced or all files? Is there any chance of those files are actually being changed on the remote host? (I get this same error all the time for a silly file that get's changed automatically by the window manager on each of my hosts). – Mike Pierce Jul 21 '20 at 00:58
  • Also, the timezone difference *shouldn't* be a problem. Like, by default most major file systems keep their timestamps in [UTC](https://en.wikipedia.org/wiki/Coordinated_Universal_Time). – Mike Pierce Jul 21 '20 at 00:59
  • @MikePierce sorry for the delay. It seems that I got that error when I changed write permissions on the server side, I didn't actually make any changes to the code. – NoVa Jul 22 '20 at 16:00

1 Answers1

0

I'll answer my own question, I think I found a solution.

I added the -prefer root flag to my sync script to get this working. It does what the name implies, it compares the versions and propagates the changes based on your preference.

i.e., the code:

unison -auto -ignore='Name {.idea,miniconda,reborn.egg-info,*.swp,*.log,*.so,build,*.pyc,*cache*,conda_env,anaconda3,results,home}' $1 \
       -servercmd /home/local/bin/unison /home/my/path/ohyeah \
       ssh://server//home/my/server/path/ohyeah -prefer /home/my/path/ohyeah

sets the preference to be my local machine. This might be problematic if, for example, someone edits the code in the server directory. When I sync the files, it'll overwrite the changes the person did with whatever is local to my machine.

NoVa
  • 317
  • 3
  • 15
  • Yeah, this removes the problem with a sledgehammer ;) I'm curious why the files are being changed on both hosts though, and whether actually has to do with the timezone difference. – Mike Pierce Jul 21 '20 at 01:03