Here a bug report about "!" not working properly in 2.6.4 and above,
paraphrased...

> Ok, see attachment. I've tested it right now between two hosts
> running rsync 2.6.3-2 and 2.6.6-1. It works in the forward direction,
> backwards it gives
>
> '!' rule has trailing characters: !
> rsync error: syntax or usage error (code 1) at exclude.c(833)


> ---------------------------------------------------------------------------
> #! /bin/bash -ex
>
> echo '!' > ~/.cvsignore
> echo '*~' >> ~/.cvsignore
> rm -rf /tmp/tester
> mkdir /tmp/tester
> cp /etc/passwd /tmp/tester
> cp /tmp/tester/passwd{,~}
> rsync -avbu --cvs-exclude --delete /tmp/tester remotehost:/tmp/


I've found that when "!" was scanned, the pointer was not advanced,
hence there appeared to be trailing chars... The following patch seems
to fix it.

Paul Slootman

--- rsync-2.6.6.orig/exclude.c
+++ rsync-2.6.6/exclude.c
@@ -665,8 +665,10 @@
* for old include/exclude patterns where just "+ " and "- " are
* allowed as optional prefixes. */
if (mflags & MATCHFLG_NO_PREFIXES) {
- if (*s == '!' && mflags & MATCHFLG_CVS_IGNORE)
+ if (*s == '!' && mflags & MATCHFLG_CVS_IGNORE) {
new_mflags |= MATCHFLG_CLEAR_LIST; /* Tentative! */
+ s++;
+ }
} else if (xflags & XFLG_OLD_PREFIXES) {
if (*s == '-' && s[1] == ' ') {
new_mflags &= ~MATCHFLG_INCLUDE;
@@ -674,8 +676,10 @@
} else if (*s == '+' && s[1] == ' ') {
new_mflags |= MATCHFLG_INCLUDE;
s += 2;
- } else if (*s == '!')
+ } else if (*s == '!') {
new_mflags |= MATCHFLG_CLEAR_LIST; /* Tentative! */
+ s++;
+ }
} else {
char ch = 0, *mods = "";
switch (*s) {
--
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html