From fe856c739aa6043338720888b84d476b88bfd193 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 16 Sep 2024 17:39:29 +0100 Subject: [PATCH] Don't escape wildcard prefixes during backup expiry --- 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 9d82c384a..f05026193 100644 --- a/cookbooks/backup/files/default/expire-backups +++ b/cookbooks/backup/files/default/expire-backups @@ -20,7 +20,7 @@ my @dates; if ($prefix) { - $prefix = "${prefix}-"; + $prefix = "\Q${prefix}-\E"; } else { @@ -43,8 +43,8 @@ for my $month (0 .. $months - 1) } my $dates = join("|", @dates); -my $match = qr/^\Q${prefix}\E\d{4}-\d{2}-\d{2}\./; -my $keep = qr/^\Q${prefix}\E(?:${dates})\./; +my $match = qr/^${prefix}\d{4}-\d{2}-\d{2}\./; +my $keep = qr/^${prefix}(?:${dates})\./; opendir(DIR, "$dir") || die "Can't open ${dir}: $!"; -- 2.39.5