I am running debian bullseye which comes with rsync 3.2.3. and was struggling with writing a correct exclude-from file. I want to exclude everything under /tmp and /mnt, but include everything under/mnt/Windows/Users/jba. This is what I came up in the end and what works: + /mnt/Windows/Users/jba + /mnt/Windows/Users + /mnt/Windows - /mnt/Windows/Users/* - /mnt/Windows/* - /mnt/* - /tmp/* However, it didn't work in the beginning and took me some time to find out, that a space at the end (e.g. "+ /mnt/Windows/Users " in the second line) will be interpreted and thus, the directory is assumed to be "Users " and not "Users". So with the space it just didn't work. Is this the intended behavior? Its really hard to find this problem because trailing spaces are normally not directly visible. And they are dropped in every other software (at least the ones I use). The other thing I was thinking about is, that the above syntax is far from being intuitive. Especially if you have long path names it would be much easier if the following could be used: + /mnt/Windows/Users/jba - /mnt/* - /tmp/* In order to not break compatibility a special character (like "!") could be added at the end of the first line. Meaning "match to any subpath of this also". So create /mnt/Windows and /mnt/Windows/Users, but not their contents. However, that's just a proposal. But the behavior of trailing spaces is something I guess should be corrected. jba
On Mon 24 Jan 2022, J?rgen Bausa via rsync wrote:> > However, that's just a proposal. But the behavior of trailing spaces is something I guess should be corrected.Is it? How would you otherwise specify a space that you *do* intend to be relevant? Paul
On Mon 24 Jan 2022, Paul Slootman via rsync wrote:> >On Mon 24 Jan 2022, J?rgen Bausa via rsync wrote: >> >> However, that's just a proposal. But the behavior of trailing spaces is >> something I guess should be corrected. > >Is it? >How would you otherwise specify a space that you *do* intend to be >relevant? > > >PaulThats a good point. Seems the problem is more complex than I thought I did not think that someone would intent to have a space at the end of a directory or file name. But this can of course happen. Changing the interpretation of trailing spaces would break backwards compabilty. So at least there should be a warning in the documentation. Maybe there is already one, but I didnt find it. jba
On Mon, Jan 24, 2022 at 1:08 AM J?rgen Bausa via rsync < rsync at lists.samba.org> wrote:> However, it didn't work in the beginning and took me some time to find > out, that a space at the end (e.g. "+ /mnt/Windows/Users " in the second > line) will be interpreted and thus, the directory is assumed to be "Users " > and not "Users".When working on some filter rules it helps to use --debug=FILTER or --debug=FILTER2 options. (While these are implied by -vv and -vvv respectively, it's better to be more specific in what you want to debug.) The FILTER2 level mentions the add_rule(RULE_HERE) call where a trailing space would be visible prior to the trailing paren, though it might not be immediately obvious. I've just made a change in git that makes rsync output a warning message in either debug-filter level if there is a trailing space or tab on a rule, which will help someone notice it if they didn't intend to specify it. ..wayne.. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20220127/4ea45118/attachment.htm>