Exclude list delete files from both side
Describe the bug Tried to add some list to exclude, but i get them deleted from source and destination
To Reproduce RSYNC_EXCLUDE_FROM="exclude.list"
Can you give more details ? Like exactly what you're trying to achieve, osync version used ? config file / command line ?
Here is an use case that I have experienced during the evaluation stage of the osync tool (master version) that might be related to this issue:
- edit the config file and run the osync.sh (for the initial sync of the target)
- add some exclusions patterns to RSYNC_EXCLUDE_FROM into config file
- run osync.sh again
- the files matching the patterns list will be deleted from both target and initiator.
I think that the matching files should be only deleted (excluded) from the target.
However, if the RSYNC_EXCLUDE_FROM is already configured on the first run (initial sync), the matching files will neither be transferred to nor deleted from master subsequently.
Okay I see... That's actually a known issue (see KNOWN ISSUES). No easy way around this one. I'll add a note in the config file.
From what I noticed, this is not strictly related to "soft deletion". The files are deleted regardless of "soft deletion" enabled or disabled.
I'm sorry, I have a hard time getting what you're talking about here. Care to make a quick schema of the behavior you're describing ?
I just tried the following:
Create a conf file based on the template like
INITIATOR_SYNC_DIR="/tmp/testA"
TARGET_SYNC_DIR="/tmp/testB"
...
RSYNC_EXCLUDE_FROM="exclude.list"
Created the following exclude.list file
*.test
Creating files in directories
touch /tmp/testA/{file1.ext,shouldnotbedeleted1.test}
touch /tmp/testB/{file2.ext,shouldnotbedeleted2.test}
Run osync
Result:
ls testA
file1.ext file2.ext shouldnot1.test
ls testB
file1.ext file2.ext shouldnot2.test
This is the excpected behavior. Files with extension .test haven't been touched nor deleted by osync.
@goDamri, @victor-vc Can you explain the problem you're experiencing this way so I get to know what happens ?
Here is the scenario (unexpected behavior):
- create the test.conf file
INITIATOR_SYNC_DIR="/initiator/folder"
TARGET_SYNC_DIR="ssh://target.host.com//target/folder"
...
SOFT_DELETE=false
-
add some files to the initiator folder
touch a.txt b.txt c.test -
run osync (initial sync)
osync.sh /etc/osync/test.conf
Result: all 3 files are synced (i.e. existing in both initiator and target folders)
-
edit test.conf and add the the exclusion pattern
RSYNC_EXCLUDE_PATTERN="*.test" -
run osync again
Result: c.test is deleted from both initiator and target.
Ok, now it's getting clear.
osync is statefull, which means it keeps directory changes between runs.
If you happen to modify the configuration, you have to reinitialize the statefullness, ie run osync once with --initialize parameter.
I'll add a word to the doc.
Yes, it makes sense because if I add RSYNC_EXCLUDE_PATTERN="*.test" in the conf file from the very beginning (prior running the initial sync), the files are preserved on initiator and are not transferred (are excluded) from target.
This was freaking scary... A big blocker bug just before a release. Fortunately, it's just doc updates ;)