Bug 178126 - app-backup/flexbackup subtle subtree pruning issue / other small issues
Bug#: 178126 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: maintainer-needed@gentoo.org Reported By: john_r_graham@mindspring.com
Component: Applications
URL: 
Summary: app-backup/flexbackup subtle subtree pruning issue / other small issues
Keywords:  
Status Whiteboard: 
Opened: 2007-05-11 23:54 0000
Description:   Opened: 2007-05-11 23:54 0000
When you specify a list of directories to prune, flexbackup gets it almost
right.  It backs up all of the directories on the pruning list but none of the
contents of those directories.  As such, little space is wasted in the backup
and it's more if a nit than a real show stopper.

Here's even more of a nit.  The manpage incorrectly documents the "-extract
-onefile" option, although it's correctly documented in the built-in help.

I'll be posting a patch shortly that corrects both issues and adds a little
more documentation on the subtleties of the pruning mechanism.

------- Comment #1 From John R. Graham 2007-05-12 00:50:18 0000 -------
The issue was that flexbackup was taking the list of directories, for instance,
like this one:

    $prune{'/home'} = "bert ernie bigbird";

from its conf file and constructing a regular expression (that's passed on the
command line of "find") like this (necessary shell escaping omitted for
clarity):

    -regex "\./(bert|ernie|bigbird)/.*" -prune

The "/.*" on the end of the regular expression ensured that any file under the
listed directories would match and be pruned but, because of the trailing
slash, the directory itself *would not* be matched.  The solution was to omit
the last two atoms of the regular expression, resulting in:

    -regex "\./(bert|ernie|bigbird)" -prune

This results in each directory itself being pruned (which is what was wanted
all along).  Since each directory is pruned, there's no need to match their
contents.

------- Comment #2 From John R. Graham 2007-05-12 02:30:08 0000 -------
Created an attachment (id=118958) [details]
Patch to address reported issues.

* Fix the regex construction issue to correct subtree pruning.
* Minor code cosmetics (couldn't resist).
* Corrected a few typos in the flexbackup man page.
* Minor updates to the flexbackup.conf man page.
* Additional tutorial explanation and examples in the sample
  flexbackup.conf file.

------- Comment #3 From John R. Graham 2007-05-12 09:13:39 0000 -------
This is now in Portage as flexbackup-1.2.1-r5 with the help of the Gentoo
Sunrise team.  Thanks, genstef!

------- Comment #4 From Ivan Yarych 2007-07-24 12:45:07 0000 -------
I liked the old (current) behaviour of the prunning functionality. When you
perform the estract you get dirs like /mnt/win_c, /usr/portage, /var/log
created and have less problems after restoring the system, don't you think?

------- Comment #5 From John R. Graham 2007-07-24 17:21:05 0000 -------
Not really.  If you prune a directory, I think the most intuitive behavior is
for it to *not* be included in the backup.  If you want to to back up the
directory but not the contents, your prune term can still do this.  Just do

    some_path/.*

instead of

    some_path

Hope this helps.

- John

------- Comment #6 From John R. Graham 2007-07-27 20:33:25 0000 -------
I should mention that the above works only with flexbackup-1.2.1-r5 or later.

- John