Re: "wildcard" datestamp match in dumpspecs?

Nathan Stratton Treadway <[email protected]> Wed, 15 Nov 2017 01:11:44 -0500
Newsgroups gmane.comp.archivers.amanda.devel
Message-ID <[email protected]>
On Fri, Nov 10, 2017 at 08:23:09 -0500, Jean-Louis Martineau wrote:
> Nathan,
> 
> The '*'could be handle for the datestamp.
> Do you want to make a patch?

Okay, attached is a proposed patch.

After installing the patch, amvault lets me use "*" instead of "2" as a
placeholder in the dumpspec, e.g.:

  # su backup -lc "amvault TestBackup --dest-storage TestOffsite --dry-run host /boot '*' 0"


							Nathan

----------------------------------------------------------------------------
Nathan Stratton Treadway  -  [email protected]  -  Mid-Atlantic region
Ray Ontko & Co.  -  Software consulting services  -   http://www.ontko.com/
 GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt   ID: 1023D/ECFB6239
 Key fingerprint = 6AD8 485E 20B9 5C71 231C  0C32 15F3 ADCD ECFB 6239
amanda_3.5_datestamp_match_wildcard.diff (text/x-diff, 492 B)
--- common-src/match.c.orig	2017-10-07 15:16:07.000000000 -0400
+++ common-src/match.c	2017-11-15 00:58:32.577736364 -0500
@@ -995,6 +995,15 @@
 	goto illegal;
     }
 
+    /*
+     * datestamp matching does not involve globs or regexes, so
+     * handle wildcarding as a special case: if dateexp is "*",
+     * then all datestamps match.
+     */
+    if (strcmp(dateexp, "*") == 0) {
+	return TRUE;
+    }
+
     if (*dateexp == '=') {
 	return strcmp(dateexp+1, datestamp) == 0;
     }