From d62008814effff58445617b19ff7367742d64d34 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 6 Sep 2022 22:45:40 +0100 Subject: [PATCH] Fix backup expiry script to match prefixes correctly --- cookbooks/backup/files/default/expire-backups | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbooks/backup/files/default/expire-backups b/cookbooks/backup/files/default/expire-backups index 81834d437..9d82c384a 100644 --- a/cookbooks/backup/files/default/expire-backups +++ b/cookbooks/backup/files/default/expire-backups @@ -43,12 +43,12 @@ for my $month (0 .. $months - 1) } my $dates = join("|", @dates); -my $match = qr/^${prefix}\d{4}-\d{2}-\d{2}\./; -my $keep = qr/^${prefix}(?:${dates})\./; +my $match = qr/^\Q${prefix}\E\d{4}-\d{2}-\d{2}\./; +my $keep = qr/^\Q${prefix}\E(?:${dates})\./; opendir(DIR, "$dir") || die "Can't open ${dir}: $!"; -my @files = sort(grep($match, readdir(DIR))); +my @files = sort(grep(/$match/, readdir(DIR))); closedir(DIR); -- 2.39.5