rsync icon indicating copy to clipboard operation
rsync copied to clipboard

Filter is dependent on alphabetical order of source dir names

Open openstrike opened this issue 1 year ago • 1 comments
trafficstars

I have encountered this problem today in 3.2.7 and it might be a bug or it might be me just not understanding the merging. Apologies if it is the latter.

Here is a simple script to demonstrate:

#!/bin/bash

mkdir -p src/{a,b,c} dest
cd src
touch b/{no,yes}
echo '- /b/no' > .rsync-filter
echo With c
rsync -nav -F c b ../dest/
echo With a
rsync -nav -F a b ../dest/

As you can see this sets up a demo tree with dirs a, b and c. There are 2 files in b called yes and no. There is a .rsync-filter which has one line to exclude file b/no from syncing. But if we run this we see the following output:

With c
sending incremental file list
b/
b/yes
c/

sent 97 bytes  received 23 bytes  240.00 bytes/sec
total size is 0  speedup is 0.00 (DRY RUN)
With a
sending incremental file list
a/
b/
b/no
b/yes

sent 109 bytes  received 26 bytes  270.00 bytes/sec
total size is 0  speedup is 0.00 (DRY RUN)

This shows that if we try to sync b and c the filter excludes the no file correctly but if we try to sync b and a the filter does not exclude the no file.

This appears to be down to the fact that when b is not the alphabetically-first source specified then the filter is not applied to it.

I'm at a loss to explain why this might be expected behaviour, so am reporting it here as a potential bug.

openstrike avatar Apr 12 '24 14:04 openstrike

After upgrading to 3.4.0 this problem is still evident.

openstrike avatar Jan 15 '25 09:01 openstrike