On Sat, May 24, 2003 at 04:06:14PM +0800, Mathias K?rber wrote:
>
> --On Saturday, May 24, 2003 03:47:02 AM -0400 Jon LaBadie <jon AT jgcomp DOT
> com>
> wrote:
>
> >On Sat, May 24, 2003 at 03:26:16PM +0800, Mathias K?rber wrote:
> >>An update:
> >>
> >>root@adelphi:/tmp/amanda# cat sendbackup.Imap.20030524151819.include
> >>./imap
> >
> >I just looked at my ".exclude" files. The get the multi /'s. Here is one.
> >
> >./local/var/amanda/gnutar-lists/*.new
>
> That seems to work only for excludes, as names to exclude
> are handed to gnutar unprocessed (almost), while lots of
> stuff is being done for includes (apparently to avoid reporting
> errors when files are not found)..
Yeah, my bad. I thought the amanda man page had the same restriction
for both include and exclude. A reread shows my error.
> I had a look at the source, and in client_util.c
> found this in add_include which is called on each line
> in the file provided:
>
> [...]
> char *glob;
> char *regex;
> DIR *d;
> struct dirent *entry;
>
> glob = ainc+2;
> regex = glob_to_regex(glob);
> if((d = opendir(device)) == NULL) {
> dbprintf(("%s: Can't open disk '%s']\n",
> debug_prefix(NULL), device));
> if(verbose)
> printf("ERROR [Can't open disk '%s']\n", device);
> return 0;
> }
> else {
> while((entry = readdir(d)) != NULL) {
> if(is_dot_or_dotdot(entry->d_name)) {
> continue;
> }
> if(match(regex, entry->d_name)) {
> fprintf(file_include, "./%s\n", entry->d_name);
> nb_exp++;
> }
> }
> }
> [...]
>
> what this seems to do is to convert each line(glob) to a gnutar
> regex. It then reads the disk directory (/var) and compares each
> entry with the given regex. If it is found it is included in the combined
> list.
>
> Obviously reading /var only cannot find ./spool/imap
> as only ./spool will get found which will not match.
>
> May need to add some code to check whether a multi-/ name
> exists exactly as given and let that through too.
> Anythoughts on whether that will break anything?
That clearly is where it is happening. I don't recall the discussions that
went on when the include option was added - it was "fairly" recent. I would
think that passing the string to a globbing routine and scanning that would
be a good alternative to matching strings as RE's in the current directory.
Perhaps there was an argument against that approach. I've not checked, is
there a "glob expansion" routine in any of the C libraries?
Ahh, wait Mathais, you just need to update. I wanted to know when include
was added so I searched the ChangeLog. Came across this enhancement added
just last month.
2003-04-08 Jean-Louis Martineau <martineau AT iro.umontreal DOT ca>
* client-src/client_util.c (add_include):
If include contain 2 '/' then use at as is, don't try to match it.
Might do the job for you.
--
Jon H. LaBadie jon AT jgcomp DOT com
JG Computing
4455 Province Line Road (609) 252-0159
Princeton, NJ 08540-4322 (609) 683-7220 (fax)
|