https://bugzilla.samba.org/show_bug.cgi?id=13582

            Bug ID: 13582
           Summary: rsync filters containing multiple adjacent slashes
                    aren't reduced to just one slash before matching
           Product: rsync
           Version: 3.1.3
          Hardware: x64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: core
          Assignee: way...@samba.org
          Reporter: constantoverride+bugzilla.sa...@gmail.com
        QA Contact: rsync...@samba.org

Created attachment 14437
  --> https://bugzilla.samba.org/attachment.cgi?id=14437&action=edit
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

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
  • [Bug 13582] New: rsyn... just subscribed for rsync-qa from bugzilla via rsync

Reply via email to