dcosson / vagrant-unison2

Vagrant plugin to sync local files to VM using Unison over SSH
MIT License
50 stars 8 forks source link

[Question] any way to limit debug output? #7

Closed flynfish closed 8 years ago

flynfish commented 8 years ago

Currently when I run vagrant unison-sync-polling, after initial sync I get a debug output every single second:

Synchronization complete at 13:00:31  (0 item transferred, 1 skipped, 0 failed)
  skipped:  (properties changed on both sides)
props    <-?-> props      /
No updates to propagate
Synchronization complete at 13:00:32  (0 item transferred, 1 skipped, 0 failed)
  skipped:  (properties changed on both sides)
props    <-?-> props      /
No updates to propagate
Synchronization complete at 13:00:33  (0 item transferred, 1 skipped, 0 failed)
  skipped:  (properties changed on both sides)
props    <-?-> props      /
No updates to propagate

Is there any way to prevent it from showing this if there are no changes?

dcosson commented 8 years ago

I'm not aware of a way to limit this short of redirecting all output to /dev/null, since it's coming directly from the long-running unison process.

But it already does work as you describe, there's no output if there are no changes. In this case there is a change on both sides, but it can't be automatically resolved. Even if we could ignore it easily, it might not be the best idea because in some cases this will actually be a problem because that file isn't being synced.

Typically I run vagrant unison-cleanup when I get into this state, which will blow away everything in the VM and resync to the version that's on your host (if it was a bug that you got into this unresolvable state, you could open that as a separate issue with steps to reproduce).

Also note, if you don't need to sync the props file or dir you can also add it to the ignore pattern.

flynfish commented 8 years ago

hmm I don't have any props file or dir. After researching a bit it looks like its complaining either about timestamps or file permissions:

timestamps: http://www.granneman.com/tech/security/backup/unisonbackup/

To start, let's add the following to the file (it doesn't matter where you put these preferences, but I like to put them at the top of the file, after my two roots and before any "ignore" lines):

`times = true`

If you use Unison for any length of time, you're going to notice that a lot of files need their "props" synchronized. Complaining about "props" is just Unison's way of telling you that the date and time stamps for your files—which indicate when the files were modified—are not exact. By setting times to true, you are copying over not just the contents of the files, but their modification dates and times as well, which will vastly reduce any "props" complaints that you'll see.
dcosson commented 8 years ago

Oh interesting, good find. Might be good to default to times = true then if it's not already.

Does vagrant unison-cleanup fix it? Also, is the clock in your vagrant vm skewed from your host clock maybe?

flynfish commented 8 years ago

No the unison-cleanup did not fix it and the clock on my vm wasn't skewed. My PR fixes the issue :)