Ticket #729 (new defect)

Opened 5 months ago

Last modified 1 month ago

file-sync does not sync recursively

Reported by: halton Assigned to: dgollub
Priority: high Milestone: 0.42
Component: Plugin: file-sync Version: 0.36
Severity: critical Keywords:
Cc:

Description

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

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

3. 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

04/20/08 19:46:47 changed by irene.huang@sun.com

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?

Thanks

--Irene

08/03/08 14:33:33 changed by tuju

  • milestone set to 0.42.