rsnapshot / sourceforge-issues

Issues imported from sourceforge. These are just to track down everything on github. After closing all issues, we remove the repo again. Please don't open any issues here!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Per-backup-point parameters clobber global exclude parameters [sf#19]

bebehei opened this issue · comments

Reported by resplin on 2010-01-30 18:10 UTC
System: Ubuntu Karmic 9.10
Version: 1.3.0-2

Environment

I have an exclude file that contains a list of file types that I want to exclude from backup. For one of my backup paths, I also list a subdirectory to exclude.

Here are the relevant parts of my rsnapshot.conf:
exclude_file /etc/rsnapshot/exclude
backup /home/myuser mylaptop/ exclude=NoBak
backup /home/otheruser mylaptop/

Here is the relevant line from the exclude file:
/**/*.vdi

Expected Behavior

I would expect .vdi files to be excluded from all backup paths, and the NoBak
directory to be excluded in /home/myuser.

Observed Behavior

Though the NoBak subdirectory in /home/myuser is excluded from the backup, .vdi files are being included. However, .vdi files in /home/otheruser are not being included.

Other Information

rsync behaves appropriately when it is handed both a --exclude and --exclude-from flag.

I quickly went through the exclude and exclude_file areas of the rsnapshot Perl script, and the error was not obvious to me. It seemed like the rsync command line was being built correctly with the ".=" operator.

Updated by resplin on 2010-01-30 18:10 UTC

  • priority: 5 --> 4

Commented by resplin on 2010-01-30 18:11 UTC
Reduced priority because once the behavior is understood the workaround is not very difficult.

Commented by hashproduct on 2010-03-07 04:42 UTC
Ah, this is a subtle bug. Internally, rsnapshot handles the {in,ex}clude{,_file} parameters by folding them into rsync_long_args. If a backup point specifies an excluded-related parameter but not an rsync_long_args parameter, rsnapshot takes the global rsync_long_args value at that point:

http://rsnapshot.cvs.sourceforge.net/viewvc/rsnapshot/rsnapshot/rsnapshot-program.pl?revision=1.417&view=markup\#l\_1839

The problem is that the global rsync_long_args is read during parse_config_file, /before/ the global exclude-related parameters are folded into it in validate_config_file:

http://rsnapshot.cvs.sourceforge.net/viewvc/rsnapshot/rsnapshot/rsnapshot-program.pl?revision=1.417&view=markup\#l\_1458

Specifying a per-backup-point rsync_long_args also clobbers the global exclude parameters.

I think the expected behavior is that each backup-point parameter replaces the global parameter of the same name unless the "+" prefix is used, but otherwise everything is additive. The straightforward way to achieve this would be to delay all combining of exclude parameters until rsync_backup_point.

Updated by hashproduct on 2010-03-07 04:54 UTC

  • summary: exclude_file ignored when exclude also used --> Per-backup-point parameters clobber global exclude parameters