Re: Directory masks -- howto?
Johnathan Burchill <[email protected]>
| Newsgroups | gmane.comp.sysutils.backup.dar.general |
|---|---|
| Organization | Department of Physics and Astronomy, University of Calgary |
| Message-ID | <[email protected]> |
On October 14, 2003 02:36 pm, you wrote:
[...]
>
> Strange. This warning is issued only if
> 1 - you create an archive
> *and*
> 2 - the filename mask dot exclude the first slice filename
> *and*
> 3 - the directory where is saved the archive (sauv_root) is not excluded
> by the subtree filter (subtree).
>
> 1 is true
> 2 is true
> for the warning not to appear 3 must thus be false.
> this lead me to the question, which arguments do you give to the
> op_extract() call, in particular, the fs_root and sauv_root ?
>
Just to be clear, I am doing an "op_create", and I've now hard-coded the
fs_root and sauv_root into the op_create call to eliminate any potential
problems with my filename parsing.
So here is an example file ("dar-test-create") which reproduces my problem.
#include <iostream>
#include <string>
#include <libdar.hpp>
#include <erreurs.hpp>
using namespace std;
using namespace libdar;
void interaction_warning (const std::string &);
bool interaction_pause (const std::string &);
int main ( )
{
set_warning_callback(&interaction_warning);
set_answer_callback(&interaction_pause);
user_interaction_warning("Basic program working");
try
{
user_interaction_pause("About to create the archive. Do you wish to
continue?");
}
catch (Euser_abort &e)
{
user_interaction_warning(e.get_message());
return -1;
}
try
{
op_create("/home/john/test-dar-create",
"/home/john/test-dar-create/backups",
NULL, bool_mask(true), not_mask( simple_mask(
"/home/john/test-dar-create/backups")),
"test-archive", "dar", NULL, true, true, true, true,
true, bzip2, 9, 650000000, 645000000, true, true,
"", "", "", "", "", "", bool_mask(true), 0, true,
false, 0);
}
catch (Egeneric & e)
{
user_interaction_warning(e.get_message());
}
}
void interaction_warning(const std::string &message)
{
cout << message.c_str();
}
bool interaction_pause(const std::string &message)
{
string answer;
cout << message.c_str();
cin >> answer;
if (answer == "y")
{
return true;
}
else
{
return false;
}
}
I compiled it with...
g++ -DHAVE_CONFIG_H -fexceptions -ldar64 -DMODE=64 -I./dar/src/libdar -o
dar-test-create dar-test-create.cpp
I get the "recursive error" message when running "dar-test-create".
The archive gets created anyway without any problem though.
Here is the output from the created archive:
bash-2.05b$ dar -l test-archive.1.dar
Reading config file: /home/john/.darrc
Warning, test-archive.1.dar seems more to be a slice name than a base name.
Do you want to replace it by test-archive ? [return = OK | esc = cancel]
Continuing...
[data ][ EA ][compr] | permission | user | group | size | date
| filename
----------------------+------------+-------+-------+-------+-------------------------------+------------
[Saved] [-----] drwxr-xr-x john users 0 Wed Oct 15
11:06:27 2003 backups
[Saved] [ 67%] -rwxr-xr-x john users 1239391 Wed Oct 15
10:57:42 2003 kdar
So dar does exclude the backup directory, but the warning message gets
issued anyway.
The libdar code which generates the "recursion error" message is:
if(create_not_isolate && sauv_path.is_subdir_of(fs_root)
&& selection.is_covered(filename+".1."+extension)
&& subtree.is_covered((sauv_path +
(filename+".1."+extension)).display()))
user_interaction_pause(string("WARNING! The archive is located in the
directory to backup, this may create an endless loop when the archive will
try to save itself. You can either add -X \"")+ filename + ".*." +
extension +"\" on the command line, or change the location of the archive
(see -h for help). Do you really want to continue?");
What I don't understand here is that if subtree is supposed to mask
directories, why does subtree.is_covered() include a filename? Shouldn't
there just be "sauv_path" as an argument?
> dar also calls op_extract, and in the current situation would call
> something like this:
>
> op_extract("/home/john/kdar", "/home/john/kdar/backups",
> bool_mask(true), subtree, ....)
>
> with subtree built as you did:
> ou_mask exclus;
> exclus.add_mask(simple_mask("/home/john/kdar/backups"));
> et_mask subtree;
> subtree.add_mask(not_mask(exclus));
>
> (you could also replace "subtree" by "not_mask(exclus)" in the argument
> given to op_extract, it should do the same in this case.
>
> > It works fine when I have two "-P" type arguments:
> > exdir1="/home/john/kdar/backups"
> > exdir2="/home/john/kdar/backups/*"
> > exclus.add_mask(simple_mask(exdir1));
> > exclus.add_mask(simple_mask(exdir2));
>
> this should not be necessary.
>
> > The command line version of libdar does not require me to have both
> > "-P" arguments for the backup to be excluded, I just need "-P
> > backups". How do I make it as simple using libdar directly?
>
> we will find out, but be sure that dar command line uses the same
> interface as kdar and no such trick is necessary to avoid the warning
> message.
Absolutely.
>
> > Thanks,
> > JB
> >
> > P.S. some screenshots of KDar can be found at
> > http://www.phys.ucalgary.ca/~burchill/KDAR/index.html
>
> that seems very promising !!! I'm impatient to try it ! :-)))
>
I'm happy to share. I could put a tarball on my website once I have the
masks working. It would be good to get feedback on how to improve the UI.
JB
--
Johnathan K. Burchill, Ph.D.
Department of Physics and Astronomy
University of Calgary
2500 University Drive N.W.
Calgary, AB T2N 1N4
Canada
(403) 217-4286
[email protected]
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php