samba-bugs at samba.org
2018-Aug-20  05:11 UTC
[Bug 13582] New: rsync filters containing multiple adjacent slashes aren't reduced to just one slash before matching
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: wayned at samba.org
          Reporter: constantoverride+bugzilla.samba at gmail.com
        QA Contact: rsync-qa at 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.
L A Walsh
2018-Oct-12  22:32 UTC
[Bug 13582] New: rsync filters containing multiple adjacent slashes aren't reduced to just one slash before matching
On 8/19/2018 10:11 PM, just subscribed for rsync-qa from bugzilla via rsync wrote:> 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 /. >This is a bad example, because the leading '//' cannot be removed without potentially changing the file's location. It's in POSIX that exactly 2 slashes should not be reduced to '1' if it is at the beginning of the path. The ones in the middle -- yes, but even if they were fixed, the two in front might not match a single -- because some OS's use // to introduce a network-located system (in cygwin on windows //remotesystem/will automatically try remotesystem). Can your exclude use a regular expression?, can you say: '/?sourcedir/*a/*file2' in the exclude patterns? (assuming a POSIX RE (not a file wildcard)).>
samba-bugs at samba.org
2018-Nov-20  22:09 UTC
[Bug 13582] rsync filters containing multiple adjacent slashes aren't reduced to just one slash before matching
https://bugzilla.samba.org/show_bug.cgi?id=13582
Wayne Davison <wayned at samba.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED
--- Comment #1 from Wayne Davison <wayned at samba.org> ---
Rsync expects you to supply the args that you want to use in the exclusions,
and doesn't tweak them for slashes.
-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Seemingly Similar Threads
- file contents cause rsync to fail (with certains args and dir structure)
- [Bug 13320] New: file contents cause rsync to fail (with certains args and dir structure)
- file contents cause rsync to fail (with certains args and dir structure)
- file contents cause rsync to fail (with certains args and dir structure)
- Specify Includes Only