Fix: backup: ctime was from stat not file name
The vzdump file was passed with the full path to the regex. That regex captures the time from the file name, to calculate the epoch. As the regex didn't match, the ctime from stat was taken instead. This resulted in the ctime shown when the file was changed, not when the backup was made. Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
This commit is contained in:
committed by
Fabian Grünbichler
parent
6a27e8171e
commit
40c795e7df
@ -942,7 +942,8 @@ my $get_subdir_files = sub {
|
||||
next if $fn !~ m!/([^/]+\.(tar|tar\.gz|tar\.lzo|tgz|vma|vma\.gz|vma\.lzo))$!;
|
||||
|
||||
my $format = $2;
|
||||
$info = { volid => "$sid:backup/$1", format => $format };
|
||||
$fn = $1;
|
||||
$info = { volid => "$sid:backup/$fn", format => $format };
|
||||
|
||||
if ($fn =~ m!^vzdump\-(?:lxc|qemu)\-(?:[1-9][0-9]{2,8})\-(\d{4})_(\d{2})_(\d{2})\-(\d{2})_(\d{2})_(\d{2})\.${format}$!) {
|
||||
my $epoch = timelocal($6, $5, $4, $3, $2-1, $1 - 1900);
|
||||
|
||||
@ -129,7 +129,7 @@ my @tests = (
|
||||
},
|
||||
{
|
||||
'content' => 'backup',
|
||||
'ctime' => DEFAULT_CTIME,
|
||||
'ctime' => 1585595500,
|
||||
'format' => 'vma.gz',
|
||||
'size' => DEFAULT_SIZE,
|
||||
'vmid' => '16110',
|
||||
@ -137,7 +137,7 @@ my @tests = (
|
||||
},
|
||||
{
|
||||
'content' => 'backup',
|
||||
'ctime' => DEFAULT_CTIME,
|
||||
'ctime' => 1585595565,
|
||||
'format' => 'vma.lzo',
|
||||
'size' => DEFAULT_SIZE,
|
||||
'vmid' => '16110',
|
||||
@ -145,7 +145,7 @@ my @tests = (
|
||||
},
|
||||
{
|
||||
'content' => 'backup',
|
||||
'ctime' => DEFAULT_CTIME,
|
||||
'ctime' => 1585595635,
|
||||
'format' => 'vma',
|
||||
'size' => DEFAULT_SIZE,
|
||||
'vmid' => '16110',
|
||||
@ -189,7 +189,7 @@ my @tests = (
|
||||
},
|
||||
{
|
||||
'content' => 'backup',
|
||||
'ctime' => DEFAULT_CTIME,
|
||||
'ctime' => 1585597170,
|
||||
'format' => 'tar.lzo',
|
||||
'size' => DEFAULT_SIZE,
|
||||
'vmid' => '16112',
|
||||
@ -197,7 +197,7 @@ my @tests = (
|
||||
},
|
||||
{
|
||||
'content' => 'backup',
|
||||
'ctime' => DEFAULT_CTIME,
|
||||
'ctime' => 1585597770,
|
||||
'format' => 'tar.gz',
|
||||
'size' => DEFAULT_SIZE,
|
||||
'vmid' => '16112',
|
||||
@ -205,7 +205,7 @@ my @tests = (
|
||||
},
|
||||
{
|
||||
'content' => 'backup',
|
||||
'ctime' => DEFAULT_CTIME,
|
||||
'ctime' => 1585598370,
|
||||
'format' => 'tgz',
|
||||
'size' => DEFAULT_SIZE,
|
||||
'vmid' => '16112',
|
||||
@ -347,7 +347,7 @@ my @tests = (
|
||||
},
|
||||
{
|
||||
'content' => 'backup',
|
||||
'ctime' => DEFAULT_CTIME,
|
||||
'ctime' => 1580756263,
|
||||
'format' => 'tar.gz',
|
||||
'size' => DEFAULT_SIZE,
|
||||
'vmid' => '19253',
|
||||
@ -355,7 +355,7 @@ my @tests = (
|
||||
},
|
||||
{
|
||||
'content' => 'backup',
|
||||
'ctime' => DEFAULT_CTIME,
|
||||
'ctime' => 1548095359,
|
||||
'format' => 'tar',
|
||||
'size' => DEFAULT_SIZE,
|
||||
'vmid' => '19254',
|
||||
|
||||
Reference in New Issue
Block a user