Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude list delete files from both side #201

Open
godamri opened this issue Jun 13, 2020 · 10 comments
Open

Exclude list delete files from both side #201

godamri opened this issue Jun 13, 2020 · 10 comments
Labels
Milestone

Comments

@godamri
Copy link

godamri commented Jun 13, 2020

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"

@deajan
Copy link
Owner

deajan commented Jun 26, 2020

Can you give more details ? Like exactly what you're trying to achieve, osync version used ? config file / command line ?

@victor-vc
Copy link

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.

@deajan
Copy link
Owner

deajan commented Jun 27, 2020

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.

@deajan deajan added this to the v1.3 release milestone Jun 27, 2020
@victor-vc
Copy link

From what I noticed, this is not strictly related to "soft deletion". The files are deleted regardless of "soft deletion" enabled or disabled.

@deajan
Copy link
Owner

deajan commented Jun 29, 2020

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 ?

@deajan
Copy link
Owner

deajan commented Jun 29, 2020

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 ?

@victor-vc
Copy link

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.

@deajan
Copy link
Owner

deajan commented Jun 29, 2020

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.

@deajan deajan added the doc label Jun 29, 2020
@victor-vc
Copy link

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.

@deajan
Copy link
Owner

deajan commented Jun 29, 2020

This was freaking scary... A big blocker bug just before a release.
Fortunately, it's just doc updates ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants