Bug 12430 - rsync daemon chooses wrong place for pathes containing space and the module name
Summary: rsync daemon chooses wrong place for pathes containing space and the module name
Status: RESOLVED WORKSFORME
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.1
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-16 16:20 UTC by Thimo Neubauer
Modified: 2020-07-26 09:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thimo Neubauer 2016-11-16 16:20:02 UTC
When uploading our internal test data (which features a rich set of filenames and paths) I've discovered that some files ended up in the wrong place. Here's a reduced setup to reproduce the problem:

 - create directory /tmp/foo

 - create a minimal rsyncd.conf, e.g.

"""
use chroot = false
uid = thimo

[foo]

path = /tmp/foo
read only = false
"""

 - start rsyncd with "sudo rsync --daemon --no-detach --config=rsyncd.conf"

Now the testcase is to copy some file into arbitrary directories. As a working case perform:

 - mkdir -p '/tmp/foo/c boo'
 - rsync '/etc/issue' 'rsync://localhost/foo/c boo/issue'
 - as expected a file '/tmp/foo/c boo/issue' will appear

Now if the module name (in this case "foo") appears after the space you can see the bug:

 - mkdir -p '/tmp/foo/c foo'
 - rsync '/etc/issue' 'rsync://localhost/foo/c foo/issue'
 - contrary to the case above you'll notice that the file ended up in '/tmp/foo/c' instead of '/tmp/foo/c foo/issue'

Quoting wasn't a problem in the first case, hence it shouldn't be one in the second case
Comment 1 Wayne Davison 2020-07-26 09:45:27 UTC
The space splitting is an old "feature" of rsync. Use -s (--protected-args) to avoid that.  You can also export RSYNC_USE_PROTECTED_ARGS=yes if you want that to be the default.