Ticket #729 (new defect)

Opened 6 years ago

Last modified 6 years ago

file-sync does not sync recursively

Reported by: halton Owned by: dgollub
Priority: low Milestone:
Component: Plugin: file Version: 0.38
Severity: minor Keywords:
Cc: tuju


file-sync plugin missed recursive function

Test case is following:

  1. Create group

Create a group 'file-file' with two file-sync members, objtype are all 'data'.
Member1 path to /tmp/1
Member2 path to /tmp/2

  1. Make data

$mkdir -p /tmp/1/dir1
$mkdir -p /tmp/2
$echo "abc" /tmp/1/test
$echo "1111" /tmp/1/dir1/okay

  1. Sync

$msynctool --discover file-file
$msynctool --sync file-file

Expected result:
All data under /tmp/1 are synced to /tmp/2

Actual result:
Only files under /tmp/1 are synced /tmp/2, subfolders are ignored
, that is to say, only /tmp/1/test is synced, /tmp/1/dir1 are not

Change History

comment:1 Changed 6 years ago by irene.huang@…

Daniel and Halton

Just had a look at this bug. There's an recursive member in struct OSyncFileDir, if in the configuration file there's a line <recursive>TRUE</recursive>, then osync_filesync_report_dir will do a recursive call of itself to recursively look for the new/modified files in all the directories.

The problem here is Assume that we are trying to sync the two directories from ~/sync1 to ~/sync2

  1. if a new directory is created e.g. ~/sync1/good, and no file in it, the program just ignore that ~/sync1/good is a newly create directory, since there's no code to record the changes regarding directories. therefore no changes will be made in the syncing destination ~/sync2.
  2. if a new directory is create and new files are added to it ~/sync1/good/bad (file), the program identifies the new files added: bad (but not the directory ~/sync1/good) and record the change. However, when osync_file_write is called to introduce the change to the syncing destination, and try to create the new file: ~/sync2/good/bad using g_io_channel_new_file, g_io_channel_new_file failed to create the new file because ~/sync2/good does not exist at all.

Therefore, I guess we need to add a new format to the data objtype, e.g. "dir", so that we can handle the directories differently from file. However, since I am not familiar enough with the code, I haven't got an idea what's the best way to implement change.

Daniel, do you have any suggestion regarding the issue?



comment:2 Changed 6 years ago by tuju

  • Milestone set to 0.42

comment:3 Changed 6 years ago by tuju

  • Cc tuju added
  • Priority changed from high to low
  • Version changed from 0.36 to 0.38
  • Severity changed from critical to minor
Note: See TracTickets for help on using tickets.