The Samba-Bugzilla – Bug 8965
unexpected --exclude behaviour which can lead to a data breach
Last modified: 2012-06-16 17:40:14 UTC
rsync --exclude /h/xy/* /source /target
causes rsync to sync /h/xy/* into target
sync /source with /target and exclude files beyond /h/xy/
That is your shell globbing the * and turning it into multiple parameters all except the first being a list of sources. You need to quote your exclude with a wildcard like: --exclude '/h/xy/*'
ah, ok. But it would be nice if rsync would warn at least. Nothing is so frustrating as to exclude some directories and suddenly rsync leaks informations from a similar named directory
Rsync has no way to know that you tried to use a * or that you did not intend to use a list of sources. If the explanation isn't clear try running your command again with an "echo" in front of the "rsync". That will show you what your shell expands the command to before passing it to rsync.
A couple ways to avoid such an issue in the future:
* Always quote any wildcards that you aren't wanting to match files (i.e. don't depend on your shell to pass non-matches as literal wildcards to any program). If you can ask your shell to return an error for non-matched wildcards (instead of running the command), that can help get in the habit (e.g. use zsh's "setopt NOMATCH").
* Get in the habit of using --exclude=ARG so that unquoted wildcards are less likely to match anything.