Created attachment 14437 [details] rsync patch to transform every adjacent slashes into one slash The following test script shows that attempting to exclude the file /sourcedir/a/file2 by using //sourcedir//a//////file2 in the excluded files list, will silently not exclude it because of all those adjacent slashes not being reduced into just one /. #!/bin/bash mkdir -p destdir sourcedir/a touch sourcedir/file1 sourcedir/a/file2 echo 'sourcedir' >/tmp/filesfrom.list.tmp echo '//sourcedir//a//////file2' >/tmp/excluded.list.tmp #this won't work unless rsync gets patched #echo '/sourcedir/a/file2' >/tmp/excluded.list.tmp #yes this will work: [sender] hiding file sourcedir/a/file2 because of pattern /sourcedir/a/file2 rsync --recursive --perms --delay-updates --files-from=/tmp/filesfrom.list.tmp --exclude-from=/tmp/excluded.list.tmp --delete-excluded --debug=FILTER1 -- ./ ./destdir/ if test -r 'destdir/sourcedir/a/file2'; then echo 'test failed' else echo 'test succeeded' fi #cleanup rm -rf -- destdir sourcedir rm -- /tmp/excluded.list.tmp /tmp/filesfrom.list.tmp I have made a rsync patch(syntax-colored here [1]) in order to squash those consecutive slashes into just one, but I don't know how good it is(it's also quite hacky as you can see) though it does seem ok to me(probably 'cause I made it) and it works just fine. I'm attaching the patch here. [1] https://gist.github.com/constantoverride/28f5b86493c808849d9d38d7b7ae9685 To be honest I'm not entirely sure this is a bug or just a feature that I wanted rsync to have, so I tried to ask first: https://stackoverflow.com/q/51918909/10239615
Rsync expects you to supply the args that you want to use in the exclusions, and doesn't tweak them for slashes.