Re: which mask to use to prune a directory
Denis Corbin <[email protected]> Sat, 03 Jul 2004 10:06:25 +0200
| Newsgroups | gmane.comp.sysutils.backup.dar.libdar |
|---|---|
| Organization | none |
| Message-ID | <[email protected]> |
Christian Neumann wrote:
> Hi,
Hello,
> do the simple_path_mask or the exclude_dir_mask support wildcards
> (?/*)? As far as I understood the libdar code, they do not. But as
> dar's -P option supports wildcards...
exclude_dir_mask matches any file that is a subdir or equal to the mask
string. No wildcard are available for that type of mask.
simple_path_mask matches any file that is a subdir or the mask of any
file for which mask is a subdir. No wildcard are available for that type
of mask.
simple_mask implements wildcard mask like on the command-line (glob
expression).
> Which mask(s) uses dar to
> implement the-P option? I thought of using two simple_masks (<dir> and
> <dir>/*), but I am not sure if this is the right way.
well actually in CVS we have:
-g option uses simple_path_mask
-P option uses exclude_dir_mask
-I option uses simple_mask
-X option uses simple_mask
Note: -g is new and is equivalent to [list of paths] the opposit of -P
But in last release, we had:
[list of paths] used simple_path_mask
-P option used simple_mask
-I option uses simple_mask
-X option uses simple_mask
note for previous release which behaves properly, the -P <string> on
command line, only implies the construction of simple_mask(<string>).
This is not necessary to add a simple_mask(<string>/*) because as soon a
directory is excluded no recursion is done in it.
it seems I have made a mistake while implementing the ordered mask
feature (-am option), substituing simple_mask by exclude_dir_mask for -P
option. This has some reasons. When doing unordered mask construction
the correct mask for -P is simple_mask. While when doing ordered mask
construction using simple_mask for -P brings some new problems:
for example: -P "usr/local" -g "usr/local/lib"
using ordered mask (-am option) it would build the following mask:
simple_path_mask("usr/local/lib") or not simple_mask("usr/local")
the "usr/local/man" for example, would then wrongly be included for
saving because "usr/local/man" neither matches "usr/local/lib" nor
"usr/local". Instead in original unordered mask construction, we would
have got:
simple_path_mask("usr/local/lib") and not simple_mask("usr/local")
scanning the directory we would first reach "usr/local" which would
match the second mask and make all this subdirectory tree be excluded
(eventually being replaced by an empty directory in the archive if -D
was used), with no more recursion in it.
In ordered mask construction, the "usr/local" is first matched by
simple_path_mask("usr/local/lib") because "usr/local/lib" is a subdir of
"usr/local". So never the [not simple("usr/local")] expression will match.
I will look at this problem and fix it in CVS.
> And does the -D
> option work with this solution? Also, is there any way to include
> wildcarded dirs (like include only config dirs: ".*") (I know that the
> parent dirs up to the root path have to be included. Any convenient
> solution?).
the -D option is independant of the type of masked used, as soon a
directory is excluded by a filter and -D option is used, the directory
it subsitued by an empty dir in the archive.
>
> Regards,
> Christian
>
Thanks for feedback,
Cheers,
Denis.
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com